Package net.shibboleth.spring.testing

# Class AbstractFailFastTest

java.lang.Object
org.opensaml.core.testing.OpenSAMLInitBaseTestCase
net.shibboleth.spring.testing.AbstractFailFastTest

public class AbstractFailFastTest extends OpenSAMLInitBaseTestCase
Base class for testing metadata providers.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static final record`
`AbstractFailFastTest.MockProperty`
A record wrapper for a mock property.

## Field Summary

Fields
Modifier and Type
Field
Description
`(package private) static List<GenericApplicationContext>`
`contexts`
All the `GenericApplicationContext` ever allocated for this test.
`private String`
`workspaceDirName`
The directory where our test files are.

## Constructor Summary

Constructors
Constructor
Description
`AbstractFailFastTest()`

## Method Summary

Modifier and Type
Method
Description
`void`
`afterSuite()`
tear down all the `GenericApplicationContext` we have used.
`void`
`beforeClass()`
Set up our state.
`void`
`beforeSuite()`
Allocate up any per test resources.
`protected ApplicationContext`
`getApplicationContext(String contextName, String... files)`
Conjure up, and remember a `GenericApplicationContext`.
`protected ApplicationContext`
`getApplicationContext(String contextName, MockPropertySource propSource, String... files)`
Conjur up, and remember a `GenericApplicationContext`.
`protected Object`
`getBean(String... files)`
Read and parse some files, then look for a `ReloadableService` in them.
`protected Object`
`getBean(MockPropertySource propSource, Boolean failFast, String... files)`
Read and parse some files, then look for a `ReloadableService` in them.
`protected Object`
`getBean(MockPropertySource propSource, String... files)`
Read and parse some files, then look for a `ReloadableService` in them.
`protected String`
`getPath()`
Our test path.
`protected String`
`getWorkspaceDirName()`
get the directory where our tests are stored.
`protected String`
`makePath(String filePart)`
Return the name of the file in the working dir with this name.
`protected String`
`makeTempPath(String filePart)`
Return the name of the file in the working dir with this name.
`protected MockPropertySource`
`propertySource(String name, String value)`
Create a `MockPropertySource` with one property in it.
`protected MockPropertySource`
`propertySource(Collection<AbstractFailFastTest.MockProperty> values)`
Create a `MockPropertySource` populated with the provided properties
`protected void`
`registerContext(GenericApplicationContext context)`
Make note of newly allocated `GenericApplicationContext`.

### Methods inherited from class org.opensaml.core.testing.OpenSAMLInitBaseTestCase

`initOpenSAML`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### workspaceDirName

@NonnullBeforeTest private String workspaceDirName
The directory where our test files are.

### contexts

@NonnullBeforeTest static List<GenericApplicationContext> contexts
All the `GenericApplicationContext` ever allocated for this test. They are explicitly torn down at the end.

## Constructor Details

### AbstractFailFastTest

public AbstractFailFastTest()

## Method Details

### registerContext

protected void registerContext(@Nonnull GenericApplicationContext context)
Make note of newly allocated `GenericApplicationContext`.

Parameters:
  `context` - what to remember.

### getPath

@Nonnull @NotEmpty protected String getPath()
Our test path.

Returns:
  the path

### getWorkspaceDirName

@NonnullBeforeTest protected String getWorkspaceDirName()
get the directory where our tests are stored.

Returns:
  the directoryname

### beforeSuite

@BeforeSuite public void beforeSuite() throws IOException
Allocate up any per test resources.

Throws:
  `IOException` - neveer

### beforeClass

@BeforeClass public void beforeClass() throws IOException
Set up our state.

Throws:
  `IOException` - if required.

### afterSuite

@AfterSuite public void afterSuite()
tear down all the `GenericApplicationContext` we have used.

### getApplicationContext

@Nonnull protected ApplicationContext getApplicationContext(@Nonnull String contextName, @Nullable MockPropertySource propSource, @Nonnull String... files) throws IOException
Conjur up, and remember a `GenericApplicationContext`.

Parameters:
  `contextName` - what to call it
  `propSource` - Any properties to define
  `files` - 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 a `GenericApplicationContext`.

Parameters:
  `contextName` - what to call it
  `files` - 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 a `ReloadableService` in them. Fail fast.

Parameters:
  `propSource` - Any properties to define
  `files` - 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 a `ReloadableService` in them.

Parameters:
  `propSource` - Any properties to define
  `failFast` - do we fail fast or not?
  `files` - all the files to read
Returns:
  the bean
Throws:
  `IOException` - as required

### getBean

@Nullable protected Object getBean(@Nonnull String... files) throws IOException
Read and parse some files, then look for a `ReloadableService` in them. Fail fast.

Parameters:
  `files` - all the files to read
Returns:
  the bean
Throws:
  `IOException` - as required

### propertySource

@Nonnull protected MockPropertySource propertySource(@Nonnull String name, @Nonnull String value)
Create a `MockPropertySource` with one property in it.

Parameters:
  `name` - the property name
  `value` - the property value
Returns:
  the `MockPropertySource`

### propertySource

@Nonnull protected MockPropertySource propertySource(@Nonnull Collection<AbstractFailFastTest.MockProperty> values)
Create a `MockPropertySource` populated with the provided properties

Parameters:
  `values` - the properties (name,value) to set.
Returns:
  the `MockPropertySource`

### makePath

@Nonnull @NotEmpty protected String makePath(String filePart)
Return the name of the file in the working dir with this name.

Parameters:
  `filePart` - the file name
Returns:
  the Fully Qualified Path

### makeTempPath

@Nonnull @NotEmpty protected String makeTempPath(String filePart)
Return the name of the file in the working dir with this name.

Parameters:
  `filePart` - the file name
Returns:
  the Fully Qualified Path