Package com.springsource.insight.intercept.operation

Examples of com.springsource.insight.intercept.operation.Operation


    public void testRun1() throws Exception {
        // Step 1: Execute test
        tests.test_Query1();

        // Step 2:  Get the Operation that was just created by our aspect
        Operation op = getLastEntered();
        assertNotNull("No Neo4J.Query operation data is intercepted", op);

        // Step 3:  Validate
        assertEquals("Invalid operation type", OperationCollectionTypes.QUERY_TYPE.type, op.getType());

        assertEquals("Invalid Label", OperationCollectionTypes.QUERY_TYPE.label + "query", op.getLabel());

        assertNotNull("Parameter 'statement' does not exists", op.get("statement"));
        assertNotNull("Parameter 'params' does not exists", op.get("params"));
    }
View Full Code Here


                Socket sock = resolveClientSocket(connection);
                InetAddress addr = sock.getInetAddress();
                String addrValue = addr.getHostAddress();
                logger.info("Accepted connection from " + addrValue);
                operation = SocketDefinitions.initializeOperation(
                        new Operation(), SocketDefinitions.ACCEPT_ACTION, addrValue, getListenPort());
            } finally {
                close(connection);
            }
        } catch (IOException e) {
            exception = e;
View Full Code Here

    public void testRun2() throws Exception {
        // Step 1: Execute test
        tests.test_Query2();

        // Step 2:  Get the Operation that was just created by our aspect
        Operation op = getLastEntered();
        assertNotNull("No Neo4J.Query operation data is intercepted", op);

        // Step 3:  Validate
        assertEquals("Invalid operation type", OperationCollectionTypes.QUERY_TYPE.type, op.getType());

        assertEquals("Invalid Label", OperationCollectionTypes.QUERY_TYPE.label + "execute", op.getLabel());

        assertNotNull("Parameter 'statement' does not exists", op.get("statement"));
        assertNotNull("Parameter 'params' does not exists", op.get("params"));
    }
View Full Code Here

        return INSTANCE;
    }

    @Override
    protected EndPointAnalysis makeEndPoint(Frame frame, int depth) {
        Operation op = frame.getOperation();

        String workspaceName = op.get("workspace", String.class);
        String repoName = op.get("repository", String.class);
        String endPointName = repoName + (workspaceName != null ? "." + workspaceName : "");

        return new EndPointAnalysis(EndPointName.valueOf(endPointName), "JCR: " + endPointName, endPointName, getOperationScore(op, depth), op);
    }
View Full Code Here

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

    @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

        assertEquals("Mismatched example", op.getLabel(), analysis.getExample());
    }

    @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();
View Full Code Here

        assertNotNull(testName + ": No analysis result", analysis);
        assertEquals(testName + ": Mismatched example", TEST_VERB + " " + TEST_PATH, analysis.getExample());
        assertEquals(testName + ": Mismatched endpoint", EndPointName.valueOf(TEST_CLASS_PATH + "#" + TEST_SIGNATURE), analysis.getEndPointName());
        assertEquals(testName + ": Mismatched label", TEST_CLASS_NAME + "#" + TEST_METHOD_NAME, analysis.getResourceLabel());

        Operation op = scoreFrame.getOperation();
        Boolean legacy = op.get(ControllerEndPointAnalyzer.LEGACY_PROPNAME, Boolean.class);
        if ((legacy != null) && legacy.booleanValue()) {
            assertEquals(testName + ": Mismatched legacy score", ControllerEndPointAnalyzer.LEGACY_SCORE, analysis.getScore());
        } else {
            assertEquals(testName + ": Mismatched default score", ControllerEndPointAnalyzer.DEFAULT_CONTROLLER_SCORE, analysis.getScore());
        }
View Full Code Here

    public void testRun1() throws Exception {
        // Step 1: Execute test
        tests.test_Traverse1();

        // Step 2:  Get the Operation that was just created by our aspect
        Operation op = getLastEntered();
        assertNotNull("No Neo4J.Traverse operation data is intercepted", op);

        // Step 3:  Validate
        assertEquals("Invalid operation type", OperationCollectionTypes.TRAVERSE_TYPE.type, op.getType());

        assertEquals("Invalid Label", OperationCollectionTypes.TRAVERSE_TYPE.label, op.getLabel());

        assertNotNull("Parameter 'start' does not exists", op.get("start"));
        assertNotNull("Parameter 'traversalDescription' does not exists", op.get("traversalDescription"));
    }
View Full Code Here

        return analysis;
    }

    public static Trace createValidTrace(boolean legacy) {
        SimpleFrameBuilder builder = new SimpleFrameBuilder();
        Operation httpOp = new Operation().type(OperationType.HTTP);
        httpOp.createMap("request")
                .put(OperationFields.URI, TEST_PATH)
                .put("method", TEST_VERB);
        builder.enter(httpOp);
        builder.enter(createControllerOperation(legacy));
        builder.exit();
View Full Code Here

        Frame httpFrame = builder.exit();
        return Trace.newInstance(ApplicationName.valueOf("app"), TraceId.valueOf("0"), httpFrame);
    }

    private static Operation createControllerOperation(boolean legacy) {
        return new Operation()
                .type(ControllerEndPointAnalyzer.CONTROLLER_METHOD_TYPE)
                .label(TEST_CLASS_NAME + "#" + TEST_METHOD_NAME)
                .put(OperationFields.CLASS_NAME, TEST_CLASS_PATH)
                .put(OperationFields.METHOD_SIGNATURE, TEST_SIGNATURE)
                .put(ControllerEndPointAnalyzer.LEGACY_PROPNAME, legacy)
View Full Code Here

TOP

Related Classes of com.springsource.insight.intercept.operation.Operation

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.