Class AasTest
- java.lang.Object
-
- test.de.iip_ecosphere.platform.support.aas.AasTest
-
public class AasTest extends java.lang.ObjectTests the AAS abstraction with server and client on the "same machine".- Author:
- Monika Staciwa, SSE, Holger Eichelberger, SSE
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAME_AASprivate static java.lang.StringNAME_OP_RECONFIGUREprivate static java.lang.StringNAME_OP_STARTMACHINEprivate static java.lang.StringNAME_OP_STOPMACHINEstatic java.lang.StringNAME_SUBMODELprivate static java.lang.StringNAME_SUBMODELC_INNERprivate static java.lang.StringNAME_SUBMODELC_OUTERprivate static java.lang.StringNAME_VAR_DESCRIPTION1private static java.lang.StringNAME_VAR_DESCRIPTION2private static java.lang.StringNAME_VAR_LOTSIZEprivate static java.lang.StringNAME_VAR_POWCONSUMPTIONprivate static java.lang.StringNAME_VAR_SUBMODELC_INNER_INTprivate static java.lang.StringNAME_VAR_SUBMODELC_INNER_REFprivate static java.lang.StringNAME_VAR_SUBMODELC_INNER_VARprivate static java.lang.StringNAME_VAR_SUBMODELC_OUTER_REFprivate static java.lang.StringNAME_VAR_SUBMODELC_OUTER_VARprivate static java.lang.StringNAME_VAR_VENDORstatic java.lang.StringQNAME_OP_RECONFIGUREstatic java.lang.StringQNAME_OP_STARTMACHINEstatic java.lang.StringQNAME_OP_STOPMACHINEstatic java.lang.StringQNAME_VAR_LOTSIZEstatic java.lang.StringQNAME_VAR_POWCONSUMPTIONstatic java.lang.StringQNAME_VAR_VENDORprivate static java.lang.StringURN_AASprivate static de.iip_ecosphere.platform.support.ServerAddressVAB_SERVER
-
Constructor Summary
Constructors Constructor Description AasTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static voidassertLangString(java.lang.Object val, java.lang.String str)Asserts lang string equality.private static <T> voidassertSize(int expectedSize, java.lang.Iterable<T> iter)Asserts an iterator contents (just) by counting the number of elements.private de.iip_ecosphere.platform.support.aas.AascreateAas(TestMachine machine, java.lang.String protocol)This method creates a test Asset Administration Shell.voidcreateAasOperationsElements(de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder subModelBuilder, de.iip_ecosphere.platform.support.ServerAddress addr, java.lang.String protocol)Creates the corresponding AAS elements forcreateOperationsServer(int, TestMachine, String, KeyStoreDescriptor).voidcreateAasOperationsElements(de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder subModelBuilder, java.lang.String host, int port, java.lang.String protocol)Creates the corresponding AAS elements forcreateOperationsServer(int, TestMachine, String, KeyStoreDescriptor).static de.iip_ecosphere.platform.support.ServercreateOperationsServer(int port, TestMachine machine, java.lang.String protocol, de.iip_ecosphere.platform.support.net.KeyStoreDescriptor kstore)Creates the operations server for the given machine instance and for the operations increateAasOperationsElements(SubmodelElementContainerBuilder, String, int, String).protected booleanexcludeProtocol(java.lang.String protocol)To be overridden: Exclude the given protocol from testing.protected de.iip_ecosphere.platform.support.net.KeyStoreDescriptorgetKeyStoreDescriptor(java.lang.String protocol)To be overridden: descriptor for keystore per protocol.java.lang.String[]getServerProtocols()Returns the server protocols to use during test.private static voidqueryAas(de.iip_ecosphere.platform.support.Endpoint registry, TestMachine machine)Queries the created AAS.voidtestFactory()Tests the factory.voidtestFixId()TestsAasFactory.fixId(String)for BaSyX.voidtestIllegalShortId()Tests for illegal short ids.voidtestVabQuery()Tests creating/reading an AAS over all protocols of a factory.protected voidtestVabQuery(java.lang.String protocol, java.lang.String serverProtocol)Tests creating/reading an AAS.
-
-
-
Field Detail
-
QNAME_VAR_LOTSIZE
public static final java.lang.String QNAME_VAR_LOTSIZE
-
QNAME_VAR_VENDOR
public static final java.lang.String QNAME_VAR_VENDOR
-
QNAME_VAR_POWCONSUMPTION
public static final java.lang.String QNAME_VAR_POWCONSUMPTION
-
QNAME_OP_STARTMACHINE
public static final java.lang.String QNAME_OP_STARTMACHINE
-
QNAME_OP_RECONFIGURE
public static final java.lang.String QNAME_OP_RECONFIGURE
-
QNAME_OP_STOPMACHINE
public static final java.lang.String QNAME_OP_STOPMACHINE
-
NAME_AAS
public static final java.lang.String NAME_AAS
- See Also:
- Constant Field Values
-
NAME_SUBMODEL
public static final java.lang.String NAME_SUBMODEL
- See Also:
- Constant Field Values
-
NAME_SUBMODELC_OUTER
private static final java.lang.String NAME_SUBMODELC_OUTER
- See Also:
- Constant Field Values
-
NAME_VAR_SUBMODELC_OUTER_VAR
private static final java.lang.String NAME_VAR_SUBMODELC_OUTER_VAR
- See Also:
- Constant Field Values
-
NAME_VAR_SUBMODELC_OUTER_REF
private static final java.lang.String NAME_VAR_SUBMODELC_OUTER_REF
- See Also:
- Constant Field Values
-
NAME_SUBMODELC_INNER
private static final java.lang.String NAME_SUBMODELC_INNER
- See Also:
- Constant Field Values
-
NAME_VAR_SUBMODELC_INNER_VAR
private static final java.lang.String NAME_VAR_SUBMODELC_INNER_VAR
- See Also:
- Constant Field Values
-
NAME_VAR_SUBMODELC_INNER_INT
private static final java.lang.String NAME_VAR_SUBMODELC_INNER_INT
- See Also:
- Constant Field Values
-
NAME_VAR_SUBMODELC_INNER_REF
private static final java.lang.String NAME_VAR_SUBMODELC_INNER_REF
- See Also:
- Constant Field Values
-
NAME_VAR_LOTSIZE
private static final java.lang.String NAME_VAR_LOTSIZE
- See Also:
- Constant Field Values
-
NAME_VAR_VENDOR
private static final java.lang.String NAME_VAR_VENDOR
- See Also:
- Constant Field Values
-
NAME_VAR_POWCONSUMPTION
private static final java.lang.String NAME_VAR_POWCONSUMPTION
- See Also:
- Constant Field Values
-
NAME_VAR_DESCRIPTION1
private static final java.lang.String NAME_VAR_DESCRIPTION1
- See Also:
- Constant Field Values
-
NAME_VAR_DESCRIPTION2
private static final java.lang.String NAME_VAR_DESCRIPTION2
- See Also:
- Constant Field Values
-
NAME_OP_STARTMACHINE
private static final java.lang.String NAME_OP_STARTMACHINE
- See Also:
- Constant Field Values
-
NAME_OP_RECONFIGURE
private static final java.lang.String NAME_OP_RECONFIGURE
- See Also:
- Constant Field Values
-
NAME_OP_STOPMACHINE
private static final java.lang.String NAME_OP_STOPMACHINE
- See Also:
- Constant Field Values
-
VAB_SERVER
private static final de.iip_ecosphere.platform.support.ServerAddress VAB_SERVER
-
URN_AAS
private static final java.lang.String URN_AAS
- See Also:
- Constant Field Values
-
-
Method Detail
-
createOperationsServer
public static de.iip_ecosphere.platform.support.Server createOperationsServer(int port, TestMachine machine, java.lang.String protocol, de.iip_ecosphere.platform.support.net.KeyStoreDescriptor kstore)Creates the operations server for the given machine instance and for the operations increateAasOperationsElements(SubmodelElementContainerBuilder, String, int, String).- Parameters:
port- the server communication portmachine- the machineprotocol- the VAB protocol as used inAasFactorykstore- the keystore descriptor, ignored if null- Returns:
- the protocol server
-
createAasOperationsElements
public void createAasOperationsElements(de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder subModelBuilder, de.iip_ecosphere.platform.support.ServerAddress addr, java.lang.String protocol)Creates the corresponding AAS elements forcreateOperationsServer(int, TestMachine, String, KeyStoreDescriptor).- Parameters:
subModelBuilder- the sub model container builder to add the elements toaddr- the server address (schema ignored)protocol- the VAB protocol as used inAasFactory
-
createAasOperationsElements
public void createAasOperationsElements(de.iip_ecosphere.platform.support.aas.SubmodelElementContainerBuilder subModelBuilder, java.lang.String host, int port, java.lang.String protocol)Creates the corresponding AAS elements forcreateOperationsServer(int, TestMachine, String, KeyStoreDescriptor).- Parameters:
subModelBuilder- the sub model container builder to add the elements tohost- the protocol hostport- the protocol portprotocol- the VAB protocol as used inAasFactory
-
testVabQuery
public void testVabQuery() throws java.net.SocketException, java.net.UnknownHostException, java.util.concurrent.ExecutionException, java.io.IOExceptionTests creating/reading an AAS over all protocols of a factory.- Throws:
java.net.SocketException- shall not occur if the test worksjava.net.UnknownHostException- shall not occur if the test worksjava.util.concurrent.ExecutionException- shall not occur if the test worksjava.io.IOException- shall not occur if the test works
-
getServerProtocols
public java.lang.String[] getServerProtocols()
Returns the server protocols to use during test.- Returns:
- the server protocols, empty for HTTP/unencrypted
-
getKeyStoreDescriptor
protected de.iip_ecosphere.platform.support.net.KeyStoreDescriptor getKeyStoreDescriptor(java.lang.String protocol)
To be overridden: descriptor for keystore per protocol.- Parameters:
protocol- the protocol- Returns:
- the keystore, may be null for none
-
excludeProtocol
protected boolean excludeProtocol(java.lang.String protocol)
To be overridden: Exclude the given protocol from testing.- Parameters:
protocol- the protocol- Returns:
truefor exclusion,falsefor inclusion
-
testVabQuery
protected void testVabQuery(java.lang.String protocol, java.lang.String serverProtocol) throws java.net.SocketException, java.net.UnknownHostException, java.util.concurrent.ExecutionException, java.io.IOExceptionTests creating/reading an AAS.- Parameters:
protocol- the VAB protocol as used inAasFactoryserverProtocol- use server protocols to use, empty string for HTTP, rest seeAasFactory- Throws:
java.net.SocketException- shall not occur if the test worksjava.net.UnknownHostException- shall not occur if the test worksjava.util.concurrent.ExecutionException- shall not occur if the test worksjava.io.IOException- shall not occur if the test works
-
createAas
private de.iip_ecosphere.platform.support.aas.Aas createAas(TestMachine machine, java.lang.String protocol) throws java.net.SocketException, java.net.UnknownHostException
This method creates a test Asset Administration Shell.- Parameters:
machine- the test machine instanceprotocol- the VAB protocol as used inAasFactory- Returns:
- the created AAS
- Throws:
java.net.SocketException- if the port to be used for the AAS is occupiedjava.net.UnknownHostException- shall not occur
-
assertLangString
private static void assertLangString(java.lang.Object val, java.lang.String str)Asserts lang string equality.- Parameters:
val- the value of a propertystr- the (composed) lang string to test for
-
queryAas
private static void queryAas(de.iip_ecosphere.platform.support.Endpoint registry, TestMachine machine) throws java.util.concurrent.ExecutionException, java.io.IOExceptionQueries the created AAS.- Parameters:
registry- the registry to get the machine AAS frommachine- the test machine as reference- Throws:
java.util.concurrent.ExecutionException- if operation invocations failjava.io.IOException- if retrieving the AAS fails
-
assertSize
private static <T> void assertSize(int expectedSize, java.lang.Iterable<T> iter)Asserts an iterator contents (just) by counting the number of elements.- Type Parameters:
T- the element type- Parameters:
expectedSize- the expected sizeiter- the iterator to assert
-
testFactory
public void testFactory()
Tests the factory.
-
testIllegalShortId
public void testIllegalShortId()
Tests for illegal short ids. Seems to be valid for all AAs.
-
testFixId
public void testFixId()
TestsAasFactory.fixId(String)for BaSyX.
-
-