Exemplo n.º 1
0
  @Test
  public void testGetArtifact() {
    final DbArtifact dbArtifact = new DbArtifact();
    dbArtifact.setGroupId("groupId");
    dbArtifact.setArtifactId("artifactId");
    dbArtifact.setVersion("1.0.0-SNAPSHOT");
    dbArtifact.setClassifier("win");
    dbArtifact.setType("component");
    dbArtifact.setExtension("jar");
    dbArtifact.setDownloadUrl("nowhere");
    dbArtifact.setSize("10Mo");
    dbArtifact.setProvider("provider");

    final DbLicense license = new DbLicense();
    license.setName("licenseId");
    dbArtifact.addLicense(license);

    final ModelMapper modelMapper = new ModelMapper(mock(RepositoryHandler.class));
    final Artifact artifact = modelMapper.getArtifact(dbArtifact);

    assertEquals(dbArtifact.getGroupId(), artifact.getGroupId());
    assertEquals(dbArtifact.getArtifactId(), artifact.getArtifactId());
    assertEquals(dbArtifact.getVersion(), artifact.getVersion());
    assertEquals(dbArtifact.getClassifier(), artifact.getClassifier());
    assertEquals(dbArtifact.getType(), artifact.getType());
    assertEquals(dbArtifact.getExtension(), artifact.getExtension());
    assertEquals(dbArtifact.getSize(), artifact.getSize());
    assertEquals(dbArtifact.getDownloadUrl(), artifact.getDownloadUrl());
    assertEquals(dbArtifact.getProvider(), artifact.getProvider());
    assertEquals(1, artifact.getLicenses().size());
    assertEquals("licenseId", artifact.getLicenses().get(0));
  }
Exemplo n.º 2
0
 public void addLicense(final DbLicense license) {
   addLicense(license.getName());
 }