Package com.springsource.insight.intercept.trace

Examples of com.springsource.insight.intercept.trace.Trace


    @Test
    public void testExchangeLocateExternalResourceName() {
        Operation op = createOperation();
        KeyValPair<String, String> props = addOperationProps(op, false, true, Boolean.FALSE);
        Trace trace = createValidTrace(op);
        assertTwoExternalResourceDescriptors(trace, props, op, true);
    }
View Full Code Here


    @Test
    public void testRoutingKeyExternalResourceName() {
        Operation op = createOperation();
        KeyValPair<String, String> props = addOperationProps(op, true, false, Boolean.FALSE);
        Trace trace = createValidTrace(op);
        assertTwoExternalResourceDescriptors(trace, props, op, false);
    }
View Full Code Here

    @Test
    public void testBothExternalResourceName() {
        Operation op = createOperation();
        KeyValPair<String, String> props = addOperationProps(op, true, true, Boolean.FALSE);
        Trace trace = createValidTrace(op);
        assertTwoExternalResourceDescriptors(trace, props, op, false);
    }
View Full Code Here

        builder.enter(dummyOp);
        builder.enter(op1);
        builder.exit();
        builder.exit();
        Frame frame = builder.exit();
        Trace trace = Trace.newInstance(ApplicationName.valueOf("app"), TraceId.valueOf("0"), frame);

        List<ExternalResourceDescriptor> externalResourceDescriptors =
                (List<ExternalResourceDescriptor>) analyzer.locateExternalResourceName(trace);
        assertEquals("Mismatched number of resources", 2, externalResourceDescriptors.size());
View Full Code Here

        super();
    }

    @Test
    public void generateMetrics() {
        Trace trace = mock(Trace.class);
        when(trace.getFirstFrameOfType(OperationType.HTTP)).thenReturn(makeHttpFrame());
        when(trace.getRange()).thenReturn(timeRange);

        List<MetricsBag> mbs = gen.generateMetrics(trace, ResourceKey.valueOf("EndPoint", "epName"));
        assertEquals(1, mbs.size());

        MetricsBag mb = mbs.get(0);
View Full Code Here

        }
    }

    @Test
    public void noHttpFrame() {
        Trace trace = mock(Trace.class);
        when(trace.getFirstFrameOfType(OperationType.HTTP)).thenReturn(null);

        assertEquals(0, gen.generateMetrics(trace, ResourceKey.valueOf("EndPoint", "epName")).size());
    }
View Full Code Here

    @Test
    public void testExtraMetricsGeneration() {
        TimeRange range = new TimeRange(7365L, 3777347L);
        String actionName = "testExtraMetricsGeneration";
        Trace trace = createMockTrace(range, actionName);
        Frame root = trace.getRootFrame();
        EndPointName ep = EndPointName.valueOf(actionName);
        ResourceKey rKey = ep.makeKey();
        Collection<MetricsBag> mbList =
                ((EclipsePersistenceMetricsGenerator) gen).addExtraEndPointMetrics(trace, rKey, Collections.singletonList(root));
        assertEquals("Mismatched metrics count", 1, ListUtil.size(mbList));

        MetricsBag mb = ListUtil.getFirstMember(mbList);
        assertEquals("Mismatched resource key", rKey, mb.getResourceKey());
        assertEquals("Mismatched time range", trace.getRange(), mb.getTimeRange());

        String baseName = ((EclipsePersistenceMetricsGenerator) gen).getBaseMetricName(actionName);
        Collection<String> keys = mb.getMetricKeys();
        Map<String, PointType> suffixes = new TreeMap<String, MetricsBag.PointType>() {
            private static final long serialVersionUID = 1L;
View Full Code Here

        }
    }

    protected final Trace createMockTrace(TimeRange range, String actionName) {
        Frame frame = createMockFrame(range, actionName);
        return new Trace(ServerName.valueOf(actionName),
                ApplicationName.valueOf("localhost", actionName),
                new Date(),
                TraceId.valueOf(actionName),
                frame);
    }
View Full Code Here

    }

    @Test
    public void testLocateExternalResourceName() {
        final String NAME = "testLocateExternalResourceName";
        Trace trace = createValidTrace(NAME);

        Collection<ExternalResourceDescriptor> externalResourceDescriptors = analyzer.locateExternalResourceName(trace);
        assertNotNull("No descriptors extracted", externalResourceDescriptors);
        assertEquals("Mismatched number of descriptors", 1, externalResourceDescriptors.size());

        ExternalResourceDescriptor descriptor = ListUtil.getFirstMember(externalResourceDescriptors);
        assertSame("Mismatched descriptor frame", trace.getRootFrame(), descriptor.getFrame());
        assertDescriptorContents("testLocateExternalResourceName", NAME, descriptor);
    }
View Full Code Here

        super();
    }

    @Test
    public void testLocateEndPoint() {
        Trace trace = createServletEndPointTrace();
        EndPointAnalysis analysis = analyzer.locateEndPoint(trace);
        assertEquals("Mismatched label", "Servlet: My stuff / servlet", analysis.getResourceLabel());
        assertEquals("Mismatched end point", EndPointName.valueOf("My stuff _ servlet"), analysis.getEndPointName());
        assertEquals("Mismatched example", "GET /path?fuu=bar", analysis.getExample());
    }
View Full Code Here

TOP

Related Classes of com.springsource.insight.intercept.trace.Trace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.