use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project ApplicationInsights-Java by microsoft.
the class SpringBootAutoTest method spawnAnotherJavaProcess.
@Test
@TargetUri("/spawn-another-java-process")
public void spawnAnotherJavaProcess() throws Exception {
List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
List<Envelope> rddList = mockedIngestion.waitForItems("RemoteDependencyData", 1);
Envelope rdEnvelope = rdList.get(0);
Envelope rddEnvelope = rddList.get(0);
RequestData rd = (RequestData) ((Data<?>) rdEnvelope.getData()).getBaseData();
RemoteDependencyData rdd = (RemoteDependencyData) ((Data<?>) rddEnvelope.getData()).getBaseData();
assertTrue(rd.getProperties().isEmpty());
assertTrue(rd.getSuccess());
assertEquals("GET /search", rdd.getName());
assertEquals("Http", rdd.getType());
assertEquals("www.bing.com", rdd.getTarget());
assertEquals("https://www.bing.com/search?q=test", rdd.getData());
assertTrue(rdd.getProperties().isEmpty());
assertTrue(rdd.getSuccess());
}
use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project geotoolkit by Geomatys.
the class LiteralAdaptorTest method doubleWPS2.
@Test
public void doubleWPS2() {
final DomainMetadataType metaType = new DomainMetadataType(null, "xs:double");
final LiteralDataDomain domain = new LiteralDataDomain();
domain.setDataType(metaType);
final LiteralAdaptor adaptor = LiteralAdaptor.create(domain);
assertEquals(Double.class, adaptor.getValueClass());
final DataOutput output = new DataOutput();
final LiteralValue lit = new LiteralValue();
lit.setValue("3.14");
final Data data = new Data(lit);
output.setData(data);
final Object result = adaptor.fromWPS2Input(output);
assertEquals(3.14, (Double) result, DELTA);
}
use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project geotoolkit by Geomatys.
the class BboxAdaptorTest method supportedCrsWPS2.
@Test
public void supportedCrsWPS2() throws FactoryException {
final BoundingBoxData bboxDataType = new BoundingBoxData();
final SupportedCRS scrs = new SupportedCRS("ESPG:4326");
bboxDataType.getSupportedCRS().add(scrs);
final BboxAdaptor adaptor = BboxAdaptor.create(bboxDataType);
assertEquals(Envelope.class, adaptor.getValueClass());
final BoundingBoxType litValue = new BoundingBoxType("EPSG:4326", -180, -90, +180, +90);
final DataOutput output = new DataOutput();
final Data data = new Data(litValue);
output.setData(data);
final Envelope result = adaptor.fromWPS2Input(output);
final GeneralEnvelope env = new GeneralEnvelope(CRS.forCode("EPSG:4326"));
env.setRange(0, -180, +180);
env.setRange(1, -90, +90);
assertEquals(env, new GeneralEnvelope(result));
}
use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project geotoolkit by Geomatys.
the class KMLAdaptorTest method kmlCdataWPS2.
@Test
public void kmlCdataWPS2() throws Exception {
final Format format = new Format(null, "application/vnd.google-earth.kml+xml", null, null);
final ComplexAdaptor adaptor = ComplexAdaptor.getAdaptor(format);
assertEquals(Path.class, adaptor.getValueClass());
final URL kmlResource = KMLAdaptorTest.class.getResource(BRUT_KML_LOCATION);
final Path kmlPath = Paths.get(kmlResource.toURI());
final DataInput out = adaptor.toWPS2Input(kmlPath);
assertNotNull("KML adaptor has not returned any result", out);
final Data data = out.getData();
assertNotNull("Generated data input does not contain any data markup", data);
final List<Object> dc = data.getContent();
assertTrue("Generated content should contain exactly one element", dc != null && dc.size() == 1);
final byte[] brutFileContent = Files.readAllBytes(kmlPath);
final String brutExpectedKml = new String(brutFileContent, StandardCharsets.UTF_8);
assertEquals("Written content is unexpected", "<![CDATA[" + brutExpectedKml + "]]>", dc.get(0));
}
use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project geotoolkit by Geomatys.
the class CoverageToComplexConverterTest method testConversion.
@Test
@org.junit.Ignore("Fails randomly because of GeoTIFF reader not found.")
public void testConversion() throws UnconvertibleObjectException, IOException {
final WPSObjectConverter<GridCoverage, Data> converter = WPSConverterRegistry.getInstance().getConverter(GridCoverage.class, Data.class);
final GridCoverage coverage = ConvertersTestUtils.makeCoverage();
final Map<String, Object> param = new HashMap<String, Object>();
param.put(WPSObjectConverter.MIME, WPSMimeType.IMG_GEOTIFF.val());
param.put(WPSObjectConverter.ENCODING, "base64");
final Data complex = converter.convert(coverage, param);
final List<Object> content = complex.getContent();
final String encodedCvg = (String) content.get(0);
final InputStream expectedStream = RenderedImageToComplexConverterTest.class.getResourceAsStream("/expected/coverage_base64");
assertNotNull(expectedStream);
String expectedString = IOUtilities.toString(expectedStream);
expectedString = expectedString.trim();
assertEquals(expectedString, encodedCvg);
}
Aggregations