Package com.springsource.insight.intercept.operation

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


            obfuscator.incrementalUpdate(HttpObfuscator.OBFUSCATED_HEADERS_SETTING, StringUtil.implode(headerSet, ","));
        }

        HttpResponse response = httpClient.execute(request);
        Operation op = assertExecutionResult(uri, request, response, false);
        OperationMap reqDetails = op.get("request", OperationMap.class);
        OperationList reqHeaders = reqDetails.get("headers", OperationList.class);
        Map<String, String> requestHeaders = toHeadersMap(reqHeaders);
        OperationMap rspDetails = op.get("response", OperationMap.class);
        OperationList rspHeaders = rspDetails.get("headers", OperationList.class);
        Map<String, String> responseHeaders = toHeadersMap(rspHeaders);
        Map<String, String> hdrsMap = new TreeMap<String, String>(String.CASE_INSENSITIVE_ORDER);
        if (MapUtil.size(requestHeaders) > 0) {
            hdrsMap.putAll(requestHeaders);
        }
View Full Code Here


            return Collections.emptyMap();
        }

        Map<String, String> hdrsMap = new TreeMap<String, String>();
        for (int index = 0; index < headers.size(); index++) {
            OperationMap hdrValue = headers.get(index, OperationMap.class);
            String name = hdrValue.get(OperationUtils.NAME_KEY, String.class);
            String value = hdrValue.get(OperationUtils.VALUE_KEY, String.class);
            hdrsMap.put(name, value);
        }

        return hdrsMap;
    }
View Full Code Here

        Operation operation = getTestOperation("testSetMappedParameter");
        JdbcOperationFinalizer.addParam(operation, "key1", "value1");
        JdbcOperationFinalizer.addParam(operation, "key2", "value2");
        JdbcOperationFinalizer.finalize(operation);

        OperationMap params = operation.get(JdbcOperationFinalizer.PARAMS_VALUES, OperationMap.class);
        assertNotNull("Missing parameters map", params);
        assertEquals("Mismatched mapped params size", 2, params.size());
        assertEquals("Mismatched 1st key value", "value1", params.get("key1"));
        assertEquals("Mismatched 2nd key value", "value2", params.get("key2"));
    }
View Full Code Here

        Operation operation = getTestOperation("testMappedParamsValuesClearedBetweenSuccessiveInvocations");
        JdbcOperationFinalizer.addParam(operation, "key1", "value1");
        JdbcOperationFinalizer.addParam(operation, "key2", "value2");
        JdbcOperationFinalizer.finalize(operation);

        OperationMap params = operation.get(JdbcOperationFinalizer.PARAMS_VALUES, OperationMap.class);
        assertNotNull("Missing parameters map", params);

        JdbcOperationFinalizer.finalize(operation);
        assertNullValue("Unexpected parameters map", operation.get(JdbcOperationFinalizer.PARAMS_VALUES));
    }
View Full Code Here

        assert op.getType().getName().equals("wf-transition");

        assert "cancel".equals(op.get("codeId"));
        assert "cancel".equals(op.get("stateId"));

        OperationMap map = (OperationMap) op.get("attribs");
        assertNotNull(map.get("bind"));

        OperationList list = (OperationList) op.get("actions");
        assert "flowScope.persons=personDao.findPersons()".equals(list.get(0));
    }
View Full Code Here

    public void testAddDestinationDetailsToMapIfNeeded() throws JMSException {
        Queue queue = mock(Queue.class);
        when(queue.getQueueName()).thenReturn("mock-queue");

        Operation op = new Operation();
        OperationMap map = op.createMap("test-map");

        addDestinationDetailsToMapIfNeeded(queue, map, null, Collections.<String>emptyList(), "test");

        String type = map.get("test" + TYPE, String.class);
        String name = map.get("test" + NAME, String.class);

        assertNotNull(type);
        assertNotNull(name);

        assertEquals(type, DestinationType.Queue.name());
        assertEquals(name, "mock-queue");

        queue = null;
        op = new Operation();
        map = op.createMap("test-map");

        addDestinationDetailsToMapIfNeeded(queue, map, null, Collections.<String>emptyList(), "test");
        type = map.get("test" + TYPE, String.class);
        name = map.get("test" + NAME, String.class);

        assertNull(type);
        assertNull(name);
    }
View Full Code Here

        assert op.getType().getName().equals("wf-start");

        assertNotNull(op.get("flowId"));
        assertNotNull(op.get("initParams"));

        OperationMap map = (OperationMap) op.get("initParams");
        assertNotNull(map.get("id"));
    }
View Full Code Here

        extractMessageProperties(op, message, null, Collections.<String>emptyList());
        assertAttributes(mockMap, op);
    }

    static OperationMap assertAttributes(final Map<String, ?> mockMap, Operation op) {
        OperationMap opMap = op.get(MESSAGE_PROPERTIES, OperationMap.class);
        assertNotNull("Missing " + MESSAGE_PROPERTIES + " map", opMap);

        for (String key : mockMap.keySet()) {
            Object mockValue = mockMap.get(key);
            if (mockValue instanceof Number) {
                Number opValue = opMap.get(key, Number.class);
                assertNotNull("Missing number value for key=" + key, opValue);
                if (MathUtil.isIntegralNumber(opValue)) {
                    assertEquals("Mismatched integral value for key=" + key, ((Number) mockValue).longValue(), opValue.longValue());
                } else {
                    assertEquals("Mismatched integral value for key=" + key, ((Number) mockValue).doubleValue(), opValue.doubleValue(), 0.0001d);
                }
            } else {
                assertEquals("Mismatched value for key=" + key, mockValue, opMap.get(key));
            }
        }

        return opMap;
    }
View Full Code Here

        extractMessageHeaders(op, message, null, Collections.<String>emptyList());
        assertHeaders(message, op);
    }

    static OperationMap assertHeaders(Message message, Operation op) throws JMSException {
        OperationMap opMap = op.get(MESSAGE_HEADERS, OperationMap.class);
        assertNotNull("Missing " + MESSAGE_HEADERS + " map", opMap);

        assertEquals(CORRELATION_ID, message.getJMSCorrelationID(), opMap.get(CORRELATION_ID, String.class));
        assertEquals(DELIVERY_MODE, getDeliveryMode(message.getJMSDeliveryMode()).getLabel(), opMap.get(DELIVERY_MODE, String.class));
        assertEquals(EXPIRATION, message.getJMSExpiration(), opMap.getLong(EXPIRATION, (-1L)));
        assertEquals(MESSAGE_ID, message.getJMSMessageID(), opMap.get(MESSAGE_ID, String.class));
        assertEquals(PRIORITY, message.getJMSPriority(), opMap.getInt(PRIORITY, (-1)));
        assertEquals(REDELIVERED, Boolean.valueOf(message.getJMSRedelivered()), opMap.get(REDELIVERED, Boolean.class));

        return opMap;
    }
View Full Code Here

        Operation op = new Operation();

        extractMessageTypeAttributes(op, mapMessage);

        String type = op.get(MESSAGE_TYPE, String.class);
        OperationMap contentMap = op.get(MESSAGE_CONTENT_MAP, OperationMap.class);

        assertNotNull(contentMap);
        assertEquals(mockMap.size(), contentMap.size());
        assertEquals(mockMap.get("test-key"), contentMap.get("test-key"));
        assertEquals(MessageType.MapMessage.name(), type);
        assertNull(op.get(MESSAGE_CONTENT));
    }
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.