Package com.springsource.insight.intercept.operation

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


            assertEquals("Mismatched subject", message.getSubject(), details.get(MailDefinitions.SEND_SUBJECT, String.class));
        }
    }

    private void assertAddresses(Operation op, String type, int expectedSize) {
        OperationList list = op.get(type, OperationList.class);
        assertNotNull("No addresses of type=" + type, list);
        assertEquals("Mismatched number of " + type + " addresses", expectedSize, list.size());

        for (int index = 0; index < list.size(); index++) {
            OperationMap addrEntry = list.get(index, OperationMap.class);
            assertNotNull("Missing " + type + " entry #" + index, addrEntry);

            String typeValue = addrEntry.get("type", String.class),
                    addrValue = addrEntry.get("value", String.class);
            assertEquals("Mismatched " + type + " type for entry #" + index, "rfc822", typeValue);
View Full Code Here


        assertEquals("Mismatched parameters count", 1, parameters.size());
        assertEquals("Mismatched parameter value", paramValue, parameters.get(paramName));
    }

    protected OperationList assertSqlParams(Operation op, String... values) {
        OperationList parameters = op.get(JdbcOperationFinalizer.PARAMS_VALUES, OperationList.class);
        assertNotNull("Missing parameters list", parameters);
        assertEquals("Mismatched parameters count", ArrayUtil.length(values), parameters.size());

        for (int index = 0; index < parameters.size(); index++) {
            assertEquals("Mismatched parameter at index=" + index, values[index], StringUtil.safeToString(parameters.get(index)));
        }
        return parameters;
    }
View Full Code Here

        }

        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

        assert "dummy2".equals(op.get("stateId"));
        //assert "/dummyView".equals(op.get("view"));
        OperationMap map = (OperationMap) op.get("attribs");
        assertNotNull(map.get("model"));

        OperationList entryActions = (OperationList) op.get("entryActions");
        assert "personDao.save(person)".equals(entryActions.get(0));
        assert "flowScope.temp=1".equals(entryActions.get(1));
    }
View Full Code Here

            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)) {
View Full Code Here

        String methodName = op.get(OperationFields.METHOD_NAME, String.class, "");
        assertTrue(shortName + methodName + " does not start with onApplicationEvent", methodName.startsWith("onApplicationEvent"));
        assertEquals(shortName + ": mismatched event type",
                MyEvent.class.getName(), op.get(SpringLifecycleMethodOperationCollectionAspect.EVENT_ATTR, String.class));

        OperationList argsList = op.get(OperationFields.ARGUMENTS, OperationList.class);
        assertNotNull(shortName + ": Missing arguments list", argsList);
        assertEquals(shortName + ": Mismatched number of arguments", 1, argsList.size());
        assertEquals(shortName + ": Mismatched argument type", MyEvent.class.getName(), argsList.get(0));

        return matchingClass;
    }
View Full Code Here

    protected OperationList assertSenders(OperationList op, SimpleMailMessage msg) {
        return assertAddresses("from", op, msg.getFrom());
    }

    protected Operation assertRecipients(Operation op, SimpleMailMessage msg) {
        OperationList recips = op.get(MailDefinitions.SEND_RECIPS, OperationList.class);
        assertNotNull("Missing recipients list", recips);
        assertAddresses("to", recips, msg.getTo());
        assertAddresses("cc", recips, msg.getCc());
        assertAddresses("bcc", recips, msg.getBcc());
        assertAddresses("replyTo", recips, msg.getReplyTo());
View Full Code Here

        assertEquals("[" + name + "]: Mismatched operation type", SpringDataDefinitions.REPO_TYPE, op.getType());
        assertEquals("[" + name + "]: Mismatched method name", name, op.get(OperationFields.METHOD_NAME, String.class));

        // see JoinPointFinalizer code
        OperationList argsList = op.get(OperationFields.ARGUMENTS, OperationList.class);
        assertNotNull("[" + name + "]: No arguments list", argsList);
        assertEquals("[" + name + "]: Mismatched arguments list size", args.length, argsList.size());
        for (int index = 0; index < args.length; index++) {
            Object argVal = args[index];
            if (!StringFormatterUtils.isToStringable(argVal)) {
                continue;
            }

            String expValue = StringFormatterUtils.formatObject(argVal),
                    actValue = argsList.get(index, String.class);
            assertEquals("[" + name + "]: Mismatched argument #" + index + " value", expValue, actValue);
        }

        // see DefaultOperationCollector#exitNormal(Object) code
        if (returnValue != null) {
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));

            OperationList params = op.get(JdbcOperationFinalizer.PARAMS_VALUES, OperationList.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(0));
        }
    }
View Full Code Here

            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

TOP

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

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.