Package com.evolveum.midpoint.prism.util
Class PrismTestUtil
- java.lang.Object
-
- com.evolveum.midpoint.prism.util.PrismTestUtil
-
@TestOnly public class PrismTestUtil extends Object
Class that statically instantiates the prism contexts and provides convenient static version of the PrismContext and processor classes. This is usable for tests. DO NOT use this in the main code. Although it is placed in "main" for convenience, is should only be used in tests.- Author:
- semancik
-
-
Constructor Summary
Constructors Constructor Description PrismTestUtil()
-
Method Summary
-
-
-
Method Detail
-
resetPrismContext
public static void resetPrismContext(PrismContextFactory newPrismContextFactory) throws SchemaException, SAXException, IOException
- Throws:
SchemaException
SAXException
IOException
-
setFactory
public static void setFactory(PrismContextFactory newPrismContextFactory)
-
resetPrismContext
public static void resetPrismContext() throws SchemaException, SAXException, IOException
- Throws:
SchemaException
SAXException
IOException
-
createPrismContext
public static PrismContext createPrismContext() throws SchemaException, IOException
- Throws:
SchemaException
IOException
-
createInitializedPrismContext
public static PrismContext createInitializedPrismContext() throws SchemaException, SAXException, IOException
- Throws:
SchemaException
SAXException
IOException
-
getPrismContext
public static PrismContext getPrismContext()
-
setPrismContext
public static void setPrismContext(PrismContext prismContext)
-
getSchemaRegistry
public static SchemaRegistry getSchemaRegistry()
-
parseObject
public static <T extends Objectable> PrismObject<T> parseObject(File file) throws SchemaException, IOException
- Throws:
SchemaException
IOException
-
parseObject
public static <T extends Objectable> PrismObject<T> parseObject(String xmlString) throws SchemaException
- Throws:
SchemaException
-
parseObjectable
public static <T extends Objectable> T parseObjectable(File file, Class<T> clazz) throws SchemaException, IOException
- Throws:
SchemaException
IOException
-
parseObjects
public static List<PrismObject<? extends Objectable>> parseObjects(File file) throws SchemaException, IOException
- Throws:
SchemaException
IOException
-
serializeObjectToString
public static String serializeObjectToString(PrismObject<? extends Objectable> object, String language) throws SchemaException
- Throws:
SchemaException
-
serializeObjectToString
public static String serializeObjectToString(PrismObject<? extends Objectable> object) throws SchemaException
- Throws:
SchemaException
-
serializeAtomicValue
public static String serializeAtomicValue(Object object, QName elementName) throws SchemaException
- Throws:
SchemaException
-
serializeAnyData
public static String serializeAnyData(Object o, QName defaultRootElementName) throws SchemaException
- Throws:
SchemaException
-
serializeJaxbElementToString
public static String serializeJaxbElementToString(javax.xml.bind.JAXBElement element) throws SchemaException
- Throws:
SchemaException
-
serializeAnyDataWrapped
public static String serializeAnyDataWrapped(Object o) throws SchemaException
- Throws:
SchemaException
-
parseAtomicValue
public static <T> T parseAtomicValue(File file, QName type) throws SchemaException, IOException
- Throws:
SchemaException
IOException
-
parseAtomicValue
public static <T> T parseAtomicValue(String data, QName type) throws SchemaException
- Throws:
SchemaException
-
parseAtomicValueCompat
public static <T> T parseAtomicValueCompat(String data, QName type) throws SchemaException
- Throws:
SchemaException
-
parseAnyValue
public static <T> T parseAnyValue(File file) throws SchemaException, IOException
- Throws:
SchemaException
IOException
-
getObjectDefinition
public static <T extends Objectable> PrismObjectDefinition<T> getObjectDefinition(Class<T> compileTimeClass)
-
createPolyString
public static PolyString createPolyString(String orig)
-
createPolyString
public static PolyString createPolyString(String orig, String norm)
-
createPolyStringType
public static PolyStringType createPolyStringType(String string)
-
createPolyStringType
public static PolyStringType createPolyStringType(String orig, String norm)
-
unmarshalFilter
public static SearchFilterType unmarshalFilter(File file) throws Exception
- Throws:
Exception
-
getFilterCondition
public static ObjectFilter getFilterCondition(ObjectFilter filter, int index)
-
display
public static void display(String title, DebugDumpable dumpable)
-
displayCollection
public static void displayCollection(String title, Collection<?> collection)
-
displayQuery
public static void displayQuery(ObjectQuery query)
-
displayQueryXml
public static void displayQueryXml(String xml)
-
displayText
public static void displayText(String text)
-
displayQueryType
public static void displayQueryType(QueryType queryType) throws SchemaException
- Throws:
SchemaException
-
displaySearchFilterType
public static void displaySearchFilterType(SearchFilterType filterType) throws SchemaException
- Throws:
SchemaException
-
createDefaultParsingContext
public static ParsingContext createDefaultParsingContext()
-
-