protected Object invokeInternal(Object proxyObject, Method method, Object[] arguments) throws Throwable { BAMTargetEntry bamTargetEntry = KSBServiceLocator.getBAMService() .recordClientInvocation(this.serviceConfiguration, getTarget(), method, arguments); try { return method.invoke(getTarget(), arguments); } catch (Throwable throwable) { if (throwable instanceof InvocationTargetException) { throwable = throwable.getCause(); } KSBServiceLocator.getBAMService().recordClientInvocationError(throwable, bamTargetEntry); throw throwable; } }
private void verifyServiceCalls(QName serviceName, boolean shouldHaveBeenCalled) throws Exception { BAMService bamService = KSBServiceLocator.getBAMService(); List<BAMTargetEntry> bamCalls = bamService.getCallsForService(serviceName); if (!shouldHaveBeenCalled) { assertTrue("A service call should not have been recorded yet.", bamCalls.size() == 0); } else { assertTrue("No service call recorded", bamCalls.size() > 0); boolean foundClientCall = false; boolean foundServiceCall = false; for (BAMTargetEntry bamEntry : bamCalls) { if (bamEntry.getServerInvocation()) { foundServiceCall = true; } else { foundClientCall = true; } } assertTrue("No client call recorded", foundClientCall); assertTrue("No service call recorded", foundServiceCall); assertEquals("Wrong number of calls recorded", 2, bamCalls.size()); } }
public static boolean isBamSupported() { return KSBServiceLocator.getBAMService() != null && Boolean.valueOf(ConfigContext.getCurrentContextConfig().getProperty(Config.BAM_ENABLED)); }