com.evolveum.midpoint.prism.util
Class PrismTestUtil

java.lang.Object
  extended by com.evolveum.midpoint.prism.util.PrismTestUtil

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
PrismTestUtil()
           
 
Method Summary
static PrismContext createInitializedPrismContext()
           
static PolyString createPolyString(String orig)
           
static PolyStringType createPolyStringType(String string)
           
static PrismContext createPrismContext()
           
static
<T extends Objectable>
PrismObjectDefinition<T>
getObjectDefinition(Class<T> compileTimeClass)
           
static PrismContext getPrismContext()
           
static SchemaRegistry getSchemaRegistry()
           
static void marshalElementToDom(JAXBElement<?> jaxbElement, Node parentNode)
           
static String marshalElementToString(JAXBElement<?> jaxbElement)
           
static String marshalElementToString(Object element)
           
static
<T> Element
marshalObjectToDom(T jaxbObject, QName elementQName, Document doc)
           
static String marshalToString(Objectable objectable)
           
static String marshalWrap(Object jaxbObject)
           
static
<T extends Objectable>
ObjectDelta<T>
parseDelta(File file)
           
static
<T extends Objectable>
PrismObject<T>
parseObject(Element element)
           
static
<T extends Objectable>
PrismObject<T>
parseObject(File file)
           
static
<T extends Objectable>
PrismObject<T>
parseObject(String xmlString)
           
static List<PrismObject<? extends Objectable>> parseObjects(File file)
           
static void resetPrismContext()
           
static void resetPrismContext(PrismContextFactory newPrismContextFactory)
           
static String serializeObjectToString(PrismObject<? extends Objectable> object)
           
static void setFactory(PrismContextFactory newPrismContextFactory)
           
static Element toDomElement(Object element)
           
static Element toDomElement(Object jaxbElement, Document doc)
           
static Element toDomElement(Object jaxbElement, Document doc, boolean adopt, boolean clone, boolean deep)
           
static
<T> JAXBElement<T>
unmarshalElement(File xmlFile, Class<T> type)
           
static
<T> JAXBElement<T>
unmarshalElement(String xmlString, Class<T> type)
           
static
<T> T
unmarshalObject(File file, Class<T> type)
           
static
<T> T
unmarshalObject(String stringXml, Class<T> type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrismTestUtil

public PrismTestUtil()
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,
                                              FileNotFoundException
Throws:
SchemaException
FileNotFoundException

createInitializedPrismContext

public static PrismContext createInitializedPrismContext()
                                                  throws SchemaException,
                                                         SAXException,
                                                         IOException
Throws:
SchemaException
SAXException
IOException

getPrismContext

public static PrismContext getPrismContext()

getSchemaRegistry

public static SchemaRegistry getSchemaRegistry()

parseObject

public static <T extends Objectable> PrismObject<T> parseObject(File file)
                                                     throws SchemaException
Throws:
SchemaException

parseObject

public static <T extends Objectable> PrismObject<T> parseObject(String xmlString)
                                                     throws SchemaException
Throws:
SchemaException

parseObject

public static <T extends Objectable> PrismObject<T> parseObject(Element element)
                                                     throws SchemaException
Throws:
SchemaException

parseObjects

public static List<PrismObject<? extends Objectable>> parseObjects(File file)
                                                            throws SchemaException
Throws:
SchemaException

parseDelta

public static <T extends Objectable> ObjectDelta<T> parseDelta(File file)
                                                    throws SchemaException
Throws:
SchemaException

serializeObjectToString

public static String serializeObjectToString(PrismObject<? extends Objectable> object)
                                      throws SchemaException
Throws:
SchemaException

marshalElementToDom

public static void marshalElementToDom(JAXBElement<?> jaxbElement,
                                       Node parentNode)
                                throws JAXBException
Throws:
JAXBException

unmarshalElement

public static <T> JAXBElement<T> unmarshalElement(String xmlString,
                                                  Class<T> type)
                                       throws JAXBException,
                                              SchemaException
Throws:
JAXBException
SchemaException

unmarshalObject

public static <T> T unmarshalObject(File file,
                                    Class<T> type)
                         throws JAXBException,
                                SchemaException,
                                FileNotFoundException
Throws:
JAXBException
SchemaException
FileNotFoundException

unmarshalObject

public static <T> T unmarshalObject(String stringXml,
                                    Class<T> type)
                         throws JAXBException,
                                SchemaException
Throws:
JAXBException
SchemaException

unmarshalElement

public static <T> JAXBElement<T> unmarshalElement(File xmlFile,
                                                  Class<T> type)
                                       throws JAXBException,
                                              SchemaException,
                                              FileNotFoundException
Throws:
JAXBException
SchemaException
FileNotFoundException

marshalObjectToDom

public static <T> Element marshalObjectToDom(T jaxbObject,
                                             QName elementQName,
                                             Document doc)
                                  throws JAXBException
Throws:
JAXBException

toDomElement

public static Element toDomElement(Object element)
                            throws JAXBException
Throws:
JAXBException

toDomElement

public static Element toDomElement(Object jaxbElement,
                                   Document doc)
                            throws JAXBException
Throws:
JAXBException

toDomElement

public static Element toDomElement(Object jaxbElement,
                                   Document doc,
                                   boolean adopt,
                                   boolean clone,
                                   boolean deep)
                            throws JAXBException
Throws:
JAXBException

marshalToString

public static String marshalToString(Objectable objectable)
                              throws JAXBException
Throws:
JAXBException

marshalElementToString

public static String marshalElementToString(JAXBElement<?> jaxbElement)
                                     throws JAXBException
Throws:
JAXBException

marshalElementToString

public static String marshalElementToString(Object element)
                                     throws JAXBException
Throws:
JAXBException

marshalWrap

public static String marshalWrap(Object jaxbObject)
                          throws JAXBException
Throws:
JAXBException

getObjectDefinition

public static <T extends Objectable> PrismObjectDefinition<T> getObjectDefinition(Class<T> compileTimeClass)

createPolyString

public static PolyString createPolyString(String orig)

createPolyStringType

public static PolyStringType createPolyStringType(String string)


Copyright © 2013 evolveum. All Rights Reserved.