Class MockInterceptor
java.lang.Object
de.iip_ecosphere.platform.deviceMgt.MockInterceptor
- All Implemented Interfaces:
de.iip_ecosphere.platform.support.aas.OperationsProvider.Interceptor
public class MockInterceptor
extends Object
implements de.iip_ecosphere.platform.support.aas.OperationsProvider.Interceptor
Test mocking interceptor, as mocking some objects does not work anymore through plugins, classloading. Might be
some side effects are now prevented.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears the intercepted operations and the number of calls.intReturns the number of calls to a given operation with default category.intReturns the number of calls to a given operation with default category.private intgetCounter(String key) Returns the call counter for the givenkey.private StringReturns an operation key.voidIntercept an operation with a given category.voidIntercept an operation with default category.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.iip_ecosphere.platform.support.aas.OperationsProvider.Interceptor
getGetter, getSetter
-
Field Details
-
operations
-
counters
-
-
Constructor Details
-
MockInterceptor
public MockInterceptor()
-
-
Method Details
-
getKey
Returns an operation key.- Parameters:
category- the categoryname- the operation name- Returns:
- the key
-
getOperation
public Function<Object[],Object> getOperation(String category, String name, Function<Object[], Object> origin) - Specified by:
getOperationin interfacede.iip_ecosphere.platform.support.aas.OperationsProvider.Interceptor
-
intercept
Intercept an operation with default category.- Parameters:
name- the name of the operationfunction- the replacement function to be used when the original is being called- See Also:
-
intercept
Intercept an operation with a given category.- Parameters:
category- the categoryname- the name of the operationfunction- the replacement function to be used when the original is being called
-
getCalls
Returns the number of calls to a given operation with default category.- Parameters:
name- the name of the operation- Returns:
- the number of calls
-
getCounter
Returns the call counter for the givenkey.- Parameters:
key- the key (getKey(String, String)- Returns:
- the number of calls
-
getCalls
Returns the number of calls to a given operation with default category.- Parameters:
category- the categoryname- the name of the operation- Returns:
- the number of calls
-
clear
public void clear()Clears the intercepted operations and the number of calls. Resets the interceptor to no interception and no calls done.
-