Package com.springsource.insight.intercept.trace

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


    }

    @Test
    public void testLocateExternalResourceName() {
        final String PATH = "/dummy/path/123";
        Trace trace = createValidTrace(PATH);

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

        ExternalResourceDescriptor descriptor = externalResourceDescriptors.get(0);
        assertSame("Mismatched descriptor frame", trace.getRootFrame(), descriptor.getFrame());
        assertDescriptorContents("testLocateExternalResourceName", PATH, descriptor);
    }
View Full Code Here


        Operation op = createJdbcOperation("jdbc:foobar://huh:8080");
        op.type(JdbcOperationExternalResourceAnalyzer.TYPE);

        Frame frame = createJdbcFrame(op);
        Trace trace = createJdbcTrace(frame);

        Collection<ExternalResourceDescriptor> resources = locateExternalResourceName(trace);

        // make sure that no query external resources were created
        assertNotNull("external resource descriptors list", resources);
        assertEquals("total external resource descriptors", 1, resources.size());

        ExternalResourceDescriptor firstDescriptor = ListUtil.getFirstMember(resources);
        ExternalResourceType type = ExternalResourceType.valueOf(firstDescriptor.getType());
        assertSame("first descriptor type", ExternalResourceType.DATABASE, type);
        assertFalse("first descriptor is a parent", firstDescriptor.isParent());

        assertTrue(trace.getAppName() + " is known", generator.isApplicationNameKnown(trace.getAppName()));
    }
View Full Code Here

        Operation op = createJdbcOperation("jdbc:foobar://huh:8080");
        op.type(JdbcOperationExternalResourceAnalyzer.TYPE);

        Frame frame = createJdbcFrame(op);
        Trace trace = createJdbcTrace(frame);

        Collection<ExternalResourceDescriptor> resources = locateExternalResourceName(trace);

        // make sure that no query external resources were created
        assertNotNull("external resource descriptors list", resources);
        assertEquals("total external resource descriptors", 1, resources.size());

        ExternalResourceDescriptor firstDescriptor = ListUtil.getFirstMember(resources);
        ExternalResourceType type = ExternalResourceType.valueOf(firstDescriptor.getType());
        assertSame("first descriptor type", ExternalResourceType.DATABASE, type);
        assertFalse("first descriptor is a parent", firstDescriptor.isParent());

        assertTrue(trace.getAppName() + "is known", generator.isApplicationNameKnown(trace.getAppName()));
    }
View Full Code Here

        Operation op = createJdbcOperation("jdbc:foobar://huh:8080");
        op.label("test-label");
        op.type(JdbcDriverExternalResourceAnalyzer.TYPE);

        Frame frame = createJdbcFrame(op);
        Trace trace = createJdbcTrace(frame);

        assertQueryExternalResources(trace, op.getLabel());
    }
View Full Code Here

        Operation op = createJdbcOperation("jdbc:foobar://huh:8080");
        op.type(JdbcOperationExternalResourceAnalyzer.TYPE);
        op.put("sql", "selct * from all");

        Frame frame = createJdbcFrame(op);
        Trace trace = createJdbcTrace(frame);

        assertQueryExternalResources(trace);
    }
View Full Code Here

        Operation op = createJdbcOperation("jdbc:foobar://huh:8080");
        op.type(JdbcOperationExternalResourceAnalyzer.TYPE);

        Frame frame = createJdbcFrame(op);
        Trace trace = createJdbcTrace(frame);

        registry.set(CollectionSettingNames.createApplicationCollectionSettingName(trace.getAppName()), Boolean.FALSE);

        Collection<ExternalResourceDescriptor> resources = locateExternalResourceName(trace);

        // make sure that no query external resources were created
        assertNotNull("external resource descriptors list", resources);
        assertEquals("total external resource descriptors", 1, resources.size());

        ExternalResourceDescriptor firstDescriptor = ListUtil.getFirstMember(resources);
        ExternalResourceType type = ExternalResourceType.valueOf(firstDescriptor.getType());
        assertSame("first descriptor type", ExternalResourceType.DATABASE, type);
        assertFalse("first descriptor is a parent", firstDescriptor.isParent());

        assertTrue(trace.getAppName() + "is known", generator.isApplicationNameKnown(trace.getAppName()));
    }
View Full Code Here

        super();
    }

    @Test
    public void testDefaultAnalysis() {
        Trace trace = createValidTrace(false);
        Frame scoreFrame = analyzer.getScoringFrame(trace);
        assertEndPointAnalysis("traceAnalysis", analyzer.locateEndPoint(trace), scoreFrame);
        assertEndPointAnalysis("frameAnalysis", analyzer.locateEndPoint(scoreFrame, FrameUtil.getDepth(scoreFrame)), scoreFrame);
    }
View Full Code Here

        assertEndPointAnalysis("frameAnalysis", analyzer.locateEndPoint(scoreFrame, FrameUtil.getDepth(scoreFrame)), scoreFrame);
    }

    @Test
    public void testLegacyAnalysis() {
        Trace trace = createValidTrace(false);
        Frame scoreFrame = analyzer.getScoringFrame(trace);
        assertEndPointAnalysis("traceAnalysis", analyzer.locateEndPoint(trace), scoreFrame);
        assertEndPointAnalysis("frameAnalysis", analyzer.locateEndPoint(scoreFrame, FrameUtil.getDepth(scoreFrame)), scoreFrame);
    }
View Full Code Here

    @Test
    public void testAnalyzeNoHttpFrame() {
        Operation op = createControllerOperation(false);
        Frame frame = new SimpleFrame(FrameId.valueOf("3777347"), null, op, new TimeRange(1L, 10L), Collections.<Frame>emptyList());
        Trace trace = Trace.newInstance(ApplicationName.valueOf("app"), TraceId.valueOf("0"), frame);
        EndPointAnalysis analysis = analyzer.locateEndPoint(trace);
        assertNotNull("No analysis result", analysis);
        assertEquals("Mismatched example", op.getLabel(), analysis.getExample());
    }
View Full Code Here

    @Test
    public void testAnalyzeNoControllerFrame() {
        Operation httpOp = new Operation().type(OperationType.HTTP);
        httpOp.createMap("request").put(OperationFields.URI, "/foo");

        Trace trace = mock(Trace.class);
        SimpleFrameBuilder builder = new SimpleFrameBuilder();
        builder.enter(httpOp);
        Frame root = builder.exit();
        when(trace.getRootFrame()).thenReturn(root);
        when(trace.getAppName()).thenReturn(ApplicationName.valueOf("app"));

        EndPointAnalysis analysis = analyzer.locateEndPoint(trace);
        assertNull("Unexpected result: " + analysis, analysis);
    }
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.