Package com.springsource.insight.intercept.operation

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


        return resSet;
    }

    ExternalResourceDescriptor extractExternalResourceDescriptor(Frame frame) {
        Operation op = (frame == null) ? null : frame.getOperation();
        OperationMap requestDetails = (op == null) ? null : op.get("request", OperationMap.class);
        String uriValue = (requestDetails == null) ? null : requestDetails.get(OperationFields.URI, String.class);

        if (StringUtil.getSafeLength(uriValue) <= 0) {
            return null;
        }

        try {
            URI uri = new URI(uriValue);
            String host = uri.getHost();
            int port = resolvePort(uri);
            String color = colorManager.getColor(op);
            String app = null;
            String ser = null;
            String ep = null;

            OperationMap responseDetails = (op == null) ? null : op.get("response", OperationMap.class);

            if (responseDetails != null) {
                OperationList headersList = responseDetails.get("headers", OperationList.class);

                if (headersList != null) {
                    for (int i = 0; i < headersList.size(); i++) {
                        OperationMap map = headersList.get(i, OperationMap.class);

                        String headerName = map.get(OperationUtils.NAME_KEY, String.class);
                        String headerValue = map.get(OperationUtils.VALUE_KEY, String.class);

                        if ((app != null) && EndPointAnalyzersRegistry.APP_TOKEN_NAME.equals(headerName)) {
                            app = headerValue;
                        } else if ((ser != null) && EndPointAnalyzersRegistry.SERVER_TOKEN_NAME.equals(headerName)) {
                            ser = headerValue;
View Full Code Here


    @Override
    public TraceError locateFrameError(Frame httpFrame) {
        Operation op = (httpFrame == null) ? null : httpFrame.getOperation();
        // NOTE: if an IOException occurred we will not have a response either
        OperationMap response = (op == null) ? null : op.get("response", OperationMap.class);
        if (response == null) {
            return null;
        }

        int statusCode = response.getInt(STATUS_CODE_ATTR, (-1));
        if ((statusCode < 0) /* no code */ || (!httpStatusIsError(statusCode))) {
            return null;
        }

        String reasonPhrase = response.get(REASON_PHRASE_ATTR, String.class);
        return new TraceError(createErrorMessage(statusCode, reasonPhrase));
    }
View Full Code Here

    protected OperationList assertAddresses(String type, OperationList op, String... addrs) {
        assertNotNull(type + ": no address list", op);

        Set<String> addrSet = new TreeSet<String>(Arrays.asList(addrs));
        for (int index = 0; index < op.size(); index++) {
            OperationMap map = op.get(index, OperationMap.class);
            assertNotNull(type + ": missing recipient at index " + index, map);

            String rType = map.get(MailDefinitions.RECIP_TYPE, String.class);
            String value = map.get(MailDefinitions.RECIP_VALUE, String.class);
            if (!type.equals(rType)) {
                continue;
            }

            assertNotNull(type + ": missing recipient value at index " + index, value);
View Full Code Here

        Set<Operation> opsList = new TreeSet<Operation>(ObjectUtil.OBJECT_INSTANCE_COMPARATOR);
        for (int index = 0; index < ops.size(); index++) {
            Operation op = assertJdbcOperation(ops.get(index), sql);
            assertFalse("Non-unique operation for index=" + index, opsList.contains(op));

            OperationMap params = op.get(JdbcOperationFinalizer.PARAMS_VALUES, OperationMap.class);
            assertNotNull("No parameters for index=" + index, params);
            assertEquals("Mismatched #params for index=" + index, 1, params.size());
            assertEquals("Mismatched value for index=" + index, String.valueOf(index), params.get(TEST_PARAM));
        }
    }
View Full Code Here

    }

    void assertOperation(Envelope envelope, BasicProperties props, byte[] body, String opLabel) {
        Operation op = assertBasicOperation(props, body, opLabel);

        OperationMap envMap = op.get("envelope", OperationMap.class);
        assertNotNull("No envelope", envMap);
        assertEquals("Mismatched delivery tag", Long.valueOf(envelope.getDeliveryTag()), envMap.get("deliveryTag", Long.class));
        assertEquals("Mismatched exchange", envelope.getExchange(), envMap.get("exchange", String.class));
        assertEquals("Mismatched routing key", envelope.getRoutingKey(), envMap.get("routingKey", String.class));
    }
View Full Code Here

        for (String propName : new String[]{"connectionUrl", "serverVersion", "clientVersion"}) {
            assertNullValue(propName, op.get(propName));
        }

        OperationMap propsMap = op.get("props", OperationMap.class);
        assertNotNull("No properties extracted", propsMap);

        assertEquals("Mismatched application ID", props.getAppId(), propsMap.get("App Id"));
        assertEquals("Mismatched content encoding", props.getContentEncoding(), propsMap.get("Content Encoding"));
        assertEquals("Mismatched content type", props.getContentType(), propsMap.get("Content Type"));
        assertEquals("Mismatched delivery mode", props.getDeliveryMode().intValue(), propsMap.getInt("Delivery Mode", (-1)));
        assertEquals("Mismatched expiration", props.getExpiration(), propsMap.get("Expiration"));
        return op;
    }
View Full Code Here

    @Override
    protected KeyValPair<String, String> addInitialOperationProps(Operation operation, boolean addRouting, boolean addExchange, Boolean useTempRoutingKey) {
        KeyValPair<String, String> res = null;

        OperationMap map = operation.createMap("envelope");
        if (addExchange) {
            map.put("exchange", TEST_EXCHANGE);
            res = setExchange(res, TEST_EXCHANGE);
        }

        if (addRouting) {
            String routingKey = TEST_ROUTING_KEY;
            if ((useTempRoutingKey != null) && useTempRoutingKey.booleanValue()) {
                routingKey = TEST_TEMP_ROUTING_KEY;
            }
            map.put("routingKey", routingKey);
            res = setRoutingKey(res, routingKey);
        }

        return res;
    }
View Full Code Here

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

    private Frame makeHttpFrame() {
        Operation op = new Operation().type(OperationType.HTTP);
        OperationMap req = op.createMap("request");
        req.put("contentLength", 1000);
        OperationMap res = op.createMap("response");
        res.put("contentSize", 4000l);
        return new SimpleFrame(FrameId.valueOf(1), null, op, timeRange, Collections.<Frame>emptyList());
    }
View Full Code Here

        if (prev != null) {
            prev = null;    // debug breakpoint
        }

        if (mappedValues != null) {
            OperationMap params = operation.createMap(PARAMS_VALUES);
            for (Entry<String, Object> entry : mappedValues.entrySet()) {
                params.put(entry.getKey(), StringFormatterUtils.formatObjectAndTrim(entry.getValue()));
            }
        } else if (indexedValues != null) {
            OperationList params = operation.createList(PARAMS_VALUES);
            for (Object param : indexedValues) {
                params.add(StringFormatterUtils.formatObjectAndTrim(param));
            }
        }

        return operation;
    }
View Full Code Here

        assertEquals(name.getCanonicalName() + ": mismatched attributes count", ListUtil.size(values), op.size());

        for (int index = 0; index < op.size(); index++) {
            Attribute expected = (Attribute) values.get(index);
            String expName = expected.getName(), expValue = StringFormatterUtils.formatObject(expected.getValue());
            OperationMap actual = op.get(index, OperationMap.class);
            assertNotNull(name.getCanonicalName() + "[" + expName + "]: no actual encoding", actual);
            assertEquals(name.getCanonicalName() + ": Mismatched encoded name", expName, actual.get(OperationUtils.NAME_KEY, String.class));
            assertEquals(name.getCanonicalName() + "[" + expName + "]: Mismatched encoded value", expValue, actual.get(OperationUtils.VALUE_KEY, String.class));
        }

        return op;
    }
View Full Code Here

TOP

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

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.