public abstract class AbstractEnvironmentTest extends Object
| Constructor and Description |
|---|
AbstractEnvironmentTest() |
| Modifier and Type | Method and Description |
|---|---|
private static void |
assertOperation(de.iip_ecosphere.platform.support.aas.Submodel submodel,
String operationName,
Function<String,Boolean> cond,
Function<Exception,Boolean> exc,
Object... args)
Asserts an operation invocation result through
JsonResultWrapper.fromJson(Object). |
private static void |
assertProperty(de.iip_ecosphere.platform.support.aas.Submodel submodel,
String propertyName,
Function<Object,Boolean> cond)
Asserts a property/value.
|
private static boolean |
checkBoolean(Object obj)
Checks whether
obj is a boolean. |
private static boolean |
checkBoolean(Object obj,
boolean expectedValue)
Checks whether
obj is a boolean with expectedValue. |
private static boolean |
checkEmptyString(Object obj)
Checks whether
obj is an empty string. |
private static boolean |
checkKindString(Object obj,
de.iip_ecosphere.platform.services.environment.ServiceKind expectedValue)
Checks whether
obj is a string representing a value of ServiceKind. |
private static boolean |
checkNonEmptyString(Object obj)
Checks whether
obj is a non-empty string. |
private static boolean |
checkStateString(Object obj)
Checks whether
obj is a string representing a value of ServiceState. |
private static boolean |
checkStateString(Object obj,
de.iip_ecosphere.platform.services.environment.ServiceState expectedValue)
Checks whether
obj is a string representing a value of ServiceState. |
private static boolean |
checkString(Object obj,
String expected)
Checks whether
obj is a non-empty string. |
private static boolean |
checkVersion(Object obj,
de.iip_ecosphere.platform.support.iip_aas.Version expected)
Checks whether the given
obj complies with the expected version. |
static void |
testAas(de.iip_ecosphere.platform.support.Endpoint registry,
de.iip_ecosphere.platform.services.environment.Service expected)
Tests the agreed AAS behavior created by
AasCreator. |
static void |
testAasResult(AasCreator.AasResult result,
de.iip_ecosphere.platform.services.environment.Service expected)
Does further tests based on the given result instance.
|
public static void testAas(de.iip_ecosphere.platform.support.Endpoint registry,
de.iip_ecosphere.platform.services.environment.Service expected)
throws IOException,
ExecutionException
AasCreator.registry - the registry endpointexpected - expected service (with values)IOException - if accessing the AAS failsExecutionException - if accessing AAS property values or performing operation invocations failspublic static void testAasResult(AasCreator.AasResult result, de.iip_ecosphere.platform.services.environment.Service expected)
result - the AAS result instance to testexpected - expected service (with values)private static void assertProperty(de.iip_ecosphere.platform.support.aas.Submodel submodel,
String propertyName,
Function<Object,Boolean> cond)
throws ExecutionException
submodel - the submodelpropertyName - the name/short id of the propertycond - a condition to apply on the property value, if null the property value must be nullExecutionException - if accessing AAS property values or performing operation invocations failsprivate static void assertOperation(de.iip_ecosphere.platform.support.aas.Submodel submodel,
String operationName,
Function<String,Boolean> cond,
Function<Exception,Boolean> exc,
Object... args)
throws ExecutionException
JsonResultWrapper.fromJson(Object).submodel - the submodeloperationName - the name/short id of the operationcond - a condition to apply on the result value, if null no assert is performedexc - a condition to apply on the result value, if null no assert is performed but also no exception
may occurargs - the operation invocation argumentsExecutionException - if accessing AAS property values or performing operation invocations fails and
exc does not allow for catching/assertingprivate static boolean checkNonEmptyString(Object obj)
obj is a non-empty string.obj - the object to testtrue if o fulfills the properties to test, false elseprivate static boolean checkEmptyString(Object obj)
obj is an empty string.obj - the object to testtrue if o fulfills the properties to test, false elseprivate static boolean checkString(Object obj, String expected)
obj is a non-empty string.obj - the object to testexpected - the expected value, may be null then we check for obj nulltrue if o fulfills the properties to test, false elseprivate static boolean checkVersion(Object obj, de.iip_ecosphere.platform.support.iip_aas.Version expected)
obj complies with the expected version.obj - the object to testexpected - the expected version, may be null then we check for obj nulltrue if o fulfills the properties to test, false elseprivate static boolean checkBoolean(Object obj)
obj is a boolean.obj - the object to testtrue if o fulfills the properties to test, false elseprivate static boolean checkBoolean(Object obj, boolean expectedValue)
obj is a boolean with expectedValue.obj - the object to testexpectedValue - the expected valuetrue if obj fulfills the properties to test, false elseprivate static boolean checkStateString(Object obj)
obj is a string representing a value of ServiceState.obj - the object to testtrue if o fulfills the properties to test, false elseprivate static boolean checkStateString(Object obj, de.iip_ecosphere.platform.services.environment.ServiceState expectedValue)
obj is a string representing a value of ServiceState.obj - the object to testexpectedValue - the expected state value, no test is performed if nulltrue if o fulfills the properties to test, false elseprivate static boolean checkKindString(Object obj, de.iip_ecosphere.platform.services.environment.ServiceKind expectedValue)
obj is a string representing a value of ServiceKind.obj - the object to testexpectedValue - the expected state value, no test is performed if nulltrue if o fulfills the properties to test, false elseCopyright © 2022. All rights reserved.