@SpringBootTest(classes=TestServiceManager.Config.class) @TestPropertySource(locations="classpath:iipecosphere.yml") @ContextConfiguration(initializers=TestServiceManager.Initializer.class) @Import(value=de.iip_ecosphere.platform.services.spring.SpringCloudServiceSetup.class) public class TestServiceManager extends Object
| Modifier and Type | Class and Description |
|---|---|
private class |
TestServiceManager.ArtifactAsserter
Artifact asserter interface.
|
static class |
TestServiceManager.Config
Configures the context, in particular through instances that are not loaded automatically by Spring in tests.
|
static class |
TestServiceManager.Initializer |
private static class |
TestServiceManager.ServiceImpl
A fake service implementation for testing.
|
| Modifier and Type | Field and Description |
|---|---|
private static de.iip_ecosphere.platform.support.Server |
aasServer |
private static de.iip_ecosphere.platform.support.ServerAddress |
BROKER |
private de.iip_ecosphere.platform.services.spring.SpringCloudServiceSetup |
config |
private static de.iip_ecosphere.platform.support.Server |
implServer |
private List<String> |
netKeyToRelease |
private static de.iip_ecosphere.platform.support.iip_aas.ActiveAasBase.NotificationMode |
oldM |
private static de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup |
oldSetup |
private static Predicate<Object> |
POSITIVE_GAUGE_VALUE
A predicate testing whether the value of a JSON gauge is positive.
|
private static de.iip_ecosphere.platform.support.Server |
server |
private List<de.iip_ecosphere.platform.support.Server> |
serversToRelease |
| Constructor and Description |
|---|
TestServiceManager() |
| Modifier and Type | Method and Description |
|---|---|
private static void |
assertFileExists(File file)
Asserts that
file exists. |
private void |
assertMetrics(String[] ids,
Map<String,Predicate<Object>> expected)
Asserts the existence of selected AAS metrics and/or their values.
|
private static void |
assertReceiverLog()
Asserts the receiver log.
|
private void |
doTestStartStop(String descriptorName,
TestServiceManager.ArtifactAsserter asserter,
boolean fakeServer)
Implements the tests for a start-stop scenario with different descriptors/related asserters.
|
static void |
init()
Initializes the test by starting an embedded AMQP server.
|
private void |
releaseFakeServiceCommandServers()
Release the servers created in
startFakeServiceCommandServers(ServiceManager, String[]). |
static void |
shutdown()
Shuts down client and test server.
|
private void |
startFakeServiceCommandServers(de.iip_ecosphere.platform.services.ServiceManager mgr,
String[] ids)
Starts fake service command servers to test the integration of
ServiceStub. |
void |
testEnsembleStartStop()
Tests a simple start-stop cycle of the in one process as an ensemble.
|
void |
testSetup()
Tests known/default values in setup.
|
void |
testSimpleStartStop()
Tests a simple start-stop cycle of the with two processes.
|
private void |
testWithZipArchive(boolean useClasspath)
Tests service start/stop with the ZIP artifact containing explicit dependency JARs.
|
void |
testWithZipArchiveAndClasspath()
Tests service start/stop with the ZIP artifact containing explicit dependency JARs and classpath file
usage enabled.
|
void |
testWithZipArchiveNoClasspath()
Tests service start/stop with the ZIP artifact containing explicit dependency JARs and no classpath
file enabled.
|
private static final Predicate<Object> POSITIVE_GAUGE_VALUE
private static final de.iip_ecosphere.platform.support.ServerAddress BROKER
private static de.iip_ecosphere.platform.support.Server server
private static de.iip_ecosphere.platform.support.iip_aas.ActiveAasBase.NotificationMode oldM
private static de.iip_ecosphere.platform.support.iip_aas.AasPartRegistry.AasSetup oldSetup
private static de.iip_ecosphere.platform.support.Server implServer
private static de.iip_ecosphere.platform.support.Server aasServer
@Autowired private de.iip_ecosphere.platform.services.spring.SpringCloudServiceSetup config
private List<de.iip_ecosphere.platform.support.Server> serversToRelease
public static void init()
public static void shutdown()
public void testSimpleStartStop()
throws ExecutionException,
IOException
test.simpleStream.spring in target/jars - Maven downloads the artifact
in the compile phase.ExecutionException - shall not occur for successful testIOException - shall not occur for successful testprivate static final void assertFileExists(File file)
file exists.file - the filepublic void testEnsembleStartStop()
throws ExecutionException,
IOException
testSimpleStartStop(), this test requires an actual version of test.simpleStream.spring.ExecutionException - shall not occur for successful testIOException - shall not occur for successful testprivate void doTestStartStop(String descriptorName, TestServiceManager.ArtifactAsserter asserter, boolean fakeServer) throws ExecutionException, IOException
descriptorName - the descriptor nameasserter - the asserter related to descriptor-specific propertiesfakeServer - fake command servers for services - clashes with services that are based on the
service environmentExecutionException - if executing service operations failsIOException - if accessing metrics failsprivate static void assertReceiverLog()
private void assertMetrics(String[] ids, Map<String,Predicate<Object>> expected) throws IOException, ExecutionException
ids - service idsexpected - the expected metrics as key-predicate pairs, whereby the predicate may be null to
indicated that the value shall not be testedIOException - if the AAS cannot be retrievedExecutionException - if a property cannot be queriedprivate void startFakeServiceCommandServers(de.iip_ecosphere.platform.services.ServiceManager mgr,
String[] ids)
ServiceStub.mgr - the service managerids - the ids of the services to startprivate void releaseFakeServiceCommandServers()
startFakeServiceCommandServers(ServiceManager, String[]).public void testSetup()
public void testWithZipArchiveNoClasspath()
throws ExecutionException
ExecutionException - shall not occurpublic void testWithZipArchiveAndClasspath()
throws ExecutionException
ExecutionException - shall not occurprivate void testWithZipArchive(boolean useClasspath)
throws ExecutionException
useClasspath - consider classpath fileExecutionException - shall not occurCopyright © 2022. All rights reserved.