use of org.eclipse.sw360.datahandler.thrift.components.Release in project sw360portal by sw360.
the class ComponentSpecTest method before.
@Before
public void before() throws TException {
List<Component> componentList = new ArrayList<>();
List<Component> componentListByName = new ArrayList<>();
angularComponent = new Component();
angularComponent.setId("17653524");
angularComponent.setName("Angular");
angularComponent.setComponentOwner("John");
angularComponent.setDescription("Angular is a development platform for building mobile and desktop web applications.");
angularComponent.setCreatedOn("2016-12-15");
angularComponent.setCreatedBy("admin@sw360.org");
angularComponent.setComponentType(ComponentType.OSS);
angularComponent.setVendorNames(new HashSet<>(Collections.singletonList("Google")));
angularComponent.setModerators(new HashSet<>(Arrays.asList("admin@sw360.org", "john@sw360.org")));
angularComponent.setOwnerAccountingUnit("4822");
angularComponent.setOwnerCountry("DE");
angularComponent.setOwnerGroup("AA BB 123 GHV2-DE");
angularComponent.setCategories(ImmutableSet.of("java", "javascript", "sql"));
angularComponent.setLanguages(ImmutableSet.of("EN", "DE"));
angularComponent.setOperatingSystems(ImmutableSet.of("Windows", "Linux"));
componentList.add(angularComponent);
componentListByName.add(angularComponent);
Component springComponent = new Component();
springComponent.setId("678dstzd8");
springComponent.setName("Spring Framework");
springComponent.setComponentOwner("Jane");
springComponent.setDescription("The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications.");
springComponent.setCreatedOn("2016-12-18");
springComponent.setCreatedBy("jane@sw360.org");
springComponent.setComponentType(ComponentType.OSS);
springComponent.setVendorNames(new HashSet<>(Collections.singletonList("Pivotal")));
springComponent.setModerators(new HashSet<>(Arrays.asList("admin@sw360.org", "jane@sw360.org")));
springComponent.setOwnerAccountingUnit("5661");
springComponent.setOwnerCountry("FR");
springComponent.setOwnerGroup("SIM-KA12");
springComponent.setCategories(ImmutableSet.of("jdbc", "java"));
springComponent.setLanguages(ImmutableSet.of("EN", "DE"));
springComponent.setOperatingSystems(ImmutableSet.of("Windows", "Linux"));
componentList.add(springComponent);
when(this.componentServiceMock.createComponent(anyObject(), anyObject())).then(invocation -> {
springComponent.setType("component");
springComponent.setCreatedOn("2016-12-20");
springComponent.setModerators(null);
springComponent.setVendorNames(null);
return springComponent;
});
given(this.componentServiceMock.getComponentsForUser(anyObject())).willReturn(componentList);
given(this.componentServiceMock.getComponentForUserById(eq("17653524"), anyObject())).willReturn(angularComponent);
given(this.componentServiceMock.searchComponentByName(eq(angularComponent.getName()))).willReturn(componentListByName);
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);
List<Release> releaseList = new ArrayList<>();
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");
release.setCreatedBy("admin@sw360.org");
release.setModerators(new HashSet<>(Arrays.asList("admin@sw360.org", "jane@sw360.org")));
release.setComponentId(springComponent.getId());
releaseList.add(release);
Release release2 = new Release();
release2.setId("3765276512");
release2.setName("Angular 2.3.1");
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.setModerators(new HashSet<>(Arrays.asList("admin@sw360.org", "jane@sw360.org")));
release2.setComponentId(springComponent.getId());
releaseList.add(release2);
angularComponent.setReleases(releaseList);
}
use of org.eclipse.sw360.datahandler.thrift.components.Release in project sw360portal by sw360.
the class ReleaseResourceProcessor method process.
@Override
public Resource<Release> process(Resource<Release> resource) {
Release release = resource.getContent();
Link selfLink = linkTo(ReleaseController.class).slash("api" + ReleaseController.RELEASES_URL + "/" + release.getId()).withSelfRel();
resource.add(selfLink);
return resource;
}
use of org.eclipse.sw360.datahandler.thrift.components.Release in project sw360portal by sw360.
the class Sw360AttachmentService method getAttachmentByIdForUser.
public AttachmentInfo getAttachmentByIdForUser(String id, User sw360User) throws TException {
ComponentService.Iface sw360ComponentClient = getThriftComponentClient();
List<Release> releases = sw360ComponentClient.getReleaseSummary(sw360User);
for (Release release : releases) {
final Set<Attachment> attachments = release.getAttachments();
if (attachments != null && attachments.size() > 0) {
for (Attachment attachment : attachments) {
if (id.equals(attachment.getAttachmentContentId())) {
return new AttachmentInfo(attachment, release);
}
}
}
}
return null;
}
use of org.eclipse.sw360.datahandler.thrift.components.Release in project sw360portal by sw360.
the class WhenComputeClearingState method the_release_is_sent_for_clearing_to.
public WhenComputeClearingState the_release_is_sent_for_clearing_to(@Quoted String clearingTeam) {
Release release = getFirstRelease();
Map<String, FossologyStatus> clearingTeamToFossologyStatus = release.getClearingTeamToFossologyStatus();
clearingTeamToFossologyStatus.put(clearingTeam, FossologyStatus.SENT);
the_clearing_state_is_computed_for(lastTestedClearingTeam);
return self();
}
use of org.eclipse.sw360.datahandler.thrift.components.Release in project sw360portal by sw360.
the class AttachmentSpecTest method before.
@Before
public void before() throws TException {
List<Attachment> attachmentList = new ArrayList<>();
attachment = new Attachment();
attachment.setAttachmentContentId("76537653");
attachment.setFilename("spring-core-4.3.4.RELEASE.jar");
attachment.setSha1("da373e491d3863477568896089ee9457bc316783");
attachment.setAttachmentType(AttachmentType.BINARY_SELF);
attachment.setCreatedTeam("Clearing Team 1");
attachment.setCreatedComment("please check before Christmas :)");
attachment.setCreatedOn("2016-12-18");
attachment.setCreatedBy("admin@sw360.org");
attachment.setCheckedTeam("Clearing Team 2");
attachment.setCheckedComment("everything looks good");
attachment.setCheckedOn("2016-12-18");
attachment.setCheckStatus(CheckStatus.ACCEPTED);
attachmentList.add(attachment);
Release release = new Release();
release.setId("874687");
release.setName("Spring Core 4.3.4");
release.setCpeid("cpe:/a:pivotal:spring-core:4.3.4:");
release.setReleaseDate("2016-12-07");
release.setVersion("4.3.4");
release.setCreatedOn("2016-12-18");
release.setCreatedBy("admin@sw360.org");
release.setModerators(new HashSet<>(Arrays.asList(testUserId, testUserPassword)));
release.setComponentId("678dstzd8");
release.setClearingState(ClearingState.APPROVED);
AttachmentInfo attachmentInfo = new AttachmentInfo(attachment, release);
given(this.attachmentServiceMock.getAttachmentByIdForUser(eq(attachment.getAttachmentContentId()), anyObject())).willReturn(attachmentInfo);
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);
}
Aggregations