public class ServerSetup extends Object
1. Start the old runnable jar 2. Wait for it to be ready 3. Install some bundles and wait for them to be ready 4. Create some content in that version 5. Stop that jar 6. Start the new runnable jar 7. Wait for it to be ready 8. Run tests against that new jar to verify the upgradeRunning the whole thing might take a long time, so when debugging the upgrade or the tests you might want to restart from a state saved at step 5, and only run steps 6 to 8, for example. Those steps are SetupPhase objects identified by their name, and specifying a partial list of names allows you to run only some of them in a given test run, speeding up development and troubleshooting as much as possible. TODO: the companion samples/integration-tests module should be updated to use this class to setup the Sling server that it tests, instead of the SlingTestBase class that it currently uses.
Modifier and Type | Class and Description |
---|---|
static class |
ServerSetup.SetupException |
Modifier and Type | Field and Description |
---|---|
static String |
PHASES_TO_RUN_PROP
Config property name: comma-separated list of phases to run
|
static String |
PROP_NAME_PREFIX
Prefix used for our property names
|
static String |
SERVER_BASE_URL
Context attribute: server access URL
|
static String |
SHUTDOWN_ID_SUFFIX
Standard suffix for shutdown tasks IDs
|
Constructor and Description |
---|
ServerSetup() |
Modifier and Type | Method and Description |
---|---|
void |
addSetupPhase(SetupPhase p)
Add a SetupPhase to our list.
|
Properties |
getConfig()
Return the configuration Properties that were set
by
setConfig(java.util.Properties) |
Map<String,Object> |
getContext()
Return a context that
@SetupPhase can use to
communicate among them and with the outside. |
List<String> |
getPhasesToRun()
Return the IDs of phases that should run
|
void |
setConfig(Properties props)
Set configuration and reset our lists of phases
that already ran or failed.
|
void |
setupTestServer()
Runs all startup phases that have not run yet,
and throws an Exception or call Junit's fail()
method if one of them fails or failed in a
previous call of this method.
|
void |
shutdown()
Called by a shutdown hook to run
all shutdown phases, but can also
be called explicitly, each shutdown
phase only runs once anyway.
|
public static final String PROP_NAME_PREFIX
public static final String PHASES_TO_RUN_PROP
public static final String SHUTDOWN_ID_SUFFIX
public static final String SERVER_BASE_URL
public void setupTestServer() throws Exception
Exception
public void shutdown() throws Exception
Exception
public Map<String,Object> getContext()
@SetupPhase
can use to
communicate among them and with the outside.public void setConfig(Properties props)
public Properties getConfig()
setConfig(java.util.Properties)
public void addSetupPhase(SetupPhase p) throws ServerSetup.SetupException
ServerSetup.SetupException
Copyright © 2007–2017 The Apache Software Foundation. All rights reserved.