コード例 #1
0
  /**
   * Adds information about references licenses.
   *
   * @param pomDescriptor The descriptor for the current POM.
   * @param model The Maven Model.
   * @param store The database.
   */
  private void addLicenses(MavenPomDescriptor pomDescriptor, Model model, Store store) {
    List<License> licenses = model.getLicenses();
    for (License license : licenses) {
      MavenLicenseDescriptor licenseDescriptor = store.create(MavenLicenseDescriptor.class);
      licenseDescriptor.setUrl(license.getUrl());
      licenseDescriptor.setComments(license.getComments());
      licenseDescriptor.setName(license.getName());
      licenseDescriptor.setDistribution(license.getDistribution());

      pomDescriptor.getLicenses().add(licenseDescriptor);
    }
  }
コード例 #2
0
ファイル: ModelMapperTest.java プロジェクト: mgaunin/Grapes
  @Test
  public void testGetDbLicense() throws Exception {
    final License license =
        DataModelFactory.createLicense("name", "longName", "comments", "regexp", "url");
    final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class));
    final DbLicense dbLicense = modelMapper.getDbLicense(license);

    assertEquals(license.getName(), dbLicense.getName());
    assertEquals(license.getLongName(), dbLicense.getLongName());
    assertEquals(license.getComments(), dbLicense.getComments());
    assertEquals(license.getRegexp(), dbLicense.getRegexp());
    assertEquals(license.getUrl(), dbLicense.getUrl());
  }
コード例 #3
0
ファイル: ModelMapperTest.java プロジェクト: mgaunin/Grapes
  @Test
  public void testGetLicense() throws Exception {
    final DbLicense dbLicense = new DbLicense();
    dbLicense.setName("name");
    dbLicense.setLongName("long name");
    dbLicense.setComments("comment");
    dbLicense.setRegexp("regexp");
    dbLicense.setUrl("url");

    final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class));
    final License license = modelMapper.getLicense(dbLicense);

    assertEquals(dbLicense.getName(), license.getName());
    assertEquals(dbLicense.getLongName(), license.getLongName());
    assertEquals(dbLicense.getComments(), license.getComments());
    assertEquals(dbLicense.getRegexp(), license.getRegexp());
    assertEquals(dbLicense.getUrl(), license.getUrl());
  }