Search in sources :

Example 81 with Data

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());
}
Also used : RequestData(com.microsoft.applicationinsights.smoketest.schemav2.RequestData) RemoteDependencyData(com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope) Test(org.junit.Test)

Example 82 with Data

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);
}
Also used : DomainMetadataType(org.geotoolkit.ows.xml.v200.DomainMetadataType) DataOutput(org.geotoolkit.wps.xml.v200.DataOutput) LiteralValue(org.geotoolkit.wps.xml.v200.LiteralValue) Data(org.geotoolkit.wps.xml.v200.Data) LiteralDataDomain(org.geotoolkit.wps.xml.v200.LiteralDataDomain) Test(org.junit.Test)

Example 83 with Data

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));
}
Also used : BoundingBoxType(org.geotoolkit.ows.xml.v200.BoundingBoxType) DataOutput(org.geotoolkit.wps.xml.v200.DataOutput) BoundingBoxData(org.geotoolkit.wps.xml.v200.BoundingBoxData) Data(org.geotoolkit.wps.xml.v200.Data) BoundingBoxData(org.geotoolkit.wps.xml.v200.BoundingBoxData) Envelope(org.opengis.geometry.Envelope) GeneralEnvelope(org.apache.sis.geometry.GeneralEnvelope) GeneralEnvelope(org.apache.sis.geometry.GeneralEnvelope) SupportedCRS(org.geotoolkit.wps.xml.v200.SupportedCRS) Test(org.junit.Test)

Example 84 with Data

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));
}
Also used : Path(java.nio.file.Path) DataInput(org.geotoolkit.wps.xml.v200.DataInput) Format(org.geotoolkit.wps.xml.v200.Format) Data(org.geotoolkit.wps.xml.v200.Data) URL(java.net.URL) Test(org.junit.Test)

Example 85 with Data

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);
}
Also used : GridCoverage(org.apache.sis.coverage.grid.GridCoverage) HashMap(java.util.HashMap) InputStream(java.io.InputStream) Data(org.geotoolkit.wps.xml.v200.Data) AbstractWPSConverterTest(org.geotoolkit.wps.converters.AbstractWPSConverterTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)65 Envelope (com.microsoft.applicationinsights.smoketest.schemav2.Envelope)53 RequestData (com.microsoft.applicationinsights.smoketest.schemav2.RequestData)45 Data (org.geotoolkit.wps.xml.v200.Data)42 RemoteDependencyData (com.microsoft.applicationinsights.smoketest.schemav2.RemoteDependencyData)26 UnconvertibleObjectException (org.apache.sis.util.UnconvertibleObjectException)20 IOException (java.io.IOException)16 DataInput (org.geotoolkit.wps.xml.v200.DataInput)15 Format (org.geotoolkit.wps.xml.v200.Format)12 AiSmokeTest (com.microsoft.applicationinsights.smoketest.AiSmokeTest)10 TargetUri (com.microsoft.applicationinsights.smoketest.TargetUri)10 MessageData (com.microsoft.applicationinsights.smoketest.schemav2.MessageData)10 ComplexData (org.geotoolkit.wps.xml.v200.ComplexData)10 ExceptionData (com.microsoft.applicationinsights.smoketest.schemav2.ExceptionData)9 ReferenceProxy (org.geotoolkit.wps.xml.ReferenceProxy)9 Data (com.microsoft.applicationinsights.smoketest.schemav2.Data)8 DataStoreException (org.apache.sis.storage.DataStoreException)8 LiteralValue (org.geotoolkit.wps.xml.v200.LiteralValue)7 EventData (com.microsoft.applicationinsights.smoketest.schemav2.EventData)6 MetricData (com.microsoft.applicationinsights.smoketest.schemav2.MetricData)6