use of org.eclipse.sw360.datahandler.thrift.ThriftClients in project sw360portal by sw360.
the class ComponentPortletUtils method unsubscribeComponent.
public static RequestStatus unsubscribeComponent(ResourceRequest request, Logger log) {
String id = request.getParameter(PortalConstants.COMPONENT_ID);
if (id != null) {
try {
ComponentService.Iface client = new ThriftClients().makeComponentClient();
User user = UserCacheHolder.getUserFromRequest(request);
return client.unsubscribeComponent(id, user);
} catch (TException e) {
log.error("Could not unsubscribe to component", e);
}
}
return RequestStatus.FAILURE;
}
use of org.eclipse.sw360.datahandler.thrift.ThriftClients in project sw360portal by sw360.
the class ComponentPortletUtils method unsubscribeRelease.
public static RequestStatus unsubscribeRelease(ResourceRequest request, Logger log) {
String id = request.getParameter(PortalConstants.RELEASE_ID);
if (id != null) {
try {
ComponentService.Iface client = new ThriftClients().makeComponentClient();
User user = UserCacheHolder.getUserFromRequest(request);
return client.unsubscribeRelease(id, user);
} catch (TException e) {
log.error("Could not unsubscribe to release", e);
}
}
return RequestStatus.FAILURE;
}
use of org.eclipse.sw360.datahandler.thrift.ThriftClients in project sw360portal by sw360.
the class ComponentPortletUtils method subscribeComponent.
public static RequestStatus subscribeComponent(ResourceRequest request, Logger log) {
String id = request.getParameter(PortalConstants.COMPONENT_ID);
if (id != null) {
try {
ComponentService.Iface client = new ThriftClients().makeComponentClient();
User user = UserCacheHolder.getUserFromRequest(request);
return client.subscribeComponent(id, user);
} catch (TException e) {
log.error("Could not subscribe to component", e);
}
}
return RequestStatus.FAILURE;
}
use of org.eclipse.sw360.datahandler.thrift.ThriftClients in project sw360portal by sw360.
the class FossologyFileHandlerTest method setUp.
@Before
public void setUp() throws TException {
ThriftClients thriftClients = TestUtils.failingMock(ThriftClients.class);
doReturn(componentService).when(thriftClients).makeComponentClient();
user = TestUtils.getAdminUser(getClass());
fossologyFileHandler = spy(new FossologyFileHandler(attachmentConnector, fossologyUploader, thriftClients));
}
use of org.eclipse.sw360.datahandler.thrift.ThriftClients in project sw360portal by sw360.
the class ComponentAndAttachmentAwareDBTest method getThriftClients.
protected static ThriftClients getThriftClients() throws TException, IOException {
assertTestDbNames();
ThriftClients thriftClients = failingMock(ThriftClients.class);
ComponentHandler componentHandler = new ComponentHandler(thriftClients);
VendorHandler vendorHandler = new VendorHandler();
AttachmentHandler attachmentHandler = new AttachmentHandler();
ModerationService.Iface moderationService = failingMock(ModerationService.Iface.class);
doNothing().when(moderationService).deleteRequestsOnDocument(anyString());
doReturn(componentHandler).when(thriftClients).makeComponentClient();
doReturn(vendorHandler).when(thriftClients).makeVendorClient();
doReturn(attachmentHandler).when(thriftClients).makeAttachmentClient();
doReturn(moderationService).when(thriftClients).makeModerationClient();
return thriftClients;
}
Aggregations