MavenProjectImporter { public Project importMavenProject( String groupId, String artifactId, String version ) { Project project = repositoryService.retrieveProject( groupId, artifactId, version ); projectStore.store( project ); return project; }  Project importMavenProject( String groupId, String artifactId, String version );  }
@Test public void importArtifact() { String id = "groupId:artifactId"; assert store.getProjectById( id ) == null; Project project = importer.importMavenProject( "groupId", "artifactId", "1.0-SNAPSHOT" ); assert id.equals( project.getId() ); assert "1.0-SNAPSHOT".equals( project.getVersion() ); assert "description".equals( project.getDescription() ); assert "name".equals( project.getName() ); assert "issueTrackerUrl".equals( project.getIssueTrackerUrl() ); assert "scmUrl".equals( project.getScmUrl() ); assert "url".equals( project.getUrl() ); assert "ciManagementUrl".equals( project.getCiManagementUrl() ); assert "repositoryUrl".equals( project.getRepositoryUrl() ); assert "snapshotRepositoryUrl".equals( project.getSnapshotRepositoryUrl() ); MavenCoordinates coordinate = (MavenCoordinates) project.getExtensionModel( "maven" ); assert "groupId".equals( coordinate.getGroupId() ); assert "artifactId".equals( coordinate.getArtifactId() ); assert store.getProjectById( id ) == project; }
@Test public void importModifiedArtifact() { String id = "groupId:artifactId"; assert store.getProjectById( id ) == null; Project project = new Project(); project.setId( id ); store.store( project ); assert store.getProjectById( id ) == project; Project newProject = importer.importMavenProject( "groupId", "artifactId", "1.0-SNAPSHOT" ); assert id.equals( newProject.getId() ); assert "1.0-SNAPSHOT".equals( newProject.getVersion() ); assert "description".equals( newProject.getDescription() ); assert "name".equals( newProject.getName() ); assert "issueTrackerUrl".equals( newProject.getIssueTrackerUrl() ); assert "scmUrl".equals( newProject.getScmUrl() ); assert "url".equals( newProject.getUrl() ); assert "ciManagementUrl".equals( newProject.getCiManagementUrl() ); assert "repositoryUrl".equals( newProject.getRepositoryUrl() ); assert "snapshotRepositoryUrl".equals( newProject.getSnapshotRepositoryUrl() ); MavenCoordinates coordinate = (MavenCoordinates) newProject.getExtensionModel( "maven" ); assert "groupId".equals( coordinate.getGroupId() ); assert "artifactId".equals( coordinate.getArtifactId() ); assert store.getProjectById( id ) != project; assert store.getProjectById( id ) == newProject; }