Search in sources :

Example 6 with FileLocation

use of org.codice.alliance.nsili.common.UCO.FileLocation 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 7 with FileLocation

use of org.codice.alliance.nsili.common.UCO.FileLocation 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)

Example 8 with FileLocation

use of org.codice.alliance.nsili.common.UCO.FileLocation in project alliance by codice.

the class OrderRequestImplTest method getBadHttpDestination.

private Destination getBadHttpDestination() {
    Destination destination = new Destination();
    FileLocation location = new FileLocation();
    location.host_name = "localhost";
    location.user_name = "user";
    location.password = "password";
    location.path_name = "/images";
    location.file_name = "";
    destination.f_dest(location);
    return destination;
}
Also used : Destination(org.codice.alliance.nsili.common.GIAS.Destination) FileLocation(org.codice.alliance.nsili.common.UCO.FileLocation)

Example 9 with FileLocation

use of org.codice.alliance.nsili.common.UCO.FileLocation 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;
    }
}
Also used : NameValue(org.codice.alliance.nsili.common.UCO.NameValue) FileLocation(org.codice.alliance.nsili.common.UCO.FileLocation) GetRelatedFilesRequest(org.codice.alliance.nsili.common.GIAS.GetRelatedFilesRequest) Product(org.codice.alliance.nsili.common.UID.Product) Any(org.omg.CORBA.Any) NameListHolder(org.codice.alliance.nsili.common.UCO.NameListHolder)

Aggregations

FileLocation (org.codice.alliance.nsili.common.UCO.FileLocation)9 GetRelatedFilesRequest (org.codice.alliance.nsili.common.GIAS.GetRelatedFilesRequest)4 NameValue (org.codice.alliance.nsili.common.UCO.NameValue)4 Product (org.codice.alliance.nsili.common.UID.Product)4 Test (org.junit.Test)4 Any (org.omg.CORBA.Any)4 Result (ddf.catalog.data.Result)3 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)3 ResultImpl (ddf.catalog.data.impl.ResultImpl)3 Destination (org.codice.alliance.nsili.common.GIAS.Destination)3 DAG (org.codice.alliance.nsili.common.UCO.DAG)3 NameListHolder (org.codice.alliance.nsili.common.UCO.NameListHolder)2 GetRelatedFilesRequestImpl (org.codice.alliance.nsili.endpoint.requests.GetRelatedFilesRequestImpl)2 Metacard (ddf.catalog.data.Metacard)1 Calendar (java.util.Calendar)1 AlterationSpec (org.codice.alliance.nsili.common.GIAS.AlterationSpec)1 DeliveryDetails (org.codice.alliance.nsili.common.GIAS.DeliveryDetails)1 ImageSpec (org.codice.alliance.nsili.common.GIAS.ImageSpec)1 MediaType (org.codice.alliance.nsili.common.GIAS.MediaType)1 OrderContents (org.codice.alliance.nsili.common.GIAS.OrderContents)1