use of org.apache.thrift.protocol.TCompactProtocol in project sw360portal by sw360.
the class TestLicenseClient method main.
public static void main(String[] args) throws TException, IOException {
THttpClient thriftClient = new THttpClient("http://127.0.0.1:8080/licenses/thrift");
TProtocol protocol = new TCompactProtocol(thriftClient);
LicenseService.Iface client = new LicenseService.Client(protocol);
List<License> licenses = client.getLicenseSummary();
List<Obligation> obligations = client.getObligations();
System.out.println("Fetched " + licenses.size() + " licenses from license service");
System.out.println("Fetched " + obligations.size() + " obligations from license service");
// final List<License> licenseList = client.getDetailedLicenseSummaryForExport("");
final List<License> licenseList = client.getDetailedLicenseSummary("", ImmutableList.of("AFL-2.1", "Artistic-1.0"));
System.out.println(licenseList.toString());
}
use of org.apache.thrift.protocol.TCompactProtocol in project sw360portal by sw360.
the class TestVendorClient method main.
public static void main(String[] args) throws TException, IOException {
THttpClient thriftClient = new THttpClient("http://127.0.0.1:8080/vendorservice/thrift");
TProtocol protocol = new TCompactProtocol(thriftClient);
VendorService.Iface client = new VendorService.Client(protocol);
List<Vendor> vendors = client.getAllVendors();
reportFindings(vendors);
System.out.println("Now looking for matches starting with 'm' from vendor service");
reportFindings(client.searchVendors("m"));
}
use of org.apache.thrift.protocol.TCompactProtocol in project sw360portal by sw360.
the class TestSearchClient method main.
public static void main(String[] args) throws TException, IOException {
THttpClient thriftClient = new THttpClient("http://127.0.0.1:8080/search/thrift");
TProtocol protocol = new TCompactProtocol(thriftClient);
SearchService.Iface client = new SearchService.Client(protocol);
List<SearchResult> results = client.search(searchtext, null);
// List<SearchResult> results = new SearchHandler().search(searchtext);
// http://localhost:5984/_fti/local/sw360db/_design/lucene/all?q=type:project%20AND%20P1*
System.out.println("Fetched " + results.size() + " from search service");
for (SearchResult result : results) {
System.out.println(result.getId() + "(" + result.getType() + "): " + result.getName() + " (" + result.getScore() + ")");
}
}
use of org.apache.thrift.protocol.TCompactProtocol in project sw360portal by sw360.
the class TestProjectClient method main.
public static void main(String[] args) throws TException, IOException {
THttpClient thriftClient = new THttpClient("http://127.0.0.1:8080/projects/thrift");
TProtocol protocol = new TCompactProtocol(thriftClient);
ProjectService.Iface client = new ProjectService.Client(protocol);
// User cedric = new User().setEmail("cedric.bodet@tngtech.com").setDepartment("CT BE OSS TNG CB");
// Project myProject = new Project().setName("First project").setDescription("My first project");
// client.addProject(myProject, cedric);
// List<Project> projects = client.getBUProjectsSummary("CT BE OSS");
// System.out.println("Fetched " + projects.size() + " from project service");
// for (Project project : projects) {
// System.out.println(project.toString());
// }
}
use of org.apache.thrift.protocol.TCompactProtocol in project sw360portal by sw360.
the class TestComponentClient method main.
public static void main(String[] args) throws TException, IOException {
THttpClient thriftClient = new THttpClient("http://127.0.0.1:8080/components/thrift");
TProtocol protocol = new TCompactProtocol(thriftClient);
ComponentService.Iface client = new ComponentService.Client(protocol);
// List<Component> components = client.getComponentSummary(user);
// List<Component> recentComponents = client.getRecentComponents();
// List<Release> releases = client.getReleaseSummary(user);
//
// System.out.println("Fetched " + components.size() + " components from license service");
// System.out.println("Fetched " + releases.size() + " releases from license service");
// System.out.println("Fetched " + recentComponents.size() + " recent components from license service");
//
// String referenceId =null;
// for (Component component : recentComponents) {
// if(referenceId==null) referenceId=component.getId();
// System.out.println(component.getId() + ": " + component.getName());
// }
//
// if(referenceId!=null) {
// System.out.println(client.getComponentById(referenceId, user).toString());
// Component component = new ComponentHandler("http://localhost:5984", "sw360db", "sw360attachments").getComponentById(referenceId, user);
// System.out.println(component.toString());
// System.out.println(client.getComponentById(referenceId, user).toString());
// }
//
// for(Release release : releases) {
// System.out.println(release.toString());
// }
// // This fails with a thrift error... debug!
// if(releases.size()>0) {
// String releaseNameStart = releases.get(0).getName().substring(0,1);
// System.out.println("The following releases start with " + releaseNameStart );
//
// List<Release> releases1 = client.searchReleaseByName(releaseNameStart);
// for(Release release : releases1) {
// System.out.println(release.toString());
// }
//
// }
// final Component cpe = client.getComponentForReportFromCPEId("cpe");
// System.out.println(cpe.toString());
}
Aggregations