use of org.codice.alliance.nsili.common.UCO.NameListHolder in project alliance by codice.
the class GetRelatedFilesRequestImplTest method testNoThumbnail.
@Test
public void testNoThumbnail() throws Exception {
NameListHolder locations = new NameListHolder();
GetRelatedFilesRequestImpl noPortRequest = new GetRelatedFilesRequestImpl(getBadMetacards(), getTestFileLocation(), "THUMBNAIL", null);
noPortRequest.setHttpClient(mockHttpClient);
State state = noPortRequest.complete(locations);
assertValidStateNoLocs(state, locations);
}
use of org.codice.alliance.nsili.common.UCO.NameListHolder in project alliance by codice.
the class GetRelatedFilesRequestImplTest method testComplete201.
@Test
public void testComplete201() throws Exception {
when(mockHttpClient.execute(any(HttpUriRequest.class))).thenReturn(getGoodResponse(201));
NameListHolder locations = new NameListHolder();
State state = relatedFilesRequest.complete(locations);
assertValidState(state, locations);
}
use of org.codice.alliance.nsili.common.UCO.NameListHolder in project alliance by codice.
the class GetRelatedFilesRequestImplTest method testComplete202.
@Test
public void testComplete202() throws Exception {
when(mockHttpClient.execute(any(HttpUriRequest.class))).thenReturn(getGoodResponse(202));
NameListHolder locations = new NameListHolder();
State state = relatedFilesRequest.complete(locations);
assertValidState(state, locations);
}
use of org.codice.alliance.nsili.common.UCO.NameListHolder in project alliance by codice.
the class GetRelatedFilesRequestImplTest method testNoHostLocation.
@Test
public void testNoHostLocation() throws Exception {
FileLocation fileLocation = getTestFileLocation();
fileLocation.host_name = "";
NameListHolder locations = new NameListHolder();
GetRelatedFilesRequestImpl noPortRequest = new GetRelatedFilesRequestImpl(getTestMetacards(), fileLocation, "THUMBNAIL", null);
noPortRequest.setHttpClient(mockHttpClient);
State state = noPortRequest.complete(locations);
assertValidStateNoLocs(state, locations);
}
use of org.codice.alliance.nsili.common.UCO.NameListHolder in project alliance by codice.
the class SampleNsiliClient method getRelatedFiles.
public String[] getRelatedFiles(Product product) throws Exception {
if (productMgr != null) {
LOGGER.info("Sending Get Related Files Request...");
final FileLocation fileLocation = new FileLocation("user", "pass", "localhost", "/nsili/file", "");
Any portAny = orb.create_any();
portAny.insert_string(String.valueOf(listenPort));
NameValue portProp = new NameValue("PORT", portAny);
NameValue[] properties = new NameValue[] { portProp };
Product[] products = { product };
GetRelatedFilesRequest relatedFilesRequest = productMgr.get_related_files(products, fileLocation, NsiliConstants.THUMBNAIL_TYPE, properties);
relatedFilesRequest.set_user_info(ALLIANCE);
NameListHolder locations = new NameListHolder();
relatedFilesRequest.complete(locations);
String[] locationList = locations.value;
if (locationList.length > 0) {
LOGGER.info("Location List : ");
for (String location : locationList) {
LOGGER.info("\t Stored File: {}", location);
}
} else {
LOGGER.info("No locations returned from Get Related Files Request");
}
return locationList;
} else {
LOGGER.warn("ProductMgr is not initialized, unable to get related files");
return null;
}
}
Aggregations