use of org.eclipse.sw360.datahandler.thrift.components.Component in project sw360portal by sw360.
the class ComponentHelper method makeRowsWithReleases.
private SubTable makeRowsWithReleases(Component component) throws SW360Exception {
List<Release> releases = getReleases(component);
SubTable table = new SubTable();
if (releases.size() > 0) {
for (Release release : releases) {
List<String> currentRow = makeRowForComponent(component);
currentRow.addAll(releaseHelper.makeRows(release).elements.get(0));
table.addRow(currentRow);
}
} else {
List<String> componentRowWithEmptyReleaseFields = makeRowForComponent(component);
for (int i = 0; i < releaseHelper.getColumns(); i++) {
componentRowWithEmptyReleaseFields.add("");
}
table.addRow(componentRowWithEmptyReleaseFields);
}
return table;
}
use of org.eclipse.sw360.datahandler.thrift.components.Component in project sw360portal by sw360.
the class ReleaseSpecTest method before.
@Before
public void before() throws TException {
Component component = new Component();
component.setId("17653524");
component.setName("Angular");
component.setDescription("Angular is a development platform for building mobile and desktop web applications.");
component.setCreatedOn("2016-12-15");
component.setCreatedBy("admin@sw360.org");
component.setComponentType(ComponentType.OSS);
component.setVendorNames(new HashSet<>(Collections.singletonList("Google")));
component.setModerators(new HashSet<>(Arrays.asList("admin@sw360.org", "john@sw360.org")));
List<Release> releaseList = new ArrayList<>();
release = new Release();
release.setId("3765276512");
release.setName("Angular");
release.setCpeid("cpe:/a:Google:Angular:2.3.0:");
release.setReleaseDate("2016-12-07");
release.setVersion("2.3.0");
release.setCreatedOn("2016-12-18");
release.setCreatedBy("admin@sw360.org");
release.setDownloadurl("http://www.google.com");
release.setModerators(new HashSet<>(Arrays.asList("admin@sw360.org", "jane@sw360.org")));
release.setComponentId(component.getId());
release.setClearingState(ClearingState.APPROVED);
release.setMainlineState(MainlineState.OPEN);
release.setExternalIds(Collections.singletonMap("mainline-id-component", "1432"));
releaseList.add(release);
Release release2 = new Release();
release2.setId("3765276512");
release2.setName("Angular");
release2.setCpeid("cpe:/a:Google:Angular:2.3.1:");
release2.setReleaseDate("2016-12-15");
release2.setVersion("2.3.1");
release2.setCreatedOn("2016-12-18");
release2.setCreatedBy("admin@sw360.org");
release2.setDownloadurl("http://www.google.com");
release2.setModerators(new HashSet<>(Arrays.asList("admin@sw360.org", "jane@sw360.org")));
release2.setComponentId(component.getId());
release2.setClearingState(ClearingState.APPROVED);
release2.setMainlineState(MainlineState.MAINLINE);
release2.setExternalIds(Collections.singletonMap("mainline-id-component", "4876"));
releaseList.add(release2);
given(this.releaseServiceMock.getReleasesForUser(anyObject())).willReturn(releaseList);
given(this.releaseServiceMock.getReleaseForUserById(eq(release.getId()), anyObject())).willReturn(release);
User user = new User();
user.setId("admin@sw360.org");
user.setEmail("admin@sw360.org");
user.setFullname("John Doe");
given(this.userServiceMock.getUserByEmail("admin@sw360.org")).willReturn(user);
}
use of org.eclipse.sw360.datahandler.thrift.components.Component in project sw360portal by sw360.
the class ProjectSpecTest method before.
@Before
public void before() throws TException {
Map<String, ProjectReleaseRelationship> linkedReleases = new HashMap<>();
Map<String, ProjectRelationship> linkedProjects = new HashMap<>();
ProjectReleaseRelationship projectReleaseRelationship = new ProjectReleaseRelationship(CONTAINED, MAINLINE);
List<Project> projectList = new ArrayList<>();
List<Project> projectListByName = new ArrayList<>();
project = new Project();
project.setId("376576");
project.setName("Emerald Web");
project.setProjectType(ProjectType.PRODUCT);
project.setVersion("1.0.2");
project.setDescription("Emerald Web provides a suite of components for Critical Infrastructures.");
project.setCreatedOn("2016-12-15");
project.setCreatedBy("admin@sw360.org");
project.setModerators(new HashSet<>(Arrays.asList("admin@sw360.org", "jane@sw360.org")));
project.setBusinessUnit("sw360 AR");
project.setExternalIds(Collections.singletonMap("mainline-id-project", "515432"));
project.setOwnerAccountingUnit("4822");
project.setOwnerCountry("DE");
project.setOwnerGroup("AA BB 123 GHV2-DE");
project.setTag("project test tag 1");
project.setPreevaluationDeadline("2018-07-17");
project.setSystemTestStart("2017-01-01");
project.setSystemTestEnd("2018-03-01");
linkedReleases.put("3765276512", projectReleaseRelationship);
project.setReleaseIdToUsage(linkedReleases);
linkedProjects.put("376576", ProjectRelationship.CONTAINED);
project.setLinkedProjects(linkedProjects);
projectList.add(project);
projectListByName.add(project);
Project project2 = new Project();
project2.setId("376570");
project2.setName("Orange Web");
project2.setVersion("2.0.1");
project2.setProjectType(ProjectType.PRODUCT);
project2.setDescription("Orange Web provides a suite of components for documentation.");
project2.setCreatedOn("2016-12-17");
project2.setCreatedBy("john@sw360.org");
project2.setBusinessUnit("sw360 EX DF");
project2.setOwnerAccountingUnit("5661");
project2.setOwnerCountry("FR");
project2.setOwnerGroup("SIM-KA12");
project2.setTag("project test tag 2");
project2.setPreevaluationDeadline("2018-07-17");
project2.setSystemTestStart("2017-01-01");
project2.setSystemTestEnd("2018-03-01");
project2.setExternalIds(Collections.singletonMap("mainline-id-project", "7657"));
linkedReleases = new HashMap<>();
linkedReleases.put("5578999", projectReleaseRelationship);
project2.setReleaseIdToUsage(linkedReleases);
projectList.add(project2);
Set<String> releaseIds = new HashSet<>(Arrays.asList("3765276512"));
Set<String> releaseIdsTransitive = new HashSet<>(Arrays.asList("3765276512", "5578999"));
given(this.projectServiceMock.getProjectsForUser(anyObject())).willReturn(projectList);
given(this.projectServiceMock.getProjectForUserById(eq(project.getId()), anyObject())).willReturn(project);
given(this.projectServiceMock.searchProjectByName(eq(project.getName()), anyObject())).willReturn(projectListByName);
given(this.projectServiceMock.getReleaseIds(eq(project.getId()), anyObject(), eq("false"))).willReturn(releaseIds);
given(this.projectServiceMock.getReleaseIds(eq(project.getId()), anyObject(), eq("true"))).willReturn(releaseIdsTransitive);
Release release = new Release();
release.setId("3765276512");
release.setName("Angular 2.3.0");
release.setCpeid("cpe:/a:Google:Angular:2.3.0:");
release.setReleaseDate("2016-12-07");
release.setVersion("2.3.0");
release.setCreatedOn("2016-12-18");
EccInformation eccInformation = new EccInformation();
eccInformation.setEccStatus(ECCStatus.APPROVED);
release.setEccInformation(eccInformation);
release.setCreatedBy("admin@sw360.org");
release.setModerators(new HashSet<>(Arrays.asList("admin@sw360.org", "jane@sw360.org")));
release.setComponentId("12356115");
release.setClearingState(ClearingState.APPROVED);
release.setExternalIds(Collections.singletonMap("mainline-id-component", "1432"));
Release release2 = new Release();
release2.setId("5578999");
release2.setName("Spring 1.4.0");
release2.setCpeid("cpe:/a:Spring:1.4.0:");
release2.setReleaseDate("2017-05-06");
release2.setVersion("1.4.0");
release2.setCreatedOn("2017-11-19");
eccInformation.setEccStatus(ECCStatus.APPROVED);
release2.setEccInformation(eccInformation);
release2.setCreatedBy("admin@sw360.org");
release2.setModerators(new HashSet<>(Arrays.asList("admin@sw360.org", "jane@sw360.org")));
release2.setComponentId("12356115");
release2.setClearingState(ClearingState.APPROVED);
release2.setExternalIds(Collections.singletonMap("mainline-id-component", "1771"));
given(this.releaseServiceMock.getReleaseForUserById(eq(release.getId()), anyObject())).willReturn(release);
given(this.releaseServiceMock.getReleaseForUserById(eq(release2.getId()), anyObject())).willReturn(release2);
User user = new User();
user.setId("admin@sw360.org");
user.setEmail("admin@sw360.org");
user.setFullname("John Doe");
user.setDepartment("sw360");
given(this.userServiceMock.getUserByEmail("admin@sw360.org")).willReturn(user);
}
use of org.eclipse.sw360.datahandler.thrift.components.Component in project sw360portal by sw360.
the class ComponentResourceProcessor method process.
@Override
public Resource<Component> process(Resource<Component> resource) {
Component component = resource.getContent();
Link selfLink = linkTo(ComponentController.class).slash("api" + ComponentController.COMPONENTS_URL + "/" + component.getId()).withSelfRel();
resource.add(selfLink);
return resource;
}
Aggregations