Package net.shibboleth.spring.testing
Class AbstractFailFastTest
java.lang.Object
org.opensaml.core.testing.OpenSAMLInitBaseTestCase
net.shibboleth.spring.testing.AbstractFailFastTest
Base class for testing metadata providers.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA record wrapper for a mock property. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static List<GenericApplicationContext>All theGenericApplicationContextever allocated for this test.private StringThe directory where our test files are. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidtear down all theGenericApplicationContextwe have used.voidSet up our state.voidAllocate up any per test resources.protected ApplicationContextgetApplicationContext(String contextName, String... files) Conjure up, and remember aGenericApplicationContext.protected ApplicationContextgetApplicationContext(String contextName, MockPropertySource propSource, String... files) Conjur up, and remember aGenericApplicationContext.protected ObjectRead and parse some files, then look for aReloadableServicein them.protected ObjectgetBean(MockPropertySource propSource, Boolean failFast, String... files) Read and parse some files, then look for aReloadableServicein them.protected ObjectgetBean(MockPropertySource propSource, String... files) Read and parse some files, then look for aReloadableServicein them.protected StringgetPath()Our test path.protected Stringget the directory where our tests are stored.protected StringReturn the name of the file in the working dir with this name.protected StringmakeTempPath(String filePart) Return the name of the file in the working dir with this name.protected MockPropertySourcepropertySource(String name, String value) Create aMockPropertySourcewith one property in it.protected MockPropertySourceCreate aMockPropertySourcepopulated with the provided propertiesprotected voidregisterContext(GenericApplicationContext context) Make note of newly allocatedGenericApplicationContext.Methods inherited from class org.opensaml.core.testing.OpenSAMLInitBaseTestCase
initOpenSAML
-
Field Details
-
workspaceDirName
The directory where our test files are. -
contexts
All theGenericApplicationContextever allocated for this test. They are explicitly torn down at the end.
-
-
Constructor Details
-
AbstractFailFastTest
public AbstractFailFastTest()
-
-
Method Details
-
registerContext
Make note of newly allocatedGenericApplicationContext.- Parameters:
context- what to remember.
-
getPath
Our test path.- Returns:
- the path
-
getWorkspaceDirName
get the directory where our tests are stored.- Returns:
- the directoryname
-
beforeSuite
Allocate up any per test resources.- Throws:
IOException- neveer
-
beforeClass
Set up our state.- Throws:
IOException- if required.
-
afterSuite
@AfterSuite public void afterSuite()tear down all theGenericApplicationContextwe have used. -
getApplicationContext
@Nonnull protected ApplicationContext getApplicationContext(@Nonnull String contextName, @Nullable MockPropertySource propSource, @Nonnull String... files) throws IOException Conjur up, and remember aGenericApplicationContext.- Parameters:
contextName- what to call itpropSource- Any properties to definefiles- all the files to read- Returns:
- a
GenericApplicationContext - Throws:
IOException- as required.
-
getApplicationContext
@Nonnull protected ApplicationContext getApplicationContext(@Nonnull String contextName, @Nonnull String... files) throws IOException Conjure up, and remember aGenericApplicationContext.- Parameters:
contextName- what to call itfiles- all the files to read- Returns:
- a
GenericApplicationContext - Throws:
IOException- as required.
-
getBean
@Nullable protected Object getBean(@Nullable MockPropertySource propSource, @Nonnull String... files) throws IOException Read and parse some files, then look for aReloadableServicein them. Fail fast.- Parameters:
propSource- Any properties to definefiles- all the files to read- Returns:
- the bean
- Throws:
IOException- as required.
-
getBean
@Nullable protected Object getBean(@Nullable MockPropertySource propSource, @Nullable Boolean failFast, @Nonnull String... files) throws IOException Read and parse some files, then look for aReloadableServicein them.- Parameters:
propSource- Any properties to definefailFast- do we fail fast or not?files- all the files to read- Returns:
- the bean
- Throws:
IOException- as required
-
getBean
Read and parse some files, then look for aReloadableServicein them. Fail fast.- Parameters:
files- all the files to read- Returns:
- the bean
- Throws:
IOException- as required
-
propertySource
Create aMockPropertySourcewith one property in it.- Parameters:
name- the property namevalue- the property value- Returns:
- the
MockPropertySource
-
propertySource
@Nonnull protected MockPropertySource propertySource(@Nonnull Collection<AbstractFailFastTest.MockProperty> values) Create aMockPropertySourcepopulated with the provided properties- Parameters:
values- the properties (name,value) to set.- Returns:
- the
MockPropertySource
-
makePath
Return the name of the file in the working dir with this name.- Parameters:
filePart- the file name- Returns:
- the Fully Qualified Path
-
makeTempPath
Return the name of the file in the working dir with this name.- Parameters:
filePart- the file name- Returns:
- the Fully Qualified Path
-