Search in sources :

Example 1 with GetRelatedFilesRequestImpl

use of org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl in project alliance by codice.

the class GetRelatedFilesRequestImplTest method testCompleteNoPort.

@Test
public void testCompleteNoPort() throws Exception {
    NameListHolder locations = new NameListHolder();
    GetRelatedFilesRequestImpl noPortRequest = new GetRelatedFilesRequestImpl(getTestMetacards(), getTestFileLocation(), "THUMBNAIL", null);
    noPortRequest.setHttpClient(mockHttpClient);
    State state = noPortRequest.complete(locations);
    assertValidState(state, locations);
}
Also used : GetRelatedFilesRequestImpl(org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl) State(org.codice.alliance.nsili.common.UCO.State) NameListHolder(org.codice.alliance.nsili.common.UCO.NameListHolder) Test(org.junit.Test)

Example 2 with GetRelatedFilesRequestImpl

use of org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl in project alliance by codice.

the class GetRelatedFilesRequestImplTest method setUp.

@Before
public void setUp() throws Exception {
    List<Metacard> testMetacards = getTestMetacards();
    FileLocation location = getTestFileLocation();
    relatedFilesRequest = new GetRelatedFilesRequestImpl(testMetacards, location, "THUMBNAIL", TEST_PORT);
    relatedFilesRequest.setHttpClient(mockHttpClient);
    setupMocks();
}
Also used : Metacard(ddf.catalog.data.Metacard) GetRelatedFilesRequestImpl(org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl) FileLocation(org.codice.alliance.nsili.common.UCO.FileLocation) Before(org.junit.Before)

Example 3 with GetRelatedFilesRequestImpl

use of org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl in project alliance by codice.

the class GetRelatedFilesRequestImplTest method testNotThumbnailType.

@Test
public void testNotThumbnailType() throws Exception {
    NameListHolder locations = new NameListHolder();
    GetRelatedFilesRequestImpl noPortRequest = new GetRelatedFilesRequestImpl(getBadMetacards(), getTestFileLocation(), "OVERVIEW", null);
    noPortRequest.setHttpClient(mockHttpClient);
    State state = noPortRequest.complete(locations);
    assertValidStateNoLocs(state, locations);
}
Also used : GetRelatedFilesRequestImpl(org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl) State(org.codice.alliance.nsili.common.UCO.State) NameListHolder(org.codice.alliance.nsili.common.UCO.NameListHolder) Test(org.junit.Test)

Example 4 with GetRelatedFilesRequestImpl

use of org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl in project alliance by codice.

the class ProductMgrImpl method get_related_files.

@Override
public GetRelatedFilesRequest get_related_files(Product[] products, FileLocation location, String type, NameValue[] properties) throws ProcessingFault, InvalidInputParameter, SystemFault {
    String id = UUID.randomUUID().toString();
    try {
        List<Metacard> metacards = new ArrayList<>();
        AccessManagerImpl accessMgr = getAccessManager();
        for (Product product : products) {
            Metacard metacard = accessMgr.getMetacard(accessMgr.getProductId(product));
            if (metacard != null) {
                metacards.add(metacard);
            }
        }
        Integer port = getPort(properties);
        GetRelatedFilesRequestImpl getRelatedFilesRequest = new GetRelatedFilesRequestImpl(metacards, location, type, port);
        _poa().activate_object_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), getRelatedFilesRequest);
    } catch (ServantAlreadyActive | ObjectAlreadyActive | WrongPolicy | WrongAdapter | UnsupportedEncodingException e) {
        LOGGER.debug("get_related_files : Unable to activate getRelatedFilesRequest object.", e);
    }
    org.omg.CORBA.Object obj = _poa().create_reference_with_id(id.getBytes(Charset.forName(NsiliEndpoint.ENCODING)), GetRelatedFilesRequestHelper.id());
    GetRelatedFilesRequest queryRequest = GetRelatedFilesRequestHelper.narrow(obj);
    return queryRequest;
}
Also used : GetRelatedFilesRequestImpl(org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl) ObjectAlreadyActive(org.omg.PortableServer.POAPackage.ObjectAlreadyActive) ArrayList(java.util.ArrayList) Product(org.codice.alliance.nsili.common.UID.Product) UnsupportedEncodingException(java.io.UnsupportedEncodingException) WrongPolicy(org.omg.PortableServer.POAPackage.WrongPolicy) Metacard(ddf.catalog.data.Metacard) WrongAdapter(org.omg.PortableServer.POAPackage.WrongAdapter) GetRelatedFilesRequest(org.codice.alliance.nsili.common.GIAS.GetRelatedFilesRequest) ServantAlreadyActive(org.omg.PortableServer.POAPackage.ServantAlreadyActive)

Example 5 with GetRelatedFilesRequestImpl

use of org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl 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);
}
Also used : GetRelatedFilesRequestImpl(org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl) State(org.codice.alliance.nsili.common.UCO.State) NameListHolder(org.codice.alliance.nsili.common.UCO.NameListHolder) Test(org.junit.Test)

Aggregations

GetRelatedFilesRequestImpl (org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl)6 NameListHolder (org.codice.alliance.nsili.common.UCO.NameListHolder)4 State (org.codice.alliance.nsili.common.UCO.State)4 Test (org.junit.Test)4 Metacard (ddf.catalog.data.Metacard)2 FileLocation (org.codice.alliance.nsili.common.UCO.FileLocation)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 ArrayList (java.util.ArrayList)1 GetRelatedFilesRequest (org.codice.alliance.nsili.common.GIAS.GetRelatedFilesRequest)1 Product (org.codice.alliance.nsili.common.UID.Product)1 Before (org.junit.Before)1 ObjectAlreadyActive (org.omg.PortableServer.POAPackage.ObjectAlreadyActive)1 ServantAlreadyActive (org.omg.PortableServer.POAPackage.ServantAlreadyActive)1 WrongAdapter (org.omg.PortableServer.POAPackage.WrongAdapter)1 WrongPolicy (org.omg.PortableServer.POAPackage.WrongPolicy)1