use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project geotoolkit by Geomatys.
the class ExecuteTest method testRequestAndMarshall.
@Test
public void testRequestAndMarshall() throws Exception {
final WebProcessingClient client = new WebProcessingClient(new URL("http://test.com"), null, WPSVersion.v100);
final ExecuteRequest request = client.createExecute();
final Execute execute = request.getContent();
final GeographicCRS epsg4326 = CommonCRS.WGS84.geographic();
final GeneralEnvelope env = new GeneralEnvelope(epsg4326);
env.setRange(0, 10, 10);
env.setRange(1, 10, 10);
execute.setIdentifier("identifier");
final List<DataInput> inputs = execute.getInput();
inputs.add(new DataInput("literal", new Data(new LiteralValue("10", null, null))));
inputs.add(new DataInput("bbox", new Data(new BoundingBoxType(env))));
inputs.add(new DataInput("complex", new Data(new Format("UTF-8", WPSMimeType.APP_GML.val(), WPSSchema.OGC_GML_3_1_1.getValue(), null), new PointType(new DirectPosition2D(epsg4326, 0, 0)))));
inputs.add(new DataInput("reference", new Reference("http://link.to/reference/", null, null)));
execute.getOutput().add(new OutputDefinition("output", false));
assertEquals("WPS", execute.getService());
assertEquals("1.0.0", execute.getVersion().toString());
assertEquals(execute.getIdentifier().getValue(), "identifier");
final StringWriter stringWriter = new StringWriter();
final Marshaller marshaller = WPSMarshallerPool.getInstance().acquireMarshaller();
marshaller.marshal(execute, stringWriter);
String result = stringWriter.toString();
try (final InputStream expected = expectedRequest()) {
assertXmlEquals(expected, result, "xmlns:*", "crs", "srsName");
}
WPSMarshallerPool.getInstance().recycle(marshaller);
}
use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project ApplicationInsights-Java by microsoft.
the class AiSmokeTest method getTelemetry.
protected static Telemetry getTelemetry(int rddCount, Predicate<RemoteDependencyData> condition) throws Exception {
if (rddCount > 3) {
throw new IllegalArgumentException("this method currently only supports rddCount up to 3");
}
Telemetry telemetry = new Telemetry();
List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
telemetry.rdEnvelope = rdList.get(0);
telemetry.rd = (RequestData) ((Data<?>) telemetry.rdEnvelope.getData()).getBaseData();
assertEquals(0, mockedIngestion.getCountForType("EventData"));
if (rddCount == 0) {
return telemetry;
}
String operationId = telemetry.rdEnvelope.getTags().get("ai.operation.id");
List<Envelope> rddList = mockedIngestion.waitForItemsInOperation("RemoteDependencyData", rddCount, operationId, envelope -> {
RemoteDependencyData rdd = (RemoteDependencyData) ((Data<?>) envelope.getData()).getBaseData();
return condition.test(rdd);
});
telemetry.rddEnvelope1 = rddList.get(0);
telemetry.rdd1 = (RemoteDependencyData) ((Data<?>) telemetry.rddEnvelope1.getData()).getBaseData();
if (rddCount == 1) {
return telemetry;
}
telemetry.rddEnvelope2 = rddList.get(1);
telemetry.rdd2 = (RemoteDependencyData) ((Data<?>) telemetry.rddEnvelope2.getData()).getBaseData();
if (rddCount == 2) {
return telemetry;
}
telemetry.rddEnvelope3 = rddList.get(2);
telemetry.rdd3 = (RemoteDependencyData) ((Data<?>) telemetry.rddEnvelope3.getData()).getBaseData();
return telemetry;
}
use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project ApplicationInsights-Java by microsoft.
the class CustomInstrumentationTest method customInstrumentationTwo.
@Test
@TargetUri("/customInstrumentationTwo")
public void customInstrumentationTwo() throws Exception {
List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
List<Envelope> rddList = mockedIngestion.waitForItemsInRequest("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.getSuccess());
assertEquals(rdd.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject.two");
assertEquals(rdd.getType(), "OTHER");
assertEquals(rdd.getSuccess(), true);
assertParentChild(rd, rdEnvelope, rddEnvelope, "GET /CustomInstrumentation/*");
}
use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project ApplicationInsights-Java by microsoft.
the class CustomInstrumentationTest method customInstrumentationFour.
@Test
@TargetUri("/customInstrumentationFour")
public void customInstrumentationFour() throws Exception {
List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
List<Envelope> rddList = mockedIngestion.waitForItemsInRequest("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.getSuccess());
assertEquals(rdd.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject$NestedObject.four");
assertEquals(rdd.getType(), "OTHER");
assertEquals(rdd.getSuccess(), true);
assertParentChild(rd, rdEnvelope, rddEnvelope, "GET /CustomInstrumentation/*");
}
use of com.microsoft.applicationinsights.smoketest.schemav2.Data in project ApplicationInsights-Java by microsoft.
the class CustomInstrumentationTest method customInstrumentationEight.
@Test
@TargetUri("/customInstrumentationEight")
public void customInstrumentationEight() throws Exception {
List<Envelope> rdList = mockedIngestion.waitForItems("RequestData", 1);
List<Envelope> rddList = mockedIngestion.waitForItemsInRequest("RemoteDependencyData", 2);
Envelope rdEnvelope = rdList.get(0);
Envelope rddEnvelope1 = rddList.get(0);
Envelope rddEnvelope2 = rddList.get(1);
RequestData rd = (RequestData) ((Data<?>) rdEnvelope.getData()).getBaseData();
RemoteDependencyData rdd1 = (RemoteDependencyData) ((Data<?>) rddEnvelope1.getData()).getBaseData();
RemoteDependencyData rdd2 = (RemoteDependencyData) ((Data<?>) rddEnvelope2.getData()).getBaseData();
assertTrue(rd.getSuccess());
assertEquals(rdd1.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject.eight");
assertEquals(rdd1.getType(), "OTHER");
assertEquals(rdd1.getSuccess(), true);
assertParentChild(rd, rdEnvelope, rddEnvelope1, "GET /CustomInstrumentation/*");
assertEquals(rdd2.getName(), "com/microsoft/applicationinsights/smoketestapp/TargetObject.eight");
assertEquals(rdd2.getType(), "OTHER");
assertEquals(rdd2.getSuccess(), true);
assertParentChild(rd, rdEnvelope, rddEnvelope2, "GET /CustomInstrumentation/*");
}
Aggregations