Search in sources :

Example 1 with GetParametersRequest

use of org.codice.alliance.nsili.common.GIAS.GetParametersRequest in project alliance by codice.

the class ProductMgrImplTest method testGetParametersNullDesiredParams.

@Test
public void testGetParametersNullDesiredParams() 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);
    GetParametersRequest parametersRequest = productMgr.get_parameters(product, null, null);
    assertThat(parametersRequest, notNullValue());
    DAGHolder dagHolder = new DAGHolder();
    parametersRequest.complete(dagHolder);
    assertThat(dagHolder, notNullValue());
}
Also used : DAGHolder(org.codice.alliance.nsili.common.UCO.DAGHolder) 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) GetParametersRequest(org.codice.alliance.nsili.common.GIAS.GetParametersRequest) Result(ddf.catalog.data.Result) Test(org.junit.Test)

Example 2 with GetParametersRequest

use of org.codice.alliance.nsili.common.GIAS.GetParametersRequest in project alliance by codice.

the class ProductMgrImplTest method testGetParameters.

@Test
public void testGetParameters() 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);
    GetParametersRequest parametersRequest = productMgr.get_parameters(product, new String[] { "ALL" }, null);
    assertThat(parametersRequest, notNullValue());
    DAGHolder dagHolder = new DAGHolder();
    parametersRequest.complete(dagHolder);
    assertThat(dagHolder, notNullValue());
}
Also used : DAGHolder(org.codice.alliance.nsili.common.UCO.DAGHolder) 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) GetParametersRequest(org.codice.alliance.nsili.common.GIAS.GetParametersRequest) Result(ddf.catalog.data.Result) Test(org.junit.Test)

Example 3 with GetParametersRequest

use of org.codice.alliance.nsili.common.GIAS.GetParametersRequest in project alliance by codice.

the class ProductMgrImpl method get_parameters.

@Override
public GetParametersRequest get_parameters(Product prod, String[] desired_parameters, NameValue[] properties) throws ProcessingFault, InvalidInputParameter, SystemFault {
    GetParametersRequest getParamRequest = null;
    String id = UUID.randomUUID().toString();
    try {
        String productIdStr = getAccessManager().getProductId(prod);
        GetParametersRequestImpl getParametersRequest = new GetParametersRequestImpl(productIdStr, desired_parameters, catalogFramework, filterBuilder, querySources, outgoingValidationEnabled);
        _poa().activate_object_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), getParametersRequest);
        org.omg.CORBA.Object obj = _poa().create_reference_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), GetParametersRequestHelper.id());
        getParamRequest = GetParametersRequestHelper.narrow(obj);
    } catch (WrongAdapter | WrongPolicy | UnsupportedEncodingException e) {
        LOGGER.debug("Unable to get ID from product reference: {}", NsilCorbaExceptionUtil.getExceptionDetails(e), e);
    } catch (ServantAlreadyActive | ObjectAlreadyActive e) {
        LOGGER.debug("get_parameters : Unable to activate getParametersRequest object. {}", NsilCorbaExceptionUtil.getExceptionDetails(e), e);
    }
    return getParamRequest;
}
Also used : ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) UnsupportedEncodingException(java.io.UnsupportedEncodingException) GetParametersRequestImpl(org.codice.alliance.nsili.endpoint.requests.GetParametersRequestImpl) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) WrongAdapter(org.omg.PortableServer.POAPackage.WrongAdapter) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive) GetParametersRequest(org.codice.alliance.nsili.common.GIAS.GetParametersRequest)

Example 4 with GetParametersRequest

use of org.codice.alliance.nsili.common.GIAS.GetParametersRequest in project alliance by codice.

the class SampleNsiliClient method getParameters.

public DAG getParameters(Product product) throws InvalidInputParameter, SystemFault, ProcessingFault {
    if (productMgr != null) {
        LOGGER.info("Sending Get Parameters Request...");
        // CORE, ALL, ORDER
        String[] desiredParameters = new String[] { "CORE", "ALL", "ORDER" };
        NameValue[] properties = new NameValue[0];
        GetParametersRequest getParametersRequest = productMgr.get_parameters(product, desiredParameters, properties);
        getParametersRequest.set_user_info(ALLIANCE);
        DAGHolder dagHolder = new DAGHolder();
        getParametersRequest.complete(dagHolder);
        LOGGER.info("Resulting Parameters From Server :");
        DAG dag = dagHolder.value;
        printDagAttributes(dag);
        return dag;
    } else {
        LOGGER.warn("ProductMgr is not initialized, unable to get parameters");
    }
    return null;
}
Also used : NameValue(org.codice.alliance.nsili.common.UCO.NameValue) DAGHolder(org.codice.alliance.nsili.common.UCO.DAGHolder) DAG(org.codice.alliance.nsili.common.UCO.DAG) GetParametersRequest(org.codice.alliance.nsili.common.GIAS.GetParametersRequest)

Example 5 with GetParametersRequest

use of org.codice.alliance.nsili.common.GIAS.GetParametersRequest in project alliance by codice.

the class ProductMgrImpl method get_parameters.

@Override
public GetParametersRequest get_parameters(Product prod, String[] desired_parameters, NameValue[] properties) throws ProcessingFault, InvalidInputParameter, SystemFault {
    GetParametersRequestImpl getParametersRequest = new GetParametersRequestImpl();
    try {
        _poa().activate_object_with_id("get_parameters".getBytes(Charset.forName(ENCODING)), getParametersRequest);
    } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy e) {
        LOGGER.warn("get_parameters : Unable to activate getParametersRequest object.", e);
    }
    org.omg.CORBA.Object obj = _poa().create_reference_with_id("get_parameters".getBytes(Charset.forName(ENCODING)), GetParametersRequestHelper.id());
    GetParametersRequest queryRequest = GetParametersRequestHelper.narrow(obj);
    return queryRequest;
}
Also used : WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive) GetParametersRequestImpl(org.codice.alliance.nsili.mockserver.impl.requests.GetParametersRequestImpl) GetParametersRequest(org.codice.alliance.nsili.common.GIAS.GetParametersRequest)

Aggregations

GetParametersRequest (org.codice.alliance.nsili.common.GIAS.GetParametersRequest)5 DAG (org.codice.alliance.nsili.common.UCO.DAG)3 DAGHolder (org.codice.alliance.nsili.common.UCO.DAGHolder)3 Result (ddf.catalog.data.Result)2 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)2 ResultImpl (ddf.catalog.data.impl.ResultImpl)2 Product (org.codice.alliance.nsili.common.UID.Product)2 Test (org.junit.Test)2 ObjectAlreadyActive (org.omg.PortableServer.POAPackage.ObjectAlreadyActive)2 ServantAlreadyActive (org.omg.PortableServer.POAPackage.ServantAlreadyActive)2 WrongPolicy (org.omg.PortableServer.POAPackage.WrongPolicy)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 NameValue (org.codice.alliance.nsili.common.UCO.NameValue)1 GetParametersRequestImpl (org.codice.alliance.nsili.endpoint.requests.GetParametersRequestImpl)1 GetParametersRequestImpl (org.codice.alliance.nsili.mockserver.impl.requests.GetParametersRequestImpl)1 WrongAdapter (org.omg.PortableServer.POAPackage.WrongAdapter)1