initialize
This commit is contained in:
27
interface/util/.classpath
Normal file
27
interface/util/.classpath
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
36
interface/util/.project
Normal file
36
interface/util/.project
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>imsinterfaces-util</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,4 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/main/java=UTF-8
|
||||
encoding//src/test/java=UTF-8
|
||||
encoding/<project>=UTF-8
|
||||
8
interface/util/.settings/org.eclipse.jdt.core.prefs
Normal file
8
interface/util/.settings/org.eclipse.jdt.core.prefs
Normal file
@@ -0,0 +1,8 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
4
interface/util/.settings/org.eclipse.m2e.core.prefs
Normal file
4
interface/util/.settings/org.eclipse.m2e.core.prefs
Normal file
@@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
|
||||
<wb-module deploy-name="imsinterfaces-util">
|
||||
<wb-resource deploy-path="/" source-path="/src/main/java"/>
|
||||
</wb-module>
|
||||
</project-modules>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<faceted-project>
|
||||
<installed facet="java" version="1.8"/>
|
||||
<installed facet="jst.utility" version="1.0"/>
|
||||
</faceted-project>
|
||||
@@ -0,0 +1,2 @@
|
||||
disabled=06target
|
||||
eclipse.preferences.version=1
|
||||
21
interface/util/pom.xml
Normal file
21
interface/util/pom.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.itac.interface.interfaces</groupId>
|
||||
<artifactId>imsinterfaces-util</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>imsinterfaces-util</name>
|
||||
<version>${mes.interface.version}</version>
|
||||
<parent>
|
||||
<groupId>com.itac.interface</groupId>
|
||||
<artifactId>data-interface</artifactId>
|
||||
<version>${mes.interface.version}</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.itac.product</groupId>
|
||||
<artifactId>imsapi-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
BIN
interface/util/site/jacoco.exec
Normal file
BIN
interface/util/site/jacoco.exec
Normal file
Binary file not shown.
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* Copyright (c) 2016 iTAC Software AG, Germany. All Rights Reserved.
|
||||
*
|
||||
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
|
||||
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
|
||||
* without the written permission of iTAC Software AG.
|
||||
*/
|
||||
|
||||
package com.itac.mes.datainterface.data.xml;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import com.itac.util.constants.imsapi.ImsApiKey;
|
||||
|
||||
/**
|
||||
* @author frankp
|
||||
*
|
||||
*/
|
||||
public class KeyValuePrinter {
|
||||
|
||||
private static boolean PRINT_SIMPLE_TYPE_NAME = true;
|
||||
private static boolean SPACE_BEFORE_OPEN_BRACKET = true;
|
||||
private static int INDENTATION = 2;
|
||||
private static boolean SPACE_BEFORE_COMMA = false;
|
||||
private static boolean SPACE_AFTER_COMMA = true;
|
||||
|
||||
private static boolean SPACE_BEFORE_EQUALS = true;
|
||||
|
||||
private static boolean SPACE_AFTER_EQUALS = true;
|
||||
private static boolean ARRAY_ON_NEW_LINE= false;
|
||||
|
||||
private int indentation = 0; // Level of indentation, not number of spaces
|
||||
|
||||
/*
|
||||
* Type:fieldName: { [index]: { key=value, } }
|
||||
*/
|
||||
public void print(PrintWriter pw, Object object, String fieldName, ImsApiKey[] keys, String[] values) {
|
||||
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
printType(pw, object);
|
||||
printFieldName(pw, fieldName);
|
||||
|
||||
print(pw, keys, values);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pw
|
||||
* @param fieldName
|
||||
*/
|
||||
private void printFieldName(PrintWriter pw, String fieldName) {
|
||||
if (fieldName == null) {
|
||||
return;
|
||||
}
|
||||
pw.print(":");
|
||||
pw.print(fieldName);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param simpleName
|
||||
*/
|
||||
protected void printType(PrintWriter pw, Object object) {
|
||||
if (PRINT_SIMPLE_TYPE_NAME) {
|
||||
pw.print(object.getClass().getSimpleName());
|
||||
} else {
|
||||
pw.print(object.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Type:fieldName: { [index]: { key=value, } }
|
||||
*/
|
||||
public void print(PrintWriter pw, ImsApiKey[] keys, String[] values) {
|
||||
if (keys == null || values == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (keys.length == 0) {
|
||||
// invalid: values only
|
||||
return;
|
||||
}
|
||||
if (values.length == 0) {// special case: Keys only
|
||||
}
|
||||
|
||||
if (values.length % keys.length != 0) {
|
||||
// invalid: not equal or invalid number of params
|
||||
}
|
||||
|
||||
// Number of (values) = n * numberOf(keys)
|
||||
indent();
|
||||
openBracket(pw);
|
||||
int index = 0;
|
||||
for (int i = 0; i < values.length; i += keys.length) {
|
||||
// ein array ausgeben
|
||||
printArrayIndex(pw, index);
|
||||
|
||||
if (ARRAY_ON_NEW_LINE){
|
||||
indent();
|
||||
newLine(pw);
|
||||
}
|
||||
printSingleKeyValue(pw, i, keys, values);
|
||||
index++;
|
||||
if (i < (values.length - keys.length)) {
|
||||
printComma(pw);
|
||||
}
|
||||
if (ARRAY_ON_NEW_LINE){
|
||||
unindent();
|
||||
}
|
||||
}
|
||||
unindent();
|
||||
newLine(pw);
|
||||
|
||||
closeBracket(pw);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pw
|
||||
*/
|
||||
private void closeBracket(PrintWriter pw) {
|
||||
|
||||
pw.print("}");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pw
|
||||
*/
|
||||
private void openBracket(PrintWriter pw) {
|
||||
if (SPACE_BEFORE_OPEN_BRACKET) {
|
||||
pw.print(" ");
|
||||
}
|
||||
pw.print("{");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pw
|
||||
* @param index
|
||||
* @param object
|
||||
* @param object2
|
||||
*/
|
||||
private void printSingleKeyValue(PrintWriter pw, int startIndex, ImsApiKey[] keys, String[] values) {
|
||||
openBracket(pw);
|
||||
|
||||
for (int k = 0; k < keys.length; k++) {
|
||||
pw.print(keys[k].name());
|
||||
printEquals(pw);
|
||||
pw.print("\'");
|
||||
pw.print(values[startIndex + k]);
|
||||
pw.print("\'");
|
||||
|
||||
if (k < (keys.length - 1)) {
|
||||
printComma(pw);
|
||||
}
|
||||
}
|
||||
|
||||
closeBracket(pw);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pw
|
||||
*/
|
||||
private void printEquals(PrintWriter pw) {
|
||||
if (SPACE_BEFORE_EQUALS) {
|
||||
pw.print(" ");
|
||||
}
|
||||
pw.print("=");
|
||||
if (SPACE_AFTER_EQUALS) {
|
||||
pw.print(" ");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pw
|
||||
*/
|
||||
private void printComma(PrintWriter pw) {
|
||||
if (SPACE_BEFORE_COMMA) {
|
||||
pw.print(" ");
|
||||
}
|
||||
pw.print(",");
|
||||
if (SPACE_AFTER_COMMA) {
|
||||
pw.print(" ");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pw
|
||||
* @param index
|
||||
*/
|
||||
private void printArrayIndex(PrintWriter pw, int index) {
|
||||
newLine(pw);
|
||||
pw.print("[");
|
||||
pw.print(index);
|
||||
pw.print("]");
|
||||
}
|
||||
|
||||
/**
|
||||
* @param pw
|
||||
*
|
||||
*/
|
||||
private void newLine(PrintWriter pw) {
|
||||
pw.println();
|
||||
// inefficient
|
||||
for (int i = 0; i < indentation * INDENTATION; i++) {
|
||||
pw.print(" ");
|
||||
}
|
||||
}
|
||||
|
||||
protected void indent() {
|
||||
indentation++;
|
||||
}
|
||||
|
||||
protected void unindent() {
|
||||
if (indentation > 0) {
|
||||
indentation--;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2010 iTAC Software AG, Germany. All Rights Reserved.
|
||||
*
|
||||
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
|
||||
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
|
||||
* without the written permission of iTAC Software AG.
|
||||
*/
|
||||
|
||||
package com.itac.mes.datainterface.data.xml;
|
||||
|
||||
/**
|
||||
* @author frankp created 2010
|
||||
*/
|
||||
public class UnsupportedTypeException extends Exception {
|
||||
|
||||
/**
|
||||
* @param nodeName
|
||||
*/
|
||||
public UnsupportedTypeException(String nodeName) {
|
||||
super(nodeName);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -6445962490904635859L;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,334 @@
|
||||
package com.itac.mes.datainterface.data.xml;
|
||||
/*
|
||||
* Copyright (c) 2010 iTAC Software AG, Germany. All Rights Reserved.
|
||||
*
|
||||
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
|
||||
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
|
||||
* without the written permission of iTAC Software AG.
|
||||
*/
|
||||
|
||||
|
||||
import static com.itac.util.logging.LogLevel.ERROR;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.text.ParsePosition;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
|
||||
import org.w3c.dom.DOMException;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
|
||||
import com.itac.util.date.W3Timezone;
|
||||
import com.itac.util.logging.LogHandler;
|
||||
import com.itac.util.logging.LogLevel;
|
||||
|
||||
/**
|
||||
* @author frankp created 2010
|
||||
*/
|
||||
public class XmlDeserializer {
|
||||
|
||||
private static final String LOGGER = XmlDeserializer.class.getSimpleName();
|
||||
private static Hashtable<String, Class<?>> classTable = new Hashtable<String, Class<?>>();
|
||||
private static XmlDeserializer instance;
|
||||
private SimpleDateFormat w3cDateFormat = (SimpleDateFormat) SimpleDateFormat.getInstance();
|
||||
public boolean includeProtectedFields = false;
|
||||
|
||||
// privater Konstruktor
|
||||
private XmlDeserializer() {
|
||||
super();
|
||||
w3cDateFormat.applyPattern("yyyy-MM-dd'T'HH:mm:ss.SSS");
|
||||
}
|
||||
|
||||
public static XmlDeserializer newInstance(Class<?>[] classes) {
|
||||
// falls es neue Klassen gibt diese zur Liste der verfügbaren Klassen hinzufügen...
|
||||
for (Class<?> class1 : classes) {
|
||||
classTable.put(class1.getSimpleName(), class1);
|
||||
}
|
||||
if (instance == null) {
|
||||
instance = new XmlDeserializer();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public Object deserialize(Node node) throws UnsupportedTypeException, InstantiationException, IllegalAccessException,
|
||||
IllegalArgumentException, DOMException, ClassNotFoundException {
|
||||
if (node == null || node.getNodeName().isEmpty()) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
Class<?> clazz = classTable.get(node.getNodeName());
|
||||
if (clazz == null) {
|
||||
throw new UnsupportedTypeException(node.getNodeName());
|
||||
}
|
||||
|
||||
// mit clazz und node vollständig setzen
|
||||
return getAnonymous(clazz, node);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param clazz
|
||||
* @param node
|
||||
* @return
|
||||
* @throws IllegalAccessException
|
||||
* @throws DOMException
|
||||
* @throws IllegalArgumentException
|
||||
* @throws InstantiationException
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
private Object getAnonymous(Class<?> clazz, Node node) throws IllegalArgumentException, DOMException, IllegalAccessException,
|
||||
InstantiationException, ClassNotFoundException {
|
||||
|
||||
// neue Klasse nur erstellen, wenn die Klasse von Object erbt.
|
||||
Object object = null;
|
||||
if (clazz == short.class) {
|
||||
object = Integer.valueOf(0).shortValue();
|
||||
} else if (clazz == byte.class) {
|
||||
object = Integer.valueOf(0).byteValue();
|
||||
} else if (clazz == int.class) {
|
||||
object = Integer.valueOf(0).intValue();
|
||||
} else if (clazz == long.class) {
|
||||
object = Integer.valueOf(0).longValue();
|
||||
} else if (clazz == boolean.class) {
|
||||
object = Boolean.valueOf(false).booleanValue();
|
||||
|
||||
} else if (clazz == double.class) {
|
||||
object = Double.valueOf(0.0d).doubleValue();
|
||||
} else if (clazz == float.class) {
|
||||
object = Float.valueOf(0.0f).floatValue();
|
||||
} else {
|
||||
object = clazz.newInstance();
|
||||
}
|
||||
|
||||
// ueber alle Felder iterieren, Werte aus XML setzen wenn vorhanden ...
|
||||
Hashtable<String, Field> fieldTable = new Hashtable<String, Field>();
|
||||
allClassFields(fieldTable, clazz, object, node.getAttributes());
|
||||
|
||||
NodeList childs = node.getChildNodes();
|
||||
if (childs != null) {
|
||||
for (int k = 0; k < childs.getLength(); k++) {
|
||||
Node childNode = childs.item(k);
|
||||
if (childNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
// diesen Knoten interpretieren;
|
||||
String fieldName = childNode.getNodeName();
|
||||
LogHandler.log(LOGGER, LogLevel.TRACE, "setting field " + fieldName);
|
||||
|
||||
if (!fieldTable.containsKey(fieldName)) {
|
||||
continue;
|
||||
}
|
||||
Field field = fieldTable.get(fieldName);
|
||||
if (field == null) {
|
||||
continue;
|
||||
}
|
||||
field.setAccessible(true);
|
||||
|
||||
if (field.getType().isArray()) {
|
||||
// in dieser Liste stecken die einzelnen Array-Elemente
|
||||
|
||||
Class<?> elementClass = field.getType();
|
||||
// z.B. [Lcom.itac.oib.monitoring.data.StateTransition;
|
||||
String singleElementClassName = elementClass.getCanonicalName().substring(0,
|
||||
elementClass.getCanonicalName().length() - 2);
|
||||
// com.itac.oib.monitoring.data.StateTransition
|
||||
Class<?> singleElementClass = Class.forName(singleElementClassName);
|
||||
|
||||
List<Object> resultObjectList = new ArrayList<Object>();
|
||||
|
||||
NodeList arrayElementNodes = childNode.getChildNodes();
|
||||
// über diese Liste iterieren, alle Knoten, die Element sind zählen , damit steht die Arraygroesse fest...
|
||||
for (int j = 0; j < arrayElementNodes.getLength(); j++) {
|
||||
if (arrayElementNodes.item(j).getNodeType() == Node.ELEMENT_NODE) {
|
||||
|
||||
Node elemNode = arrayElementNodes.item(j);
|
||||
|
||||
Object arrElem = getAnonymous(singleElementClass, elemNode);
|
||||
|
||||
resultObjectList.add(arrElem);
|
||||
}
|
||||
}
|
||||
Object[] a = (Object[]) Array.newInstance(singleElementClass, resultObjectList.size());
|
||||
|
||||
if (resultObjectList.size() > 0) {
|
||||
for (int x = 0; x < resultObjectList.size(); x++) {
|
||||
a[x] = resultObjectList.get(x);
|
||||
}
|
||||
}
|
||||
|
||||
field.set(object, a);
|
||||
|
||||
// besondere Behandlung für arrays....
|
||||
} else {
|
||||
if (childNode.getTextContent() != null && !childNode.getTextContent().isEmpty()) {
|
||||
if (field.getType() == String.class) {
|
||||
// in diesem Object einen Wert für das Feld setzen; nur, wenn das feld in der XML enthalten ist
|
||||
// ist diese Field in der XML enthalten???
|
||||
field.set(object, childNode.getTextContent());
|
||||
} else if (field.getType() == Date.class) {
|
||||
setDateField(object, field, childNode);
|
||||
} else if (field.getType() == boolean.class) {
|
||||
field.set(object, Boolean.valueOf(childNode.getTextContent()).booleanValue());
|
||||
} else if (field.getType() == byte.class) {
|
||||
field.set(object, Integer.valueOf(childNode.getTextContent()).byteValue());
|
||||
} else if (field.getType() == short.class) {
|
||||
field.set(object, Integer.valueOf(childNode.getTextContent()).shortValue());
|
||||
} else if (field.getType() == int.class) {
|
||||
field.set(object, Integer.valueOf(childNode.getTextContent()).intValue());
|
||||
} else if (field.getType() == long.class) {
|
||||
field.set(object, Long.valueOf(childNode.getTextContent()).longValue());
|
||||
} else if (field.getType() == double.class) {
|
||||
field.set(object, Double.valueOf(childNode.getTextContent()).doubleValue());
|
||||
} else if (field.getType() == float.class) {
|
||||
field.set(object, Float.valueOf(childNode.getTextContent()).floatValue());
|
||||
} else {
|
||||
field.set(object, getAnonymous(field.getType(), childNode));
|
||||
}
|
||||
} else {
|
||||
LogHandler.log(LOGGER, LogLevel.TRACE, "setting null value for field " + fieldName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fieldTable
|
||||
* @param clazz
|
||||
* @param object
|
||||
* @param namedNodeMap
|
||||
*/
|
||||
private void allClassFields(Hashtable<String, Field> fieldTable, Class<?> clazz, Object object, NamedNodeMap namedNodeMap) {
|
||||
// über alle Felder aller parent Interfaces, solange das Interface nicht Object ist.
|
||||
if (clazz == null || clazz == Object.class) {
|
||||
return;
|
||||
}
|
||||
// fields: all public fields
|
||||
Field[] declaredFields = clazz.getFields();
|
||||
for (Field field : declaredFields) {
|
||||
if ((field.getModifiers() & Modifier.STATIC) == Modifier.STATIC) {
|
||||
// keine statischen Felder
|
||||
continue;
|
||||
}
|
||||
fieldTable.put(field.getName(), field);
|
||||
}
|
||||
if (includeProtectedFields) {
|
||||
Field[] declaredprotFields = clazz.getDeclaredFields();
|
||||
for (Field field : declaredprotFields) {
|
||||
if ((field.getModifiers() & Modifier.STATIC) == Modifier.STATIC) {
|
||||
// keine statischen Felder
|
||||
continue;
|
||||
}
|
||||
if ((field.getModifiers() & Modifier.PROTECTED) == Modifier.PROTECTED) {
|
||||
fieldTable.put(field.getName(), field);
|
||||
Node sNode = namedNodeMap.getNamedItem(field.getName());
|
||||
if (sNode == null) {
|
||||
continue;
|
||||
}
|
||||
String sAttribValue = sNode.getNodeValue();
|
||||
if (sAttribValue != null) {
|
||||
field.setAccessible(true);
|
||||
safeSetField(field, object, sAttribValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
allClassFields(fieldTable, clazz.getSuperclass(), object, namedNodeMap);
|
||||
}
|
||||
|
||||
private void safeSetField(Field field, Object object, String sAttribValue) {
|
||||
try {
|
||||
field.setAccessible(true);
|
||||
if (field.getType() == String.class) {
|
||||
// in diesem Object einen Wert für das Feld setzen; nur, wenn das feld in der XML enthalten ist
|
||||
// ist diese Field in der XML enthalten???
|
||||
field.set(object, sAttribValue);
|
||||
} else if (field.getType() == Date.class) {
|
||||
// Attribut als w3c-date
|
||||
String w3cDateString = sAttribValue;
|
||||
if (w3cDateString == null || w3cDateString.equals("")) {// nicht setzen
|
||||
return;
|
||||
}
|
||||
|
||||
w3cDateString = W3Timezone.convert(w3cDateString);
|
||||
|
||||
ParsePosition parsePosition = new ParsePosition(0);
|
||||
Date retDate = w3cDateFormat.parse(w3cDateString, parsePosition);
|
||||
if (parsePosition.getIndex() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
field.set(object, retDate);
|
||||
} else if (field.getType() == Calendar.class) {
|
||||
// Attribut als w3c-date
|
||||
String w3cDateString = sAttribValue;
|
||||
if (w3cDateString == null || w3cDateString.equals("")) {// nicht setzen
|
||||
return;
|
||||
}
|
||||
|
||||
w3cDateString = W3Timezone.convert(w3cDateString);
|
||||
|
||||
ParsePosition parsePosition = new ParsePosition(0);
|
||||
Date retDate = w3cDateFormat.parse(w3cDateString, parsePosition);
|
||||
if (parsePosition.getIndex() == 0) {
|
||||
return;
|
||||
}
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(retDate);
|
||||
field.set(object, cal);
|
||||
} else if (field.getType() == boolean.class || field.getType() == Boolean.class) {
|
||||
field.set(object, Boolean.valueOf(sAttribValue).booleanValue());
|
||||
} else if (field.getType() == byte.class) {
|
||||
field.set(object, Integer.valueOf(sAttribValue).byteValue());
|
||||
} else if (field.getType() == short.class) {
|
||||
field.set(object, Short.valueOf(sAttribValue).shortValue());
|
||||
} else if (field.getType() == int.class || field.getType() == Integer.class) {
|
||||
field.set(object, Integer.valueOf(sAttribValue).intValue());
|
||||
} else if (field.getType() == long.class || field.getType() == Long.class) {
|
||||
field.set(object, Long.valueOf(sAttribValue).longValue());
|
||||
} else if (field.getType() == double.class) {
|
||||
field.set(object, Double.valueOf(sAttribValue).doubleValue());
|
||||
} else if (field.getType() == float.class) {
|
||||
field.set(object, Float.valueOf(sAttribValue).floatValue());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogHandler.log(LOGGER, ERROR, "failed to set field value" , e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object
|
||||
* @param field
|
||||
* @param node
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
private void setDateField(Object object, Field field, Node node) throws IllegalArgumentException, IllegalAccessException {
|
||||
// ist diese Field in der XML enthalten???
|
||||
if (node == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
String w3cDateString = node.getTextContent();
|
||||
if (w3cDateString == null || w3cDateString.equals("")) {// nicht setzen
|
||||
return;
|
||||
}
|
||||
|
||||
w3cDateString = W3Timezone.convert(w3cDateString);
|
||||
|
||||
ParsePosition parsePosition = new ParsePosition(0);
|
||||
Date retDate = w3cDateFormat.parse(w3cDateString, parsePosition);
|
||||
if (parsePosition.getIndex() == 0) {
|
||||
return;
|
||||
}
|
||||
field.setAccessible(true);
|
||||
field.set(object, retDate);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,485 @@
|
||||
/*
|
||||
* Copyright (c) 2016 iTAC Software AG, Germany. All Rights Reserved.
|
||||
*
|
||||
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
|
||||
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
|
||||
* without the written permission of iTAC Software AG.
|
||||
*/
|
||||
package com.itac.mes.datainterface.data.xml;
|
||||
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.stream.XMLEventFactory;
|
||||
import javax.xml.stream.XMLEventWriter;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import com.itac.util.logging.LogHandler;
|
||||
import com.itac.util.logging.LogLevel;
|
||||
|
||||
public class XmlSerializer {
|
||||
|
||||
private static final String INDEX = "index:";
|
||||
/** XML logging stuff */
|
||||
private static XMLEventFactory eventFactory = XMLEventFactory.newInstance();
|
||||
private static XMLOutputFactory factory = XMLOutputFactory.newInstance();
|
||||
/** max indent this number of levels */
|
||||
private static final int MAX_INDENT_LEVEL = 15;
|
||||
/** per level indent by this number of spaces */
|
||||
private static int indentationWidth = 2;
|
||||
/** fix array of predefined Strings, used for indenting at beginning of line */
|
||||
private static String[] indentStrings;
|
||||
/** */
|
||||
private static Set<Class<?>> objectClasses = new HashSet<>();
|
||||
/** */
|
||||
private static Set<String> includeTypeName = new HashSet<>();
|
||||
//
|
||||
|
||||
// alle Namen die hier drin sind werden explizit weggelassen
|
||||
public static final Set<String> excludeTypeName = new HashSet<>();
|
||||
|
||||
/** writer for xml-logging */
|
||||
private XMLEventWriter writer;
|
||||
/** writer for result or non-xml-logging */
|
||||
private StringWriter outWriter;
|
||||
|
||||
/** the current indentation level, values from 0..MAX_INDENTATION_LEVEL */
|
||||
private int indentationLevel = 0;
|
||||
/** result should contain private fields */
|
||||
private boolean serializePrivates = true;
|
||||
/** result should contain protected fields */
|
||||
private boolean serializeProtecteds = false;
|
||||
/** result should contain fieldname for values which are null */
|
||||
private boolean serializeNulls = false;
|
||||
/** result should be formatted */
|
||||
private boolean formatting = true; // Mehraufwand ca 10 %
|
||||
/** printing field types as attributes or additional text info */
|
||||
private boolean typeAttributes = false; // Mehraufwand ca 10 %
|
||||
/** Eine Moeglichkeit auch nicht-XML zu loggen */
|
||||
private boolean logXmlFormat = true;
|
||||
/** a default date format for logging */
|
||||
private SimpleDateFormat w3cDateFormat = (SimpleDateFormat) SimpleDateFormat.getInstance();
|
||||
|
||||
// initializing static StringList
|
||||
static {
|
||||
indentStrings = new String[MAX_INDENT_LEVEL];
|
||||
for (int level = 0; level < MAX_INDENT_LEVEL; level++) {
|
||||
StringBuilder indentBuffer = new StringBuilder();
|
||||
int count = level * indentationWidth;
|
||||
for (int i = 0; i < count; i++) {
|
||||
indentBuffer.append(' ');
|
||||
}
|
||||
indentStrings[level] = indentBuffer.toString();
|
||||
}
|
||||
// alle diese Klassen werden einfach per toString() ausgegeben
|
||||
objectClasses.add(String.class);
|
||||
objectClasses.add(Boolean.class);
|
||||
objectClasses.add(int.class);
|
||||
objectClasses.add(long.class);
|
||||
objectClasses.add(short.class);
|
||||
objectClasses.add(byte.class);
|
||||
objectClasses.add(Integer.class);
|
||||
objectClasses.add(Long.class);
|
||||
objectClasses.add(Short.class);
|
||||
objectClasses.add(Byte.class);
|
||||
objectClasses.add(double.class);
|
||||
objectClasses.add(float.class);
|
||||
objectClasses.add(Double.class);
|
||||
objectClasses.add(Float.class);
|
||||
objectClasses.add(char[].class);
|
||||
objectClasses.add(Character.class);
|
||||
|
||||
excludeTypeName.add("java.lang.");
|
||||
excludeTypeName.add("javax.");
|
||||
excludeTypeName.add("java.security.");
|
||||
excludeTypeName.add("com.sun.");
|
||||
excludeTypeName.add("java.io.");
|
||||
excludeTypeName.add("java.net.");
|
||||
excludeTypeName.add("java.util.");
|
||||
|
||||
includeTypeName.add("java.lang.String");
|
||||
includeTypeName.add("java.util.Date");
|
||||
includeTypeName.add("int");
|
||||
includeTypeName.add("long");
|
||||
includeTypeName.add("boolean");
|
||||
includeTypeName.add("char");
|
||||
includeTypeName.add("short");
|
||||
includeTypeName.add("double");
|
||||
includeTypeName.add("float");
|
||||
}
|
||||
|
||||
// privater Konstruktor
|
||||
public XmlSerializer() {
|
||||
super();
|
||||
w3cDateFormat.applyPattern("yyyy-MM-dd'T'HH:mm:ss.SSS");
|
||||
}
|
||||
|
||||
public XmlSerializer(boolean serializePrivates, boolean serializeProtecteds, boolean serializeNulls) {
|
||||
this();
|
||||
this.serializePrivates = serializePrivates;
|
||||
this.serializeProtecteds = serializeProtecteds;
|
||||
this.serializeNulls = serializeNulls;
|
||||
}
|
||||
|
||||
public synchronized Writer serialize(Object source) throws XMLStreamException, IllegalAccessException {
|
||||
outWriter = new StringWriter();
|
||||
if (logXmlFormat) {
|
||||
writer = factory.createXMLEventWriter(outWriter);
|
||||
}
|
||||
|
||||
outWriter.flush();
|
||||
if (source.getClass().isArray()) {
|
||||
writeArray("", source, 0);
|
||||
} else {
|
||||
writeStart(source.getClass().getSimpleName(), true);
|
||||
writeStructure(source, 0);
|
||||
writeEnd(source.getClass().getSimpleName(), true, true);
|
||||
}
|
||||
return outWriter;
|
||||
}
|
||||
|
||||
public void indent() {
|
||||
if (formatting) {
|
||||
indentationLevel += 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void unindent() {
|
||||
if (formatting && indentationLevel > 0) {
|
||||
indentationLevel -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void writeArray(String fieldName, Object fieldvalue, int level)
|
||||
throws XMLStreamException, IllegalAccessException {
|
||||
|
||||
if (fieldvalue != null && Array.getLength(fieldvalue) > 0) {
|
||||
// Feldnamen ausgeben
|
||||
if (!fieldName.equals("")) {
|
||||
writeStart(fieldName, true);
|
||||
writeTypeAttribute(fieldvalue.getClass().getSimpleName());
|
||||
}
|
||||
// bei Arrays immer die [] zeichen aus dem simpleClassName herausschneiden
|
||||
String simpleClassName = fieldvalue.getClass().getSimpleName().substring(0,
|
||||
fieldvalue.getClass().getSimpleName().length() - 2);
|
||||
|
||||
for (int i = 0; i < Array.getLength(fieldvalue); i++) {
|
||||
if (Array.get(fieldvalue, i) != null) {
|
||||
if (objectClasses.contains(Array.get(fieldvalue, i).getClass())) {
|
||||
// impliziter Typ
|
||||
writeStart(simpleClassName, false);
|
||||
writeText(Array.get(fieldvalue, i).toString());
|
||||
writeEnd(simpleClassName, false, false);
|
||||
} else {
|
||||
// expliziter Typ
|
||||
writeStart(simpleClassName, true);
|
||||
writeStructure(Array.get(fieldvalue, i), level);
|
||||
writeEnd(simpleClassName, true, false);
|
||||
}
|
||||
} else {
|
||||
// Element ist explizite und null
|
||||
writeStart(simpleClassName, false);
|
||||
writeEnd(simpleClassName, false, false);
|
||||
}
|
||||
}
|
||||
if (!fieldName.equals("")) {
|
||||
writeEnd(fieldName, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeList(String fieldName, Object fieldvalue, int level)
|
||||
throws XMLStreamException, IllegalAccessException {
|
||||
|
||||
List<?> listValue = (List<?>) fieldvalue;
|
||||
if (listValue != null && !listValue.isEmpty()) {
|
||||
|
||||
// Feldnamen ausgeben
|
||||
if (!fieldName.equals("")) {
|
||||
writeStart(fieldName, true);
|
||||
writeTypeAttribute(fieldvalue.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
// // bei Listen immer die [] zeichen aus dem simpleClassName herausschneiden
|
||||
|
||||
for (int i = 0; i < listValue.size(); i++) {
|
||||
if (listValue.get(i) != null) {
|
||||
if (objectClasses.contains(listValue.get(i).getClass())) {
|
||||
// impliziter Typ
|
||||
writeStart(INDEX + i, false);
|
||||
writeText(listValue.get(i).toString());
|
||||
writeEnd(INDEX + i, false, false);
|
||||
} else {
|
||||
// expliziter Typ
|
||||
writeStart(INDEX + i, true);
|
||||
writeStructure(listValue.get(i), level + 1);
|
||||
writeEnd(INDEX + i, true, false);
|
||||
}
|
||||
} else {
|
||||
// Element ist explizit und null
|
||||
writeStart(INDEX + i, false);
|
||||
writeEnd(INDEX + i, false, false);
|
||||
}
|
||||
}
|
||||
if (!fieldName.equals("")) {
|
||||
writeEnd(fieldName, true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fieldList
|
||||
* @param clazz
|
||||
*/
|
||||
protected void allClassFields(List<Field> fieldList, Class<?> clazz, Set<String> fieldsProcessedBefore) {
|
||||
// über alle Felder aller parent Interfaces, solange das Interface nicht Object ist.
|
||||
if (clazz == null || clazz == Object.class || clazz.isEnum()) {
|
||||
return;
|
||||
}
|
||||
// fields: all public fields
|
||||
Field[] fields = clazz.getFields();
|
||||
for (Field field : fields) {
|
||||
if ((field.getModifiers() & Modifier.STATIC) == Modifier.STATIC) {
|
||||
// keine statischen Felder
|
||||
continue;
|
||||
}
|
||||
if (!fieldsProcessedBefore.contains(field.getName())) {
|
||||
fieldList.add(field);
|
||||
// kein Feld mit diesem Namen nochmal ausgeben
|
||||
fieldsProcessedBefore.add(field.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (serializePrivates || serializeProtecteds) {
|
||||
fields = clazz.getDeclaredFields();
|
||||
for (Field field : fields) {
|
||||
if (fieldsProcessedBefore.contains(field.getName()) || field.getName().startsWith("$jacoco")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (((field.getModifiers() & Modifier.PROTECTED) == Modifier.PROTECTED && serializeProtecteds)
|
||||
|| ((field.getModifiers() & Modifier.PRIVATE) == Modifier.PRIVATE && serializePrivates)
|
||||
|| (field.getModifiers() == 0)) { // package visibility
|
||||
fieldList.add(field);
|
||||
fieldsProcessedBefore.add(field.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
allClassFields(fieldList, clazz.getSuperclass(), fieldsProcessedBefore);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param object
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalArgumentException
|
||||
* @throws XMLStreamException
|
||||
*/
|
||||
private void writeStructure(Object source, int level) throws IllegalAccessException, XMLStreamException {
|
||||
if (level > 20) {
|
||||
LogHandler.log(getClass().getSimpleName(), LogLevel.DEBUG, "reached max recursion depth of " + level);
|
||||
return;
|
||||
}
|
||||
if (source == null) {
|
||||
startLine();
|
||||
writeText("");
|
||||
return;
|
||||
}
|
||||
if (objectClasses.contains(source.getClass())) {
|
||||
startLine();
|
||||
writeText(source.toString());
|
||||
return;
|
||||
}
|
||||
|
||||
List<Field> fieldList = new ArrayList<>();
|
||||
Set<String> alreadyPrintedFields = new HashSet<>();
|
||||
allClassFields(fieldList, source.getClass(), alreadyPrintedFields);
|
||||
|
||||
for (Field field2 : fieldList) {
|
||||
field2.setAccessible(true);
|
||||
// keine transienten Felder printen
|
||||
if (Modifier.isTransient(field2.getModifiers())) {
|
||||
LogHandler.log(getClass().getSimpleName(), LogLevel.DEBUG, "skip transient field " + field2.getName());
|
||||
continue;
|
||||
}
|
||||
|
||||
String typeName = field2.getType().getName();
|
||||
// exludes and includes
|
||||
if (!shouldSkipField(typeName)) {
|
||||
Object fieldvalue = field2.get(source);
|
||||
writeObject(field2.getName(), fieldvalue, level + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param typeName
|
||||
* @return
|
||||
*/
|
||||
private boolean shouldSkipField(String typeName) {
|
||||
boolean skipField = false;
|
||||
for (String k : excludeTypeName) {
|
||||
if (typeName.startsWith(k)) {
|
||||
if (includeTypeName.contains(typeName)) {
|
||||
// if a type is included, but package is excluded keep the class to be printed
|
||||
continue;
|
||||
}
|
||||
skipField = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!includeTypeName.contains(typeName) && !(typeName.startsWith("com.itac.") || typeName.startsWith("[Lcom.itac."))) {
|
||||
skipField = true;
|
||||
}
|
||||
return skipField;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param fieldvalue
|
||||
* @throws XMLStreamException
|
||||
* @throws IllegalAccessException
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
private void writeObject(String fieldName, Object fieldvalue, int level)
|
||||
throws XMLStreamException, IllegalAccessException {
|
||||
if (level > 20) {
|
||||
LogHandler.log(getClass().getSimpleName(), LogLevel.DEBUG, "reached max recursion depth of " + level + " on field " + fieldName);
|
||||
return;
|
||||
}
|
||||
if (fieldvalue == null) {
|
||||
if (serializeNulls) {
|
||||
writeString(fieldName, "");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (objectClasses.contains(fieldvalue.getClass())) {
|
||||
writeString(fieldName, fieldvalue);
|
||||
} else if (fieldvalue.getClass() == Date.class) {
|
||||
writeDate(fieldName, (Date) fieldvalue);
|
||||
} else if (fieldvalue.getClass().isArray()) {
|
||||
writeArray(fieldName, fieldvalue, level + 1);
|
||||
} else if (fieldvalue instanceof List) {
|
||||
writeList(fieldName, fieldvalue, level + 1);
|
||||
} else if (fieldvalue.getClass().isEnum()) {
|
||||
writeString(fieldName, fieldvalue.toString());
|
||||
} else {
|
||||
// Strukturierten Wert schreiben
|
||||
writeStart(fieldName, true);
|
||||
writeStructure(fieldvalue, level + 1);
|
||||
writeEnd(fieldName, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
private void writeDate(String fieldName, Date fieldvalue) throws XMLStreamException {
|
||||
writeStart(fieldName, false);
|
||||
writeTypeAttribute(fieldvalue.getClass().getSimpleName());
|
||||
writeText(w3cDateFormat.format(fieldvalue));
|
||||
writeEnd(fieldName, false, false);
|
||||
}
|
||||
|
||||
private void writeString(String fieldName, Object fieldValue) throws XMLStreamException {
|
||||
writeStart(fieldName, false);
|
||||
writeTypeAttribute(fieldValue.getClass().getSimpleName());
|
||||
writeText(fieldValue.toString());
|
||||
writeEnd(fieldName, false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @throws XMLStreamException
|
||||
*/
|
||||
private void writeText(String stringValue) throws XMLStreamException {
|
||||
if (logXmlFormat) {
|
||||
writer.add(eventFactory.createCharacters(stringValue));
|
||||
} else {
|
||||
outWriter.append(stringValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param simpleName
|
||||
* @throws XMLStreamException
|
||||
*/
|
||||
private void writeTypeAttribute(String simpleName) throws XMLStreamException {
|
||||
if (typeAttributes) {
|
||||
if (logXmlFormat) {
|
||||
writer.add(eventFactory.createAttribute("type", simpleName));
|
||||
} else {
|
||||
outWriter.append("(").append(simpleName).append("): ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void writeStart(String fieldName, boolean endLineAndIndent) throws XMLStreamException {
|
||||
startLine();
|
||||
if (logXmlFormat) {
|
||||
writer.add(eventFactory.createStartElement("", "", fieldName));
|
||||
} else {
|
||||
outWriter.append(fieldName);
|
||||
outWriter.append(": ");
|
||||
}
|
||||
if (endLineAndIndent) {
|
||||
endLine();
|
||||
indent();
|
||||
}
|
||||
}
|
||||
|
||||
private void writeEnd(String fieldName, boolean indenting, boolean newLine) throws XMLStreamException {
|
||||
if (logXmlFormat) {
|
||||
if (indenting) {
|
||||
unindent();
|
||||
startLine();
|
||||
}
|
||||
writer.add(eventFactory.createEndElement("", "", fieldName));
|
||||
endLine();
|
||||
} else {
|
||||
if (indenting) {
|
||||
unindent();
|
||||
} else {
|
||||
endLine();
|
||||
}
|
||||
if (newLine) {
|
||||
endLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws XMLStreamException
|
||||
*
|
||||
*/
|
||||
private void endLine() throws XMLStreamException {
|
||||
if (formatting) {
|
||||
if (logXmlFormat) {
|
||||
writer.add(eventFactory.createIgnorableSpace("\n"));
|
||||
} else {
|
||||
outWriter.append('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws XMLStreamException
|
||||
*
|
||||
*/
|
||||
private void startLine() throws XMLStreamException {
|
||||
if (formatting) {
|
||||
if (logXmlFormat) {
|
||||
writer.add(eventFactory.createIgnorableSpace(indentStrings[Math.min(indentationLevel, MAX_INDENT_LEVEL - 1)]));
|
||||
} else {
|
||||
outWriter.append(indentStrings[Math.min(indentationLevel, MAX_INDENT_LEVEL - 1)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) 2016 iTAC Software AG, Germany. All Rights Reserved.
|
||||
*
|
||||
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
|
||||
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
|
||||
* without the written permission of iTAC Software AG.
|
||||
*/
|
||||
|
||||
package com.itac.mes.datainterface.data.xml;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.itac.util.constants.imsapi.ImsApiKey;
|
||||
|
||||
/**
|
||||
* @author frankp
|
||||
*
|
||||
*/
|
||||
public class KeyValuePrinterTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
KeyValuePrinter testee= new KeyValuePrinter();
|
||||
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
PrintStream ps = new PrintStream(baos);
|
||||
|
||||
PrintWriter pw= new PrintWriter(ps);
|
||||
|
||||
|
||||
ImsApiKey[] keys = new ImsApiKey[]{ImsApiKey.WORKORDER_NUMBER, ImsApiKey.SERIAL_NUMBER, ImsApiKey.ACTIVATE_FLAG};
|
||||
|
||||
Object testobject = new StringBuilder();
|
||||
String[] values = new String[]{"wo1", "sn1","0","wo2", "sn2","1" } ;
|
||||
testee.print(pw, testobject, "fieldName", keys , values );
|
||||
|
||||
pw.flush();
|
||||
|
||||
System.out.println( new String(baos.toByteArray()) );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (c) 2016 iTAC Software AG, Germany. All Rights Reserved.
|
||||
*
|
||||
* This software is protected by copyright. Under no circumstances may any part of this file in any form be copied,
|
||||
* printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language
|
||||
* without the written permission of iTAC Software AG.
|
||||
*/
|
||||
package com.itac.mes.datainterface.data.xml;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.itac.util.logging.LogHandler;
|
||||
import com.itac.util.logging.LogLevel;
|
||||
|
||||
public class XmlSerializerTest {
|
||||
|
||||
class TestType {
|
||||
public TestType(String x, int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public String x;
|
||||
public int y;
|
||||
}
|
||||
|
||||
class TestStructure extends TestStructureBase {
|
||||
private static final int staticNumber = 99;
|
||||
|
||||
public int publicIntField;
|
||||
public String publicStringField = "pubString";
|
||||
|
||||
private String testField = "leerwert";
|
||||
private String testFieldNull;
|
||||
private int testInt;
|
||||
protected String testFieldProtected = "protected";
|
||||
protected String testFieldProtectedNull;
|
||||
private String[] nullArray;
|
||||
private String[] emptyArray = new String[0];
|
||||
private String[] simpleArray = new String[] { "ok" };
|
||||
private String[] complexArray = new String[] { null, "ok" };
|
||||
private int[] intArray = new int[] { 3, 5 };
|
||||
}
|
||||
|
||||
class TestStructureBase {
|
||||
private static final int staticNumber = 22;
|
||||
public int inheritedPublicIntField;
|
||||
public String inheritedPublicStringField;
|
||||
|
||||
private int inheritedInt;
|
||||
private int inheritedString;
|
||||
private boolean[] inheritedBooleanArray = new boolean[] { true, true, false };
|
||||
private TestType[] testType = new TestType[] { new TestType("x1", 1), null, new TestType("x2", 2) };
|
||||
}
|
||||
|
||||
class DateTestStructure {
|
||||
public Date date;
|
||||
private Date privateDate;
|
||||
Date packageDate;
|
||||
}
|
||||
|
||||
class TestListStructure {
|
||||
private List<String> simpleList = new ArrayList<String>();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testSerializePrivates() throws IllegalArgumentException, XMLStreamException, IllegalAccessException {
|
||||
XmlSerializer serializer = new XmlSerializer(true, true, false);
|
||||
TestStructure t = new TestStructure();
|
||||
LogHandler.log(getClass().getSimpleName(), LogLevel.DEBUG, serializer.serialize(t).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSerializePrivateList() throws IllegalArgumentException, XMLStreamException, IllegalAccessException {
|
||||
XmlSerializer serializer = new XmlSerializer(true, true, false);
|
||||
TestListStructure t = new TestListStructure();
|
||||
t.simpleList.add("a1");
|
||||
t.simpleList.add(null);
|
||||
t.simpleList.add("a2");
|
||||
LogHandler.log(getClass().getSimpleName(), LogLevel.DEBUG, serializer.serialize(t).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFieldEnumerator() throws IllegalArgumentException, XMLStreamException, IllegalAccessException {
|
||||
XmlSerializer serializer = new XmlSerializer(true, true, false);
|
||||
TestStructure t = new TestStructure();
|
||||
|
||||
Class<?> clazz = TestStructure.class;
|
||||
Set<String> fieldsProcessedBefore = new HashSet<String>();
|
||||
List<Field> fieldList = new ArrayList<Field>();
|
||||
serializer.allClassFields(fieldList, clazz, fieldsProcessedBefore);
|
||||
|
||||
for (Field item : fieldList) {
|
||||
LogHandler.log(getClass().getSimpleName(), LogLevel.DEBUG, "" + item.getName());
|
||||
}
|
||||
|
||||
assertEquals(19, fieldList.size());
|
||||
LogHandler.log(getClass().getSimpleName(), LogLevel.DEBUG, serializer.serialize(t).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDatePrint() throws IllegalArgumentException, XMLStreamException, IllegalAccessException {
|
||||
XmlSerializer serializer = new XmlSerializer(true, true, true);
|
||||
DateTestStructure t = new DateTestStructure();
|
||||
t.date = new Date();
|
||||
t.privateDate = t.date;
|
||||
t.packageDate = t.date;
|
||||
LogHandler.log(getClass().getSimpleName(), LogLevel.DEBUG, serializer.serialize(t).toString());
|
||||
}
|
||||
}
|
||||
5
interface/util/target/classes/META-INF/MANIFEST.MF
Normal file
5
interface/util/target/classes/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,5 @@
|
||||
Manifest-Version: 1.0
|
||||
Built-By: frankp
|
||||
Build-Jdk: 1.8.0_111
|
||||
Created-By: Maven Integration for Eclipse
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#Generated by Maven Integration for Eclipse
|
||||
#Tue Oct 13 14:05:19 CEST 2020
|
||||
version=9.10.00beta-DEVELOPER
|
||||
groupId=com.itac.interface.interfaces
|
||||
m2e.projectName=imsinterfaces-util
|
||||
m2e.projectLocation=C\:\\projects_jee\\imsinterface\\mainline\\interface\\util
|
||||
artifactId=imsinterfaces-util
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.itac.interface.interfaces</groupId>
|
||||
<artifactId>imsinterfaces-util</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>imsinterfaces-util</name>
|
||||
<version>${mes.interface.version}</version>
|
||||
<parent>
|
||||
<groupId>com.itac.interface</groupId>
|
||||
<artifactId>data-interface</artifactId>
|
||||
<version>${mes.interface.version}</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.itac.product</groupId>
|
||||
<artifactId>imsapi-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5
interface/util/target/maven-archiver/pom.properties
Normal file
5
interface/util/target/maven-archiver/pom.properties
Normal file
@@ -0,0 +1,5 @@
|
||||
#Generated by Maven
|
||||
#Tue Jun 12 15:09:29 CEST 2018
|
||||
version=9.00.01alpha-DEVELOPER
|
||||
groupId=com.itac.interface.interfaces
|
||||
artifactId=imsinterfaces-util
|
||||
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<testsuite tests="1" failures="0" name="com.itac.mes.datainterface.data.xml.KeyValuePrinterTest" time="0.157" errors="0" skipped="0">
|
||||
<properties>
|
||||
<property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
|
||||
<property name="sun.boot.library.path" value="C:\Program Files\Java\jdk1.8.0_111\jre\bin"/>
|
||||
<property name="java.vm.version" value="25.111-b14"/>
|
||||
<property name="java.vm.vendor" value="Oracle Corporation"/>
|
||||
<property name="maven.multiModuleProjectDirectory" value="C:\projects_jee\imsinterface\mainline"/>
|
||||
<property name="java.vendor.url" value="http://java.oracle.com/"/>
|
||||
<property name="path.separator" value=";"/>
|
||||
<property name="guice.disable.misplaced.annotation.check" value="true"/>
|
||||
<property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/>
|
||||
<property name="file.encoding.pkg" value="sun.io"/>
|
||||
<property name="user.script" value=""/>
|
||||
<property name="user.country" value="DE"/>
|
||||
<property name="sun.java.launcher" value="SUN_STANDARD"/>
|
||||
<property name="sun.os.patch.level" value=""/>
|
||||
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
|
||||
<property name="user.dir" value="C:\projects_jee\imsinterface\mainline"/>
|
||||
<property name="java.runtime.version" value="1.8.0_111-b14"/>
|
||||
<property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment"/>
|
||||
<property name="java.endorsed.dirs" value="C:\Program Files\Java\jdk1.8.0_111\jre\lib\endorsed"/>
|
||||
<property name="os.arch" value="amd64"/>
|
||||
<property name="java.io.tmpdir" value="C:\Users\frankp\AppData\Local\Temp\"/>
|
||||
<property name="line.separator" value="
|
||||
"/>
|
||||
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
|
||||
<property name="user.variant" value=""/>
|
||||
<property name="os.name" value="Windows 10"/>
|
||||
<property name="classworlds.conf" value="C:\maven\apache-maven-3.3.3\bin\..\bin\m2.conf"/>
|
||||
<property name="sun.jnu.encoding" value="Cp1252"/>
|
||||
<property name="java.library.path" value="C:\Program Files\Java\jdk1.8.0_111\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\MKS\IntegrityClient\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\MKS\Toolkit\mksnt;%USERPROFILE%\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\maven\maven;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\frankp\AppData\Local\Microsoft\WindowsApps;C:\Users\frankp\AppData\Roaming\npm;c:\Program Files\nodejs\;."/>
|
||||
<property name="java.specification.name" value="Java Platform API Specification"/>
|
||||
<property name="java.class.version" value="52.0"/>
|
||||
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
|
||||
<property name="os.version" value="10.0"/>
|
||||
<property name="user.home" value="C:\Users\frankp"/>
|
||||
<property name="user.timezone" value="Europe/Berlin"/>
|
||||
<property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob"/>
|
||||
<property name="java.specification.version" value="1.8"/>
|
||||
<property name="file.encoding" value="Cp1252"/>
|
||||
<property name="user.name" value="frankp"/>
|
||||
<property name="java.class.path" value="C:\maven\apache-maven-3.3.3\bin\..\boot\plexus-classworlds-2.5.2.jar"/>
|
||||
<property name="java.vm.specification.version" value="1.8"/>
|
||||
<property name="sun.arch.data.model" value="64"/>
|
||||
<property name="java.home" value="C:\Program Files\Java\jdk1.8.0_111\jre"/>
|
||||
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher clean install"/>
|
||||
<property name="java.specification.vendor" value="Oracle Corporation"/>
|
||||
<property name="user.language" value="de"/>
|
||||
<property name="awt.toolkit" value="sun.awt.windows.WToolkit"/>
|
||||
<property name="java.vm.info" value="mixed mode"/>
|
||||
<property name="java.version" value="1.8.0_111"/>
|
||||
<property name="java.ext.dirs" value="C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext"/>
|
||||
<property name="sun.boot.class.path" value="C:\Program Files\Java\jdk1.8.0_111\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_111\jre\classes"/>
|
||||
<property name="sun.stderr.encoding" value="cp850"/>
|
||||
<property name="java.vendor" value="Oracle Corporation"/>
|
||||
<property name="maven.home" value="C:\maven\apache-maven-3.3.3\bin\.."/>
|
||||
<property name="file.separator" value="\"/>
|
||||
<property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/"/>
|
||||
<property name="sun.cpu.endian" value="little"/>
|
||||
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
|
||||
<property name="sun.desktop" value="windows"/>
|
||||
<property name="sun.cpu.isalist" value="amd64"/>
|
||||
</properties>
|
||||
<testcase classname="com.itac.mes.datainterface.data.xml.KeyValuePrinterTest" name="test" time="0.157"/>
|
||||
</testsuite>
|
||||
@@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<testsuite tests="4" failures="0" name="com.itac.mes.datainterface.data.xml.XmlSerializerTest" time="0.312" errors="0" skipped="1">
|
||||
<properties>
|
||||
<property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
|
||||
<property name="sun.boot.library.path" value="C:\Program Files\Java\jdk1.8.0_111\jre\bin"/>
|
||||
<property name="java.vm.version" value="25.111-b14"/>
|
||||
<property name="java.vm.vendor" value="Oracle Corporation"/>
|
||||
<property name="maven.multiModuleProjectDirectory" value="C:\projects_jee\imsinterface\mainline"/>
|
||||
<property name="java.vendor.url" value="http://java.oracle.com/"/>
|
||||
<property name="path.separator" value=";"/>
|
||||
<property name="guice.disable.misplaced.annotation.check" value="true"/>
|
||||
<property name="java.vm.name" value="Java HotSpot(TM) 64-Bit Server VM"/>
|
||||
<property name="file.encoding.pkg" value="sun.io"/>
|
||||
<property name="user.script" value=""/>
|
||||
<property name="user.country" value="DE"/>
|
||||
<property name="sun.java.launcher" value="SUN_STANDARD"/>
|
||||
<property name="sun.os.patch.level" value=""/>
|
||||
<property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
|
||||
<property name="user.dir" value="C:\projects_jee\imsinterface\mainline"/>
|
||||
<property name="java.runtime.version" value="1.8.0_111-b14"/>
|
||||
<property name="java.awt.graphicsenv" value="sun.awt.Win32GraphicsEnvironment"/>
|
||||
<property name="java.endorsed.dirs" value="C:\Program Files\Java\jdk1.8.0_111\jre\lib\endorsed"/>
|
||||
<property name="os.arch" value="amd64"/>
|
||||
<property name="java.io.tmpdir" value="C:\Users\frankp\AppData\Local\Temp\"/>
|
||||
<property name="line.separator" value="
|
||||
"/>
|
||||
<property name="java.vm.specification.vendor" value="Oracle Corporation"/>
|
||||
<property name="user.variant" value=""/>
|
||||
<property name="os.name" value="Windows 10"/>
|
||||
<property name="classworlds.conf" value="C:\maven\apache-maven-3.3.3\bin\..\bin\m2.conf"/>
|
||||
<property name="sun.jnu.encoding" value="Cp1252"/>
|
||||
<property name="java.library.path" value="C:\Program Files\Java\jdk1.8.0_111\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files (x86)\MKS\IntegrityClient\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\MKS\Toolkit\mksnt;%USERPROFILE%\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Common Files\Acronis\SnapAPI\;C:\maven\maven;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\frankp\AppData\Local\Microsoft\WindowsApps;C:\Users\frankp\AppData\Roaming\npm;c:\Program Files\nodejs\;."/>
|
||||
<property name="java.specification.name" value="Java Platform API Specification"/>
|
||||
<property name="java.class.version" value="52.0"/>
|
||||
<property name="sun.management.compiler" value="HotSpot 64-Bit Tiered Compilers"/>
|
||||
<property name="os.version" value="10.0"/>
|
||||
<property name="user.home" value="C:\Users\frankp"/>
|
||||
<property name="user.timezone" value="Europe/Berlin"/>
|
||||
<property name="java.awt.printerjob" value="sun.awt.windows.WPrinterJob"/>
|
||||
<property name="java.specification.version" value="1.8"/>
|
||||
<property name="file.encoding" value="Cp1252"/>
|
||||
<property name="user.name" value="frankp"/>
|
||||
<property name="java.class.path" value="C:\maven\apache-maven-3.3.3\bin\..\boot\plexus-classworlds-2.5.2.jar"/>
|
||||
<property name="java.vm.specification.version" value="1.8"/>
|
||||
<property name="sun.arch.data.model" value="64"/>
|
||||
<property name="java.home" value="C:\Program Files\Java\jdk1.8.0_111\jre"/>
|
||||
<property name="sun.java.command" value="org.codehaus.plexus.classworlds.launcher.Launcher clean install"/>
|
||||
<property name="java.specification.vendor" value="Oracle Corporation"/>
|
||||
<property name="user.language" value="de"/>
|
||||
<property name="awt.toolkit" value="sun.awt.windows.WToolkit"/>
|
||||
<property name="java.vm.info" value="mixed mode"/>
|
||||
<property name="java.version" value="1.8.0_111"/>
|
||||
<property name="java.ext.dirs" value="C:\Program Files\Java\jdk1.8.0_111\jre\lib\ext;C:\WINDOWS\Sun\Java\lib\ext"/>
|
||||
<property name="sun.boot.class.path" value="C:\Program Files\Java\jdk1.8.0_111\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\sunrsasign.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_111\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_111\jre\classes"/>
|
||||
<property name="sun.stderr.encoding" value="cp850"/>
|
||||
<property name="java.vendor" value="Oracle Corporation"/>
|
||||
<property name="maven.home" value="C:\maven\apache-maven-3.3.3\bin\.."/>
|
||||
<property name="file.separator" value="\"/>
|
||||
<property name="java.vendor.url.bug" value="http://bugreport.sun.com/bugreport/"/>
|
||||
<property name="sun.cpu.endian" value="little"/>
|
||||
<property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
|
||||
<property name="sun.desktop" value="windows"/>
|
||||
<property name="sun.cpu.isalist" value="amd64"/>
|
||||
</properties>
|
||||
<testcase classname="com.itac.mes.datainterface.data.xml.XmlSerializerTest" name="testDatePrint" time="0.14"/>
|
||||
<testcase classname="com.itac.mes.datainterface.data.xml.XmlSerializerTest" name="testSerializePrivates" time="0.14">
|
||||
<skipped/>
|
||||
</testcase>
|
||||
<testcase classname="com.itac.mes.datainterface.data.xml.XmlSerializerTest" name="testSerializePrivateList" time="0"/>
|
||||
<testcase classname="com.itac.mes.datainterface.data.xml.XmlSerializerTest" name="testFieldEnumerator" time="0.032"/>
|
||||
</testsuite>
|
||||
@@ -0,0 +1,4 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Test set: com.itac.mes.datainterface.data.xml.KeyValuePrinterTest
|
||||
-------------------------------------------------------------------------------
|
||||
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.266 sec
|
||||
@@ -0,0 +1,4 @@
|
||||
-------------------------------------------------------------------------------
|
||||
Test set: com.itac.mes.datainterface.data.xml.XmlSerializerTest
|
||||
-------------------------------------------------------------------------------
|
||||
Tests run: 4, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.297 sec
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user