protected Long populateDB(Mpack mpacks) throws IOException {
    String mpackName = mpacks.getName();
    String mpackVersion = mpacks.getVersion();
    List resultSet = mpackDAO.findByNameVersion(mpackName, mpackVersion);
    StackEntity stackEntity = stackDAO.find(mpackName, mpackVersion);
    if (resultSet.size() == 0 && stackEntity == null) {
      LOG.info("Adding mpack {}-{} to the database", mpackName, mpackVersion);
      MpackEntity mpackEntity = new MpackEntity();
      mpackEntity.setMpackName(mpackName);
      mpackEntity.setMpackVersion(mpackVersion);
      mpackEntity.setMpackUri(mpack.getMpackUri());
      mpackEntity.setRegistryId(mpack.getRegistryId());
      Long mpackId = mpackDAO.create(mpackEntity);
      return mpackId;
    }
    //mpack already exists
    return null;
  }
Make an entry in the mpacks database for the newly registered mpack.

@param mpacks
@return
@throws IOException
ambari-server/src/test/java/org/apache/ambari/server/mpack/MpackManagerMock.java