use of org.codice.alliance.nsili.common.UCO.NameValue in project alliance by codice.
the class SubmitStandingQueryRequestImplTest method setupStandingQueryRequest.
private void setupStandingQueryRequest() throws InvalidInputParameter, SystemFault, ProcessingFault, WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive {
Query query = getQuery();
String[] resultAttributes = new String[0];
SortAttribute[] sortAttributes = new SortAttribute[0];
QueryLifeSpan lifespan = getEmptyLifespan();
NameValue[] properties = new NameValue[0];
// Set artificially low for for test cases.
long defaultUpdateFrequencyMsec = 2000;
int maxPendingResults = 10000;
long maxWaitToStartTimeMsecs = TimeUnit.MINUTES.toMillis(5);
standingQueryRequest = new SubmitStandingQueryRequestImpl(query, resultAttributes, sortAttributes, lifespan, properties, mockFramework, filterBuilder, defaultUpdateFrequencyMsec, null, maxPendingResults, true, false, maxWaitToStartTimeMsecs);
standingQueryRequest.register_callback(mockCallback2);
String managerId = UUID.randomUUID().toString();
rootPOA.activate_object_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), standingQueryRequest);
rootPOA.create_reference_with_id(managerId.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), CreationMgrHelper.id());
}
use of org.codice.alliance.nsili.common.UCO.NameValue in project alliance by codice.
the class OrderMgrImpl method order.
@Override
public OrderRequest order(OrderContents order, NameValue[] properties) throws ProcessingFault, InvalidInputParameter, SystemFault {
String protocol = "http";
int port = 80;
for (NameValue prop : properties) {
if (prop.aname.equals(NsiliConstants.PROP_PROTOCOL)) {
protocol = DAGConverter.getString(prop.value);
} else if (prop.aname.equals(NsiliConstants.PROP_PORT)) {
Integer portInteger = DAGConverter.getInteger(prop.value);
if (portInteger != null) {
port = portInteger;
}
}
}
OrderRequestImpl orderRequestImpl = new OrderRequestImpl(order, protocol, port, getAccessManager(), catalogFramework, emailConfiguration);
String id = UUID.randomUUID().toString();
try {
_poa().activate_object_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), orderRequestImpl);
} catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
LOGGER.debug("order : Unable to activate orderRequest object.", e);
}
org.omg.CORBA.Object obj = _poa().create_reference_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), OrderRequestHelper.id());
OrderRequest orderRequest = OrderRequestHelper.narrow(obj);
return orderRequest;
}
use of org.codice.alliance.nsili.common.UCO.NameValue in project alliance by codice.
the class NsiliSource method getDefaultPropertyList.
/**
* Returns the Default Property List defined in the STANAG 4559 specification.
*
* @return - default WGS84 Geographic Datum.
*/
private NameValue[] getDefaultPropertyList() {
Any defaultAnyProperty = orb.create_any();
defaultAnyProperty.insert_string(WGS84);
return new NameValue[] { new NameValue(GEOGRAPHIC_DATUM, defaultAnyProperty) };
}
use of org.codice.alliance.nsili.common.UCO.NameValue in project alliance by codice.
the class ProductMgrImplTest method testGetRelatedFiles.
@Test
public void testGetRelatedFiles() throws Exception {
MetacardImpl testMetacard = new MetacardImpl();
testMetacard.setId(testMetacardId);
testMetacard.setTitle("JUnit Test Card");
Result testResult = new ResultImpl(testMetacard);
DAG dag = ResultDAGConverter.convertResult(testResult, orb, rootPOA, new ArrayList<>(), new HashMap<>());
Product product = ProductHelper.extract(dag.nodes[0].value);
Product[] products = new Product[] { product };
String userName = "";
String password = "";
String hostName = "localhost";
String pathName = "/nsili/file";
FileLocation location = new FileLocation(userName, password, hostName, pathName, null);
NameValue[] props = new NameValue[0];
GetRelatedFilesRequest request = productMgr.get_related_files(products, location, NsiliConstants.THUMBNAIL_TYPE, props);
assertThat(request, notNullValue());
}
use of org.codice.alliance.nsili.common.UCO.NameValue in project alliance by codice.
the class ProductMgrImplTest method testGetRelatedFilesWithPort.
@Test
public void testGetRelatedFilesWithPort() throws Exception {
MetacardImpl testMetacard = new MetacardImpl();
testMetacard.setId(testMetacardId);
testMetacard.setTitle("JUnit Test Card");
Result testResult = new ResultImpl(testMetacard);
DAG dag = ResultDAGConverter.convertResult(testResult, orb, rootPOA, new ArrayList<>(), new HashMap<>());
Product product = ProductHelper.extract(dag.nodes[0].value);
Product[] products = new Product[] { product };
String userName = "";
String password = "";
String hostName = "localhost";
String pathName = "/nsili/file";
FileLocation location = new FileLocation(userName, password, hostName, pathName, null);
NameValue[] props = new NameValue[1];
Any portAny = orb.create_any();
portAny.insert_string("2000");
NameValue prop = new NameValue("PORT", portAny);
props[0] = prop;
GetRelatedFilesRequest request = productMgr.get_related_files(products, location, NsiliConstants.THUMBNAIL_TYPE, props);
assertThat(request, notNullValue());
}
Aggregations