@Test public void testProcessNormalExitWithoutSetThreadLocalController() { KeyValPair<String, String> kvp = new KeyValPair<String, String>(getClass().getSimpleName(), "testProcessNormalExitWithoutSetThreadLocalController"); GrailsControllerStateKeeper.setThreadLocalActionParams(Collections.singletonList(kvp)); Operation op = new Operation(); collector.processNormalExit(op, Object.class); 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)); }
@Override public void processNormalExit(Operation op, Object returnValue) { State state = GrailsControllerStateKeeper.getAndDestroyThreadLocalState(); op.label(buildLabel(state)) .sourceCodeLocation(buildSourceCodeLocation(state)) ; OperationList actionParams = op.createList("actionParams"); if ((state != null) && (state.actionParams != null)) { for (KeyValPair<String, String> param : state.actionParams) { actionParams.createMap().put("key", param.getKey()).put("value", param.getValue()); } } }
GrailsControllerMetricCollector extends DefaultOperationCollector { @Override public void processNormalExit(Operation op, Object returnValue) { State state = GrailsControllerStateKeeper.getAndDestroyThreadLocalState(); op.label(buildLabel(state)) .sourceCodeLocation(buildSourceCodeLocation(state)) ; OperationList actionParams = op.createList("actionParams"); if ((state != null) && (state.actionParams != null)) { for (KeyValPair<String, String> param : state.actionParams) { actionParams.createMap().put("key", param.getKey()).put("value", param.getValue()); } } } }
GrailsControllerMetricCollector extends DefaultOperationCollector { @Override public void processNormalExit(Operation op, Object returnValue) { State state = GrailsControllerStateKeeper.getAndDestroyThreadLocalState(); op.label(buildLabel(state)) .sourceCodeLocation(buildSourceCodeLocation(state)) ; OperationList actionParams = op.createList("actionParams"); if ((state != null) && (state.actionParams != null)) { for (KeyValPair<String, String> param : state.actionParams) { actionParams.createMap().put("key", param.getKey()).put("value", param.getValue()); } } } GrailsControllerMetricCollector(); }
GrailsControllerMetricCollector extends DefaultOperationCollector { @Override public void processNormalExit(Operation op, Object returnValue) { State state = GrailsControllerStateKeeper.getAndDestroyThreadLocalState(); op.label(buildLabel(state)) .sourceCodeLocation(buildSourceCodeLocation(state)) ; OperationList actionParams = op.createList("actionParams"); if ((state != null) && (state.actionParams != null)) { for (KeyValPair<String, String> param : state.actionParams) { actionParams.createMap().put("key", param.getKey()).put("value", param.getValue()); } } } GrailsControllerMetricCollector(); @Override void processNormalExit(Operation op, Object returnValue); }
GrailsControllerMetricCollector extends DefaultOperationCollector { @Override public void processNormalExit(Operation op, Object returnValue) { State state = GrailsControllerStateKeeper.getAndDestroyThreadLocalState(); op.label(buildLabel(state)) .sourceCodeLocation(buildSourceCodeLocation(state)) ; OperationList actionParams = op.createList("actionParams"); if ((state != null) && (state.actionParams != null)) { for (KeyValPair<String, String> param : state.actionParams) { actionParams.createMap().put("key", param.getKey()).put("value", param.getValue()); } } } GrailsControllerMetricCollector(); @Override void processNormalExit(Operation op, Object returnValue); static final String UNKNOWN_ACTION; }