Package com.springsource.insight.intercept.operation

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


    }

    @Override
    public TraceError locateFrameError(Frame httpFrame) {
        Operation op = httpFrame.getOperation();
        OperationMap response = op.get("response", OperationMap.class);

        int statusCode = (response == null) ? (-1) : response.getInt(STATUS_CODE_ATTR, (-1));
        if ((statusCode >= 0) && httpStatusIsError(statusCode)) {
            return new TraceError(createErrorMessage(statusCode, response.get(REASON_PHRASE_ATTR, String.class)));
        }

        OperationMap request = op.get("request", OperationMap.class);
        Boolean contextAvailable = (request == null) ? null : request.get(OperationFields.CONTEXT_AVAILABLE, Boolean.class);
        if ((contextAvailable != null) && (!contextAvailable.booleanValue())) {
            return contextNotAvailableError;
        } else {
            return null;
        }
View Full Code Here


        assertUnknownOperationContents(op);
        OperationList actionParams = op.get("actionParams", OperationList.class);
        assertNotNull("No action params", actionParams);
        assertEquals("No params values", 1, actionParams.size());

        OperationMap map = actionParams.get(0, OperationMap.class);
        assertNotNull("No values map", map);
        assertEquals("Mismatched params values entries", 2, map.size());
        assertEquals("Mismatched param key", kvp.getKey(), map.get("key", String.class));
        assertEquals("Mismatched param value", kvp.getValue(), map.get("value", String.class));
    }
View Full Code Here

    }

    @Override
    protected EndPointAnalysis makeEndPoint(Frame httpFrame, int depth) {
        Operation op = httpFrame.getOperation();
        OperationMap request = op.get("request", OperationMap.class);

        String servletName = (request == null) ? null : request.get("servletName", String.class);
        String endPointKey = sanitizeEndPointKey(servletName);
        String endPointLabel = "Servlet: " + servletName;
        String example = EndPointAnalysis.createHttpExampleRequest(request);
        if (StringUtil.isEmpty(example)) {
            example = op.getLabel();
View Full Code Here

            return endPointKey.replace('/', '_');
        }
    }

    static String getExampleRequest(Operation op) {
        OperationMap details = op.get("request", OperationMap.class);
        return ((details == null) ? "???" : String.valueOf(details.get("method")))
                + " " + ((details == null) ? "<UNKNOWN>" : details.get(OperationFields.URI));
    }
View Full Code Here

    protected OperationMap assertCollectedEnvironment(Operation op, Context context) throws NamingException {
        return assertCollectedEnvironment(op, context.getEnvironment());
    }

    protected OperationMap assertCollectedEnvironment(Operation op, Map<?, ?> env) {
        OperationMap envMap = op.get("environment", OperationMap.class);
        assertNotNull("Missing environment in " + op.getLabel(), envMap);
        assertEquals("Mismatched environment size in " + op.getLabel(), MapUtil.size(env), envMap.size());

        Collection<? extends Map.Entry<String, ?>> envEntries = envMap.entrySet();
        Collection<Object> expKeys = new HashSet<Object>(env.keySet());
        for (Map.Entry<String, ?> ee : envEntries) {
            String key = ee.getKey();
            Object expected = env.get(key), actual = ee.getValue();
            assertEquals(op.getLabel() + ": Mismatched values for key=" + key, expected, actual);
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

     * @return Generated attributes {@link OperationMap}
     * @throws JMSException if any occurs by accessing {@code message} properties
     */
    static OperationMap extractMessageProperties(Operation op, Message message, ObscuredValueMarker marker, Collection<String> nameSet)
            throws JMSException {
        OperationMap attributesMap = op.createMap(MESSAGE_PROPERTIES);

        Enumeration<?> propertyNames = message.getPropertyNames();

        if (propertyNames != null) {

            Object host = message.getObjectProperty("host");
            Object port = message.getObjectProperty("port");

            if (host != null && port != null) {
                OperationMap connectionData = op.createMap(CONNECTION_DATA);
                int _port;

                try {
                    _port = Integer.parseInt(String.valueOf(port));
                } catch (NumberFormatException e) {
                    _port = -1;
                }

                connectionData.put("port", _port);
                connectionData.put("host", String.valueOf(host));
            }

            for (Enumeration<?> propertyNameEnum = propertyNames; propertyNameEnum.hasMoreElements(); ) {
                String propertyName = (String) propertyNameEnum.nextElement();
                Object propertyValue = message.getObjectProperty(propertyName);
View Full Code Here

     * @return The {@link OperationMap} containing the relevant extracted headers
     * @throws JMSException if any occurs by accessing {@code message} properties
     */
    static OperationMap extractMessageHeaders(Operation op, Message message, ObscuredValueMarker marker, Collection<String> nameSet)
            throws JMSException {
        OperationMap headersMap = op.createMap(MESSAGE_HEADERS);

        addDestinationDetailsToMapIfNeeded(message.getJMSDestination(), headersMap, marker, nameSet, MESSAGE_DESTINATION);
        addDestinationDetailsToMapIfNeeded(message.getJMSReplyTo(), headersMap, marker, nameSet, REPLY_TO);
        updateAny(headersMap, CORRELATION_ID, message.getJMSCorrelationID(), marker, nameSet);
        updateAny(headersMap, DELIVERY_MODE, getDeliveryMode(message.getJMSDeliveryMode()).getLabel(), marker, nameSet);
View Full Code Here

        assertEquals("Mismatched number of errors", errors.getErrorCount(), errDetails.size());

        List<? extends ObjectError> errList = errors.getAllErrors();
        for (int index = 0; index < errList.size(); index++) {
            ObjectError expected = errList.get(index);
            OperationMap actual = errDetails.get(index, OperationMap.class);
            assertNotNull("Missing encoded value for error #" + index + ": " + expected, actual);

            String objName = actual.get(OperationUtils.NAME_KEY, String.class);
            assertEquals("Mismatched object name at entry #" + index, expected.getObjectName(), objName);

            String errExpected = StringUtil.chopTailAndEllipsify(expected.toString(), ValidationJoinPointFinalizer.MAX_ERROR_TEXT_LENGTH);
            String errActual = actual.get(OperationUtils.VALUE_KEY, String.class);
            assertEquals("Mismatched error text at entry #" + index, errExpected, errActual);
        }

        return errDetails;
    }
View Full Code Here

    ExternalResourceDescriptor createExternalResourceDescriptor(ColorManager colorManager, Frame queueFrame) {
        Operation op = queueFrame.getOperation();
        String label = buildLabel(op);

        OperationMap connectionData = op.get(JMSPluginUtils.CONNECTION_DATA, OperationMap.class);

        String host = connectionData == null ? null : connectionData.get("host", String.class);
        Number portProperty = connectionData == null ? null : connectionData.get("port", Number.class);
        int port = portProperty == null ? -1 : portProperty.intValue();

        String color = colorManager.getColor(op);
        String hashString = buildNameHash(label, host, port);
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.