Search in sources :

Example 6 with EccInformation

use of org.eclipse.sw360.datahandler.thrift.components.EccInformation in project sw360portal by sw360.

the class DisplayReleaseChanges method renderEccInformation.

private String renderEccInformation() {
    if (!ensureSomethingTodoAndNoNull(Release._Fields.ECC_INFORMATION)) {
        return "";
    }
    StringBuilder display = new StringBuilder();
    if (!actual.isSet(Release._Fields.ECC_INFORMATION)) {
        actual.eccInformation = newDefaultEccInformation();
    }
    for (EccInformation._Fields field : EccInformation._Fields.values()) {
        FieldMetaData fieldMetaData = EccInformation.metaDataMap.get(field);
        displaySimpleFieldOrSet(display, actual.getEccInformation(), additions.getEccInformation(), deletions.getEccInformation(), field, fieldMetaData, "");
    }
    return "<h3> Changes in ECC Information </h3>" + String.format("<table class=\"%s\" id=\"%schanges\" >", tableClasses, idPrefix) + String.format("<thead><tr><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr></thead><tbody>", FIELD_NAME, CURRENT_VAL, DELETED_VAL, SUGGESTED_VAL) + display.toString() + "</tbody></table>";
}
Also used : EccInformation(org.eclipse.sw360.datahandler.thrift.components.EccInformation) SW360Utils.newDefaultEccInformation(org.eclipse.sw360.datahandler.common.SW360Utils.newDefaultEccInformation) FieldMetaData(org.apache.thrift.meta_data.FieldMetaData)

Example 7 with EccInformation

use of org.eclipse.sw360.datahandler.thrift.components.EccInformation 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);
}
Also used : EccInformation(org.eclipse.sw360.datahandler.thrift.components.EccInformation) User(org.eclipse.sw360.datahandler.thrift.users.User) Project(org.eclipse.sw360.datahandler.thrift.projects.Project) ProjectRelationship(org.eclipse.sw360.datahandler.thrift.projects.ProjectRelationship) ProjectReleaseRelationship(org.eclipse.sw360.datahandler.thrift.ProjectReleaseRelationship) Release(org.eclipse.sw360.datahandler.thrift.components.Release) Before(org.junit.Before)

Aggregations

SW360Utils.newDefaultEccInformation (org.eclipse.sw360.datahandler.common.SW360Utils.newDefaultEccInformation)5 EccInformation (org.eclipse.sw360.datahandler.thrift.components.EccInformation)3 FieldMetaData (org.apache.thrift.meta_data.FieldMetaData)1 DatabaseConnector (org.eclipse.sw360.datahandler.couchdb.DatabaseConnector)1 ComponentDatabaseHandler (org.eclipse.sw360.datahandler.db.ComponentDatabaseHandler)1 ProjectReleaseRelationship (org.eclipse.sw360.datahandler.thrift.ProjectReleaseRelationship)1 Release (org.eclipse.sw360.datahandler.thrift.components.Release)1 Project (org.eclipse.sw360.datahandler.thrift.projects.Project)1 ProjectRelationship (org.eclipse.sw360.datahandler.thrift.projects.ProjectRelationship)1 User (org.eclipse.sw360.datahandler.thrift.users.User)1 Vendor (org.eclipse.sw360.datahandler.thrift.vendors.Vendor)1 Before (org.junit.Before)1 Test (org.junit.Test)1