Search in sources :

Example 6 with NameValue

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());
}
Also used : NameValue(org.codice.alliance.nsili.common.UCO.NameValue) Query(org.codice.alliance.nsili.common.GIAS.Query) SortAttribute(org.codice.alliance.nsili.common.GIAS.SortAttribute) QueryLifeSpan(org.codice.alliance.nsili.common.GIAS.QueryLifeSpan) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) SubmitStandingQueryRequestImpl(org.codice.alliance.nsili.endpoint.requests.SubmitStandingQueryRequestImpl)

Example 7 with NameValue

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;
}
Also used : ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) OrderRequest(org.codice.alliance.nsili.common.GIAS.OrderRequest) NsiliEndpoint(org.codice.alliance.nsili.endpoint.NsiliEndpoint) NameValue(org.codice.alliance.nsili.common.UCO.NameValue) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) OrderRequestImpl(org.codice.alliance.nsili.endpoint.requests.OrderRequestImpl) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive)

Example 8 with NameValue

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) };
}
Also used : NameValue(org.codice.alliance.nsili.common.UCO.NameValue) Any(org.omg.CORBA.Any)

Example 9 with NameValue

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());
}
Also used : Product(org.codice.alliance.nsili.common.UID.Product) ResultImpl(ddf.catalog.data.impl.ResultImpl) DAG(org.codice.alliance.nsili.common.UCO.DAG) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Result(ddf.catalog.data.Result) NameValue(org.codice.alliance.nsili.common.UCO.NameValue) FileLocation(org.codice.alliance.nsili.common.UCO.FileLocation) GetRelatedFilesRequest(org.codice.alliance.nsili.common.GIAS.GetRelatedFilesRequest) Test(org.junit.Test)

Example 10 with NameValue

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());
}
Also used : Product(org.codice.alliance.nsili.common.UID.Product) ResultImpl(ddf.catalog.data.impl.ResultImpl) DAG(org.codice.alliance.nsili.common.UCO.DAG) Any(org.omg.CORBA.Any) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Result(ddf.catalog.data.Result) NameValue(org.codice.alliance.nsili.common.UCO.NameValue) FileLocation(org.codice.alliance.nsili.common.UCO.FileLocation) GetRelatedFilesRequest(org.codice.alliance.nsili.common.GIAS.GetRelatedFilesRequest) Test(org.junit.Test)

Aggregations

NameValue (org.codice.alliance.nsili.common.UCO.NameValue)13 Any (org.omg.CORBA.Any)6 DAG (org.codice.alliance.nsili.common.UCO.DAG)5 Result (ddf.catalog.data.Result)4 ResultImpl (ddf.catalog.data.impl.ResultImpl)4 GetRelatedFilesRequest (org.codice.alliance.nsili.common.GIAS.GetRelatedFilesRequest)4 FileLocation (org.codice.alliance.nsili.common.UCO.FileLocation)4 Product (org.codice.alliance.nsili.common.UID.Product)4 Test (org.junit.Test)4 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)3 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 URISyntaxException (java.net.URISyntaxException)2 KeyManagementException (java.security.KeyManagementException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 CertificateException (java.security.cert.CertificateException)2 OrderRequest (org.codice.alliance.nsili.common.GIAS.OrderRequest)2 QueryLifeSpan (org.codice.alliance.nsili.common.GIAS.QueryLifeSpan)2 SortAttribute (org.codice.alliance.nsili.common.GIAS.SortAttribute)2 ObjectAlreadyActive (org.omg.PortableServer.POAPackage.ObjectAlreadyActive)2