Class SectionLoaderUtil
- java.lang.Object
-
- net.officefloor.compile.test.section.SectionLoaderUtil
-
public class SectionLoaderUtil extends java.lang.Object
Utility class for testing aSectionSource
.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SectionType
buildSectionType(SectionDesigner designer)
Builds theSectionType
for theSectionDesigner
.static SectionDesigner
createSectionDesigner()
static SectionTypeBuilder
createSectionTypeBuilder()
Creates theSectionTypeBuilder
.static java.lang.String
getClassPathLocation(java.lang.Class<?> offsetClass, java.lang.String resourceName)
Convenience method to obtain the class path location.static <S extends SectionSource>
OfficeSectionTypeloadOfficeSectionType(java.lang.String sectionName, java.lang.Class<S> sectionSourceClass, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method to load theOfficeSectionType
.static <S extends SectionSource>
SectionTypeloadSectionType(java.lang.Class<S> sectionSourceClass, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method to load theSectionType
.static SectionType
loadSectionType(SectionSource sectionSource, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method to load theSectionType
.static <S extends SectionSource>
voidvalidateOfficeSection(SectionDesigner designer, java.lang.Class<S> sectionSourceClass, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method that validates the loadedOfficeSection
against expectedOfficeSection
from theSectionDesigner
.static <S extends SectionSource>
voidvalidateSection(SectionDesigner designer, java.lang.Class<S> sectionSourceClass, java.lang.Class<?> offsetClass, java.lang.String resourceName, java.lang.String... propertyNameValuePairs)
Facade method to validate theSectionType
andOfficeSection
.static <S extends SectionSource>
voidvalidateSection(SectionDesigner designer, java.lang.Class<S> sectionSourceClass, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method that validates both the loadedSectionType
andOfficeSection
against expectedSectionType
/OfficeSection
from theSectionDesigner
.static <S extends SectionSource>
voidvalidateSectionType(SectionDesigner designer, java.lang.Class<S> sectionSourceClass, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method that validates the loadedSectionType
against expectedSectionType
from theSectionDesigner
.static void
validateSectionType(SectionDesigner designer, SectionType actualSection)
Validates theSectionType
.static void
validateSectionType(SectionDesigner designer, SectionSource sectionSource, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method that validates the loadedSectionType
against expectedSectionType
from theSectionDesigner
.static <S extends SectionSource>
PropertyListvalidateSpecification(java.lang.Class<S> sectionSourceClass, java.lang.String... propertyNameLabels)
Validates theSectionSourceSpecification
for theSectionSource
.static PropertyList
validateSpecification(SectionSource sectionSource, java.lang.String... propertyNameLabels)
Validates theSectionSourceSpecification
for theSectionSource
.
-
-
-
Method Detail
-
validateSpecification
public static <S extends SectionSource> PropertyList validateSpecification(java.lang.Class<S> sectionSourceClass, java.lang.String... propertyNameLabels)
Validates theSectionSourceSpecification
for theSectionSource
.- Type Parameters:
S
-SectionSource
type.- Parameters:
sectionSourceClass
-SectionSource
class.propertyNameLabels
- Listing of name/label pairs for theProperty
instances.- Returns:
- Loaded
PropertyList
.
-
validateSpecification
public static PropertyList validateSpecification(SectionSource sectionSource, java.lang.String... propertyNameLabels)
Validates theSectionSourceSpecification
for theSectionSource
.- Parameters:
sectionSource
-SectionSource
.propertyNameLabels
- Listing of name/label pairs for theProperty
instances.- Returns:
- Loaded
PropertyList
.
-
getClassPathLocation
public static java.lang.String getClassPathLocation(java.lang.Class<?> offsetClass, java.lang.String resourceName)
Convenience method to obtain the class path location.- Parameters:
offsetClass
- Class indicating the package that the resource is within. Typically this will be theAssert
instance.resourceName
- Name of the resource.- Returns:
- Class path location of the resource.
-
createSectionDesigner
public static SectionDesigner createSectionDesigner()
- Returns:
SectionDesigner
.
-
createSectionTypeBuilder
public static SectionTypeBuilder createSectionTypeBuilder()
Creates theSectionTypeBuilder
.- Returns:
SectionTypeBuilder
.
-
buildSectionType
public static SectionType buildSectionType(SectionDesigner designer)
Builds theSectionType
for theSectionDesigner
.- Parameters:
designer
-SectionDesigner
.- Returns:
SectionType
.
-
validateSection
public static <S extends SectionSource> void validateSection(SectionDesigner designer, java.lang.Class<S> sectionSourceClass, java.lang.Class<?> offsetClass, java.lang.String resourceName, java.lang.String... propertyNameValuePairs)
Facade method to validate theSectionType
andOfficeSection
.- Type Parameters:
S
-SectionSource
type.- Parameters:
designer
-SectionDesigner
containing the expectedSectionType
/OfficeSection
.sectionSourceClass
- Class of theSectionSource
being tested.offsetClass
- Object indicating the package that the resource is within. Typically this will be theAssert
instance.resourceName
- Name of the resource. This is used with theoffsetObject
to determine theOfficeSection
location.propertyNameValuePairs
- Listing ofProperty
name/value pairs.
-
validateSection
public static <S extends SectionSource> void validateSection(SectionDesigner designer, java.lang.Class<S> sectionSourceClass, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method that validates both the loadedSectionType
andOfficeSection
against expectedSectionType
/OfficeSection
from theSectionDesigner
.- Type Parameters:
S
-SectionSource
type.- Parameters:
designer
-SectionDesigner
containing the expectedSectionType
/OfficeSection
.sectionSourceClass
- Class of theSectionSource
being tested.sectionLocation
- Location of theOfficeSection
.propertyNameValuePairs
- Listing ofProperty
name/value pairs.
-
validateSectionType
public static void validateSectionType(SectionDesigner designer, SectionSource sectionSource, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method that validates the loadedSectionType
against expectedSectionType
from theSectionDesigner
.- Parameters:
designer
-SectionDesigner
containing the expectedSectionType
.sectionSource
-SectionSource
instance being tested.sectionLocation
- Location of theOfficeSection
.propertyNameValuePairs
- Listing ofProperty
name/value pairs.
-
validateSectionType
public static <S extends SectionSource> void validateSectionType(SectionDesigner designer, java.lang.Class<S> sectionSourceClass, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method that validates the loadedSectionType
against expectedSectionType
from theSectionDesigner
.- Type Parameters:
S
-SectionSource
type.- Parameters:
designer
-SectionDesigner
containing the expectedSectionType
.sectionSourceClass
- Class of theSectionSource
being tested.sectionLocation
- Location of theOfficeSection
.propertyNameValuePairs
- Listing ofProperty
name/value pairs.
-
validateSectionType
public static void validateSectionType(SectionDesigner designer, SectionType actualSection)
Validates theSectionType
.- Parameters:
designer
-SectionDesigner
containing the expectedSectionType
.actualSection
- ActualSectionType
to validate.
-
validateOfficeSection
public static <S extends SectionSource> void validateOfficeSection(SectionDesigner designer, java.lang.Class<S> sectionSourceClass, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method that validates the loadedOfficeSection
against expectedOfficeSection
from theSectionDesigner
.- Type Parameters:
S
-SectionSource
type.- Parameters:
designer
-SectionDesigner
containing the expectedOfficeSection
.sectionSourceClass
- Class of theSectionSource
being tested.sectionLocation
- Location of theOfficeSection
.propertyNameValuePairs
- Listing ofProperty
name/value pairs.
-
loadSectionType
public static <S extends SectionSource> SectionType loadSectionType(java.lang.Class<S> sectionSourceClass, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method to load theSectionType
. It uses theSectionSource
class'sClassLoader
and subsequentClassLoaderConfigurationContext
.- Type Parameters:
S
-SectionSource
type.- Parameters:
sectionSourceClass
- Class of theSectionSource
.sectionLocation
- Location of theOfficeSection
.propertyNameValuePairs
- Listing ofProperty
name/value pairs.- Returns:
SectionType
.
-
loadSectionType
public static SectionType loadSectionType(SectionSource sectionSource, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method to load theSectionType
.- Parameters:
sectionSource
-SectionSource
instance.sectionLocation
- Location of theOfficeSection
.propertyNameValuePairs
- Listing ofProperty
name/value pairs.- Returns:
SectionType
.
-
loadOfficeSectionType
public static <S extends SectionSource> OfficeSectionType loadOfficeSectionType(java.lang.String sectionName, java.lang.Class<S> sectionSourceClass, java.lang.String sectionLocation, java.lang.String... propertyNameValuePairs)
Convenience method to load theOfficeSectionType
. It uses theSectionSource
class'sClassLoader
and subsequentClassLoaderConfigurationContext
.- Type Parameters:
S
-SectionSource
type.- Parameters:
sectionName
- Name of theOfficeSection
.sectionSourceClass
- Class of theSectionSource
.sectionLocation
- Location of theOfficeSection
.propertyNameValuePairs
- Listing ofProperty
name/value pairs.- Returns:
OfficeSectionType
.
-
-