use of org.codice.alliance.nsili.common.GIAS.DeliveryDetails 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);
}
use of org.codice.alliance.nsili.common.GIAS.DeliveryDetails in project alliance by codice.
the class OrderRequestImplTest method getUncompressedTestOrder.
private OrderContents getUncompressedTestOrder() {
OrderContents order = new OrderContents();
PackagingSpec packagingSpec = new PackagingSpec();
packagingSpec.package_identifier = "pkg1234";
packagingSpec.packaging_format_and_compression = PackagingSpecFormatType.FILESUNC.name();
order.pSpec = packagingSpec;
ProductDetails productDetail = new ProductDetails();
productDetail.aProduct = mockProduct1;
order.prod_list = new ProductDetails[] { productDetail };
DeliveryDetails deliveryDetail = new DeliveryDetails();
deliveryDetail.dests = getTestDestination();
order.del_list = new DeliveryDetails[] { deliveryDetail };
return order;
}
use of org.codice.alliance.nsili.common.GIAS.DeliveryDetails in project alliance by codice.
the class OrderRequestImplTest method testUnsetDestName.
@Test
public void testUnsetDestName() throws SystemFault, ProcessingFault {
OrderContents order = getUncompressedTestOrder();
order.pSpec.package_identifier = null;
DeliveryDetails deliveryDetail = new DeliveryDetails();
deliveryDetail.dests = getBadHttpDestination();
order.del_list = new DeliveryDetails[] { deliveryDetail };
OrderRequestImpl orderRequest = new OrderRequestImpl(order, accessManager, mockCatalogFramework, destination -> Optional.of(mock(DestinationSink.class)));
DeliveryManifestHolder holder = new DeliveryManifestHolder();
orderRequest.complete(holder);
assertThat(holder.value, notNullValue());
assertThat(holder.value.elements[0].files.length, is(1));
}
use of org.codice.alliance.nsili.common.GIAS.DeliveryDetails in project alliance by codice.
the class OrderRequestImplTest method testSupportedEmailDelivery.
@Test
public void testSupportedEmailDelivery() throws SystemFault, ProcessingFault {
OrderContents order = getUncompressedTestOrder();
DeliveryDetails deliveryDetail = new DeliveryDetails();
deliveryDetail.dests = getGoodEmailDestination();
order.del_list = new DeliveryDetails[] { deliveryDetail };
OrderRequestImpl orderRequest = new OrderRequestImpl(order, accessManager, mockCatalogFramework, destination -> Optional.of(mock(DestinationSink.class)));
DeliveryManifestHolder holder = new DeliveryManifestHolder();
orderRequest.complete(holder);
}
use of org.codice.alliance.nsili.common.GIAS.DeliveryDetails in project alliance by codice.
the class OrderRequestImplTest method getMultipleUncompressedTestOrder.
private OrderContents getMultipleUncompressedTestOrder() {
OrderContents order = new OrderContents();
PackagingSpec packagingSpec = new PackagingSpec();
packagingSpec.package_identifier = "pkg1234";
packagingSpec.packaging_format_and_compression = PackagingSpecFormatType.FILESUNC.name();
order.pSpec = packagingSpec;
ProductDetails productDetail1 = new ProductDetails();
productDetail1.aProduct = mockProduct1;
ProductDetails productDetail2 = new ProductDetails();
productDetail2.aProduct = mockProduct2;
order.prod_list = new ProductDetails[] { productDetail1, productDetail2 };
DeliveryDetails deliveryDetail = new DeliveryDetails();
deliveryDetail.dests = getTestDestination();
order.del_list = new DeliveryDetails[] { deliveryDetail };
return order;
}
Aggregations