@Test public void throwableObjectWasCreated() throws Exception { long constructorId = 5L; long sensorTypeId = 3L; long platformId = 1L; Object[] parameters = new Object[0]; MyTestException exceptionObject = MyTestException.class.newInstance(); when(platformManager.getPlatformId()).thenReturn(platformId); when(registeredSensorConfig.getTargetClassFqn()).thenReturn(MyTestException.class.getName()); exceptionHook.afterConstructor(coreService, constructorId, sensorTypeId, exceptionObject, parameters, registeredSensorConfig); verify(platformManager, times(1)).getPlatformId(); verifyNoMoreInteractions(platformManager); }
@Override public void afterConstructor(ICoreService coreService, long methodId, long sensorTypeId, Object object, Object[] parameters, RegisteredSensorConfig rsc) { String throwableClass = object.getClass().getName(); String rscTragetClassname = rsc.getTargetClassFqn(); if (throwableClass.equals(rscTragetClassname)) { long platformId = platformManager.getPlatformId(); Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Long identityHash = Long.valueOf(System.identityHashCode(object)); exceptionHandlerId.set(null); Throwable throwable = (Throwable) object; ExceptionSensorData data = new ExceptionSensorData(timestamp, platformId, sensorTypeId, methodId); data.setThrowableIdentityHashCode(identityHash.longValue()); data.setExceptionEvent(ExceptionEvent.CREATED); data.setThrowableType(throwable.getClass().getName()); setStaticInformation(data, throwable); exceptionDataHolder.set(new IdentityHashToDataObject(identityHash, data)); coreService.addDefaultData(data); } }
ExceptionSensorHook implements IExceptionSensorHook { @Override public void afterConstructor(ICoreService coreService, long methodId, long sensorTypeId, Object object, Object[] parameters, RegisteredSensorConfig rsc) { String throwableClass = object.getClass().getName(); String rscTragetClassname = rsc.getTargetClassFqn(); if (throwableClass.equals(rscTragetClassname)) { long platformId = platformManager.getPlatformId(); Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Long identityHash = Long.valueOf(System.identityHashCode(object)); exceptionHandlerId.set(null); Throwable throwable = (Throwable) object; ExceptionSensorData data = new ExceptionSensorData(timestamp, platformId, sensorTypeId, methodId); data.setThrowableIdentityHashCode(identityHash.longValue()); data.setExceptionEvent(ExceptionEvent.CREATED); data.setThrowableType(throwable.getClass().getName()); setStaticInformation(data, throwable); exceptionDataHolder.set(new IdentityHashToDataObject(identityHash, data)); coreService.addDefaultData(data); } } }
ExceptionSensorHook implements IExceptionSensorHook { @Override public void afterConstructor(ICoreService coreService, long methodId, long sensorTypeId, Object object, Object[] parameters, RegisteredSensorConfig rsc) { String throwableClass = object.getClass().getName(); String rscTragetClassname = rsc.getTargetClassFqn(); if (throwableClass.equals(rscTragetClassname)) { long platformId = platformManager.getPlatformId(); Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Long identityHash = Long.valueOf(System.identityHashCode(object)); exceptionHandlerId.set(null); Throwable throwable = (Throwable) object; ExceptionSensorData data = new ExceptionSensorData(timestamp, platformId, sensorTypeId, methodId); data.setThrowableIdentityHashCode(identityHash.longValue()); data.setExceptionEvent(ExceptionEvent.CREATED); data.setThrowableType(throwable.getClass().getName()); setStaticInformation(data, throwable); exceptionDataHolder.set(new IdentityHashToDataObject(identityHash, data)); coreService.addDefaultData(data); } } ExceptionSensorHook(IPlatformManager platformManager, Map<String, Object> parameter); }
ExceptionSensorHook implements IExceptionSensorHook { @Override public void afterConstructor(ICoreService coreService, long methodId, long sensorTypeId, Object object, Object[] parameters, RegisteredSensorConfig rsc) { String throwableClass = object.getClass().getName(); String rscTragetClassname = rsc.getTargetClassFqn(); if (throwableClass.equals(rscTragetClassname)) { long platformId = platformManager.getPlatformId(); Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Long identityHash = Long.valueOf(System.identityHashCode(object)); exceptionHandlerId.set(null); Throwable throwable = (Throwable) object; ExceptionSensorData data = new ExceptionSensorData(timestamp, platformId, sensorTypeId, methodId); data.setThrowableIdentityHashCode(identityHash.longValue()); data.setExceptionEvent(ExceptionEvent.CREATED); data.setThrowableType(throwable.getClass().getName()); setStaticInformation(data, throwable); exceptionDataHolder.set(new IdentityHashToDataObject(identityHash, data)); coreService.addDefaultData(data); } } ExceptionSensorHook(IPlatformManager platformManager, Map<String, Object> parameter); @Override void beforeConstructor(long methodId, long sensorTypeId, Object[] parameters, RegisteredSensorConfig rsc); @Override void afterConstructor(ICoreService coreService, long methodId, long sensorTypeId, Object object, Object[] parameters, RegisteredSensorConfig rsc); @Override void dispatchOnThrowInBody(ICoreService coreService, long id, long sensorTypeId, Object object, Object exceptionObject, Object[] parameters, RegisteredSensorConfig rsc); @Override void dispatchBeforeCatchBody(ICoreService coreService, long id, long sensorTypeId, Object exceptionObject, RegisteredSensorConfig rsc); }
ExceptionSensorHook implements IExceptionSensorHook { @Override public void afterConstructor(ICoreService coreService, long methodId, long sensorTypeId, Object object, Object[] parameters, RegisteredSensorConfig rsc) { String throwableClass = object.getClass().getName(); String rscTragetClassname = rsc.getTargetClassFqn(); if (throwableClass.equals(rscTragetClassname)) { long platformId = platformManager.getPlatformId(); Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Long identityHash = Long.valueOf(System.identityHashCode(object)); exceptionHandlerId.set(null); Throwable throwable = (Throwable) object; ExceptionSensorData data = new ExceptionSensorData(timestamp, platformId, sensorTypeId, methodId); data.setThrowableIdentityHashCode(identityHash.longValue()); data.setExceptionEvent(ExceptionEvent.CREATED); data.setThrowableType(throwable.getClass().getName()); setStaticInformation(data, throwable); exceptionDataHolder.set(new IdentityHashToDataObject(identityHash, data)); coreService.addDefaultData(data); } } ExceptionSensorHook(IPlatformManager platformManager, Map<String, Object> parameter); @Override void beforeConstructor(long methodId, long sensorTypeId, Object[] parameters, RegisteredSensorConfig rsc); @Override void afterConstructor(ICoreService coreService, long methodId, long sensorTypeId, Object object, Object[] parameters, RegisteredSensorConfig rsc); @Override void dispatchOnThrowInBody(ICoreService coreService, long id, long sensorTypeId, Object object, Object exceptionObject, Object[] parameters, RegisteredSensorConfig rsc); @Override void dispatchBeforeCatchBody(ICoreService coreService, long id, long sensorTypeId, Object exceptionObject, RegisteredSensorConfig rsc);  }