Search in sources :

Example 1 with Domain

use of com.microsoft.applicationinsights.smoketest.schemav2.Domain in project ApplicationInsights-Java by microsoft.

the class CoreAndFilterTests method testHttpRequest.

@Test
@TargetUri("/trackHttpRequest")
public void testHttpRequest() throws Exception {
    mockedIngestion.waitForItems("RequestData", 5);
    int totalItems = mockedIngestion.getItemCount();
    int expectedItems = 5;
    assertEquals(String.format("There were %d extra telemetry items received.", totalItems - expectedItems), expectedItems, totalItems);
    // TODO get HttpRequest data envelope and verify value
    List<Domain> requests = mockedIngestion.getTelemetryDataByType("RequestData");
    // true
    assertThat(requests, hasItem(allOf(hasName("HttpRequestDataTest"), hasResponseCode("200"), hasDuration(new Duration(4711)), hasSuccess(true))));
    assertThat(requests, hasItem(allOf(hasName("PingTest"), hasResponseCode("200"), hasDuration(new Duration(1)), hasSuccess(true), hasUrl("http://tempuri.org/ping"))));
    // false
    assertThat(requests, hasItem(allOf(hasName("FailedHttpRequest"), hasResponseCode("404"), hasDuration(new Duration(6666)), hasSuccess(false))));
    assertThat(requests, hasItem(allOf(hasName("FailedHttpRequest2"), hasResponseCode("505"), hasDuration(new Duration(8888)), hasSuccess(false), hasUrl("https://www.bingasdasdasdasda.com/"))));
}
Also used : RequestDataMatchers.hasDuration(com.microsoft.applicationinsights.smoketest.matchers.RequestDataMatchers.hasDuration) Duration(com.microsoft.applicationinsights.smoketest.telemetry.Duration) Domain(com.microsoft.applicationinsights.smoketest.schemav2.Domain) DataPoint(com.microsoft.applicationinsights.smoketest.schemav2.DataPoint) Test(org.junit.Test)

Example 2 with Domain

use of com.microsoft.applicationinsights.smoketest.schemav2.Domain in project ApplicationInsights-Java by microsoft.

the class MockedAppInsightsIngestionServer method getTelemetryDataByType.

private <T extends Domain> List<T> getTelemetryDataByType(String type, boolean inRequestOnly) {
    Objects.requireNonNull(type, "type");
    List<Envelope> items = getItemsEnvelopeDataType(type);
    List<T> dataItems = new ArrayList<>();
    for (Envelope e : items) {
        if (!inRequestOnly || e.getTags().containsKey("ai.operation.id")) {
            Data<T> dt = (Data<T>) e.getData();
            dataItems.add(dt.getBaseData());
        }
    }
    return dataItems;
}
Also used : ArrayList(java.util.ArrayList) MessageData(com.microsoft.applicationinsights.smoketest.schemav2.MessageData) Data(com.microsoft.applicationinsights.smoketest.schemav2.Data) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope)

Example 3 with Domain

use of com.microsoft.applicationinsights.smoketest.schemav2.Domain in project ApplicationInsights-Java by microsoft.

the class MockedAppInsightsIngestionServer method getMessageDataInRequest.

public <T extends Domain> List<T> getMessageDataInRequest() {
    List<Envelope> items = getItemsEnvelopeDataType("MessageData");
    List<T> dataItems = new ArrayList<>();
    for (Envelope e : items) {
        String message = ((MessageData) ((Data<?>) e.getData()).getBaseData()).getMessage();
        if (e.getTags().containsKey("ai.operation.id") && !ignoreMessageData(message)) {
            Data<T> dt = (Data<T>) e.getData();
            dataItems.add(dt.getBaseData());
        }
    }
    return dataItems;
}
Also used : MessageData(com.microsoft.applicationinsights.smoketest.schemav2.MessageData) ArrayList(java.util.ArrayList) MessageData(com.microsoft.applicationinsights.smoketest.schemav2.MessageData) Data(com.microsoft.applicationinsights.smoketest.schemav2.Data) Envelope(com.microsoft.applicationinsights.smoketest.schemav2.Envelope)

Example 4 with Domain

use of com.microsoft.applicationinsights.smoketest.schemav2.Domain in project camel by apache.

the class DomainProducer method doCreate.

private void doCreate(Exchange exchange) {
    final Domain in = messageToDomain(exchange.getIn());
    final Domain out = osV3Client.identity().domains().create(in);
    exchange.getIn().setBody(out);
}
Also used : Domain(org.openstack4j.model.identity.v3.Domain)

Example 5 with Domain

use of com.microsoft.applicationinsights.smoketest.schemav2.Domain in project camel by apache.

the class DomainProducer method messageToDomain.

private Domain messageToDomain(Message message) {
    Domain domain = message.getBody(Domain.class);
    if (domain == null) {
        Map headers = message.getHeaders();
        DomainBuilder builder = Builders.domain();
        ObjectHelper.notEmpty(message.getHeader(OpenstackConstants.NAME, String.class), "Name");
        builder.name(message.getHeader(OpenstackConstants.NAME, String.class));
        if (headers.containsKey(KeystoneConstants.DESCRIPTION)) {
            builder.description(message.getHeader(KeystoneConstants.DESCRIPTION, String.class));
        }
        domain = builder.build();
    }
    return domain;
}
Also used : DomainBuilder(org.openstack4j.model.identity.v3.builder.DomainBuilder) Domain(org.openstack4j.model.identity.v3.Domain) Map(java.util.Map)

Aggregations

Domain (oracle.kubernetes.weblogic.domain.v1.Domain)33 Type (java.lang.reflect.Type)14 Domain (org.openstack4j.model.identity.v3.Domain)10 ProgressRequestBody (io.kubernetes.client.ProgressRequestBody)7 ProgressResponseBody (io.kubernetes.client.ProgressResponseBody)7 DomainSpec (oracle.kubernetes.weblogic.domain.v1.DomainSpec)7 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)5 V1ObjectMeta (io.kubernetes.client.models.V1ObjectMeta)4 Map (java.util.Map)4 ApiException (io.kubernetes.client.ApiException)3 V1Service (io.kubernetes.client.models.V1Service)3 HashMap (java.util.HashMap)3 CallBuilderFactory (oracle.kubernetes.operator.helpers.CallBuilderFactory)3 Packet (oracle.kubernetes.operator.work.Packet)3 HttpUserAgentTest (com.meterware.pseudoserver.HttpUserAgentTest)2 Data (com.microsoft.applicationinsights.smoketest.schemav2.Data)2 Envelope (com.microsoft.applicationinsights.smoketest.schemav2.Envelope)2 MessageData (com.microsoft.applicationinsights.smoketest.schemav2.MessageData)2 V1ConfigMap (io.kubernetes.client.models.V1ConfigMap)2