Search in sources :

Example 1 with FileLocation

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

the class SampleNsiliClient method createFileOrder.

private OrderContents createFileOrder(Product product, String[] supportedPackagingSpecs, String filename) throws Exception {
    NameName[] nameName = { new NameName("", "") };
    String orderPackageId = UUID.randomUUID().toString();
    TailoringSpec tailoringSpec = new TailoringSpec(nameName);
    PackagingSpec pSpec = new PackagingSpec(orderPackageId, supportedPackagingSpecs[0]);
    Calendar cal = Calendar.getInstance();
    cal.setTime(new java.util.Date());
    int year = cal.get(Calendar.YEAR);
    year++;
    AbsTime needByDate = new AbsTime(new Date((short) year, (short) 2, (short) 10), new Time((short) 10, (short) 0, (short) 0));
    MediaType[] mTypes = { new MediaType("", (short) 1) };
    String[] benums = new String[0];
    Rectangle region = new Rectangle(new Coordinate2d(1.1, 1.1), new Coordinate2d(2.2, 2.2));
    ImageSpec imageSpec = new ImageSpec();
    imageSpec.encoding = SupportDataEncoding.ASCII;
    imageSpec.rrds = new short[] { 1 };
    imageSpec.algo = "";
    imageSpec.bpp = 0;
    imageSpec.comp = "A";
    imageSpec.imgform = "A";
    imageSpec.imageid = "1234abc";
    imageSpec.geo_region_type = GeoRegionType.LAT_LON;
    Rectangle subSection = new Rectangle();
    subSection.lower_right = new Coordinate2d(0, 0);
    subSection.upper_left = new Coordinate2d(1, 1);
    imageSpec.sub_section = subSection;
    Any imageSpecAny = orb.create_any();
    ImageSpecHelper.insert(imageSpecAny, imageSpec);
    AlterationSpec aSpec = new AlterationSpec("JPEG", imageSpecAny, region, GeoRegionType.NULL_REGION);
    FileLocation fileLocation = new FileLocation("user", "pass", "localhost", "/nsili/file", filename);
    Destination destination = new Destination();
    destination.f_dest(fileLocation);
    ProductDetails[] productDetails = { new ProductDetails(mTypes, benums, aSpec, product, ALLIANCE) };
    DeliveryDetails[] deliveryDetails = { new DeliveryDetails(destination, "", "") };
    return new OrderContents(ALLIANCE, tailoringSpec, pSpec, needByDate, "Give me an order!", (short) 1, productDetails, deliveryDetails);
}
Also used : Destination(org.codice.alliance.nsili.common.GIAS.Destination) DeliveryDetails(org.codice.alliance.nsili.common.GIAS.DeliveryDetails) Rectangle(org.codice.alliance.nsili.common.UCO.Rectangle) Time(org.codice.alliance.nsili.common.UCO.Time) AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) ImageSpec(org.codice.alliance.nsili.common.GIAS.ImageSpec) Any(org.omg.CORBA.Any) AlterationSpec(org.codice.alliance.nsili.common.GIAS.AlterationSpec) AbsTime(org.codice.alliance.nsili.common.UCO.AbsTime) Coordinate2d(org.codice.alliance.nsili.common.UCO.Coordinate2d) ProductDetails(org.codice.alliance.nsili.common.GIAS.ProductDetails) MediaType(org.codice.alliance.nsili.common.GIAS.MediaType) NameName(org.codice.alliance.nsili.common.UCO.NameName) PackagingSpec(org.codice.alliance.nsili.common.GIAS.PackagingSpec) Calendar(java.util.Calendar) Date(org.codice.alliance.nsili.common.UCO.Date) TailoringSpec(org.codice.alliance.nsili.common.GIAS.TailoringSpec) OrderContents(org.codice.alliance.nsili.common.GIAS.OrderContents) FileLocation(org.codice.alliance.nsili.common.UCO.FileLocation)

Example 2 with FileLocation

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

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

the class ProductMgrImplTest method testGetRelatedFilesWithBadPort.

@Test
public void testGetRelatedFilesWithBadPort() 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("NOPE");
    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 4 with FileLocation

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

the class OrderRequestImplTest method getTestDestination.

private Destination getTestDestination() {
    Destination destination = new Destination();
    FileLocation location = new FileLocation();
    location.host_name = "localhost";
    location.user_name = "user";
    location.password = "password";
    location.file_name = "test_file";
    location.path_name = "/images";
    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 5 with FileLocation

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

the class GetRelatedFilesRequestImplTest method testNoHostLocation.

@Test
public void testNoHostLocation() throws Exception {
    FileLocation fileLocation = getTestFileLocation();
    fileLocation.host_name = "";
    NameListHolder locations = new NameListHolder();
    GetRelatedFilesRequestImpl noPortRequest = new GetRelatedFilesRequestImpl(getTestMetacards(), fileLocation, "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) FileLocation(org.codice.alliance.nsili.common.UCO.FileLocation) NameListHolder(org.codice.alliance.nsili.common.UCO.NameListHolder) Test(org.junit.Test)

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