=> START TAG
- ended = true;
- result = new XMLTag(nameBuffer, TagType.START, attributesBuffer);
- this.nextEvent = event;
- break;
- case XMLEvent.CHARACTERS:
- // START_ELEMENT(X) + CHARACTERS(C1) +
- // CHARACTERS(C2)=> ...
- contentBuffer.append(event.asCharacters().getData());
- break;
- case XMLEvent.END_ELEMENT:
- // START_ELEMENT(X) + CHARACTERS(C) +
- // END_ELEMENT(X) => C
- // => CONTENT TAG
- ended = true;
- result = new XMLTag(nameBuffer, TagType.CONTENT, attributesBuffer);
- result.setContent(contentBuffer.toString());
- break;
- default:
- throw new XMLBadFormatException("Unexpected XMLEvent [" + event.getEventType() + "].");
- }
- break;
- default:
- throw new XMLBadFormatException("Unexpected level [" + level + "].");
- }
- }
- }
-
- logger.debug("=> " + XMLTools.toString(result));
-
- //
- return result;
- }
-
- /**
- *
- * @param label
- * @return
- * @throws XMLStreamException
- * @throws XMLBadFormatException
- */
- public XMLTag readXMLFooter() throws XMLStreamException, XMLBadFormatException
- {
- XMLTag result;
-
- //
- result = readTag();
-
- //
- if (result == null)
- {
- throw new XMLBadFormatException("XML file ends prematurely, end document event is expected.");
- }
- else if (result.getType() != TagType.FOOTER)
- {
- throw new XMLBadFormatException("End document tag is missing.");
- }
-
- //
- return result;
- }
-
- /**
- *
- * @return
- * @throws XMLException
- * @throws XMLStreamException
- * @throws XMLBadFormatException
- */
- public XMLTag readXMLHeader() throws XMLStreamException, XMLBadFormatException
- {
- XMLTag result;
-
- //
- result = readTag();
-
- //
- if (result == null)
- {
- throw new XMLBadFormatException("XML file ends prematurely, start document event is expected.");
- }
- else if (result.getType() != TagType.HEADER)
- {
- throw new XMLBadFormatException("XML header is missing.");
- }
-
- //
- return result;
- }
-
- /**
- *
- * @param args
- * @throws Exception
- */
- public static void main(final String args[]) throws Exception
- {
-
- XMLInputFactory factory = XMLInputFactory.newInstance();
- XMLEventReader in = factory.createXMLEventReader(new FileReader("/home/cpm/C/Puck/Dev/Puck/test/TT/t3.puc"));
-
- XMLEvent event;
- while (in.hasNext())
- {
- event = in.nextEvent();
-
- switch (event.getEventType())
- {
- case XMLEvent.ATTRIBUTE:
- System.out.println("ATTRIBUTE ");
- break;
- case XMLEvent.CDATA:
- System.out.println("CDATA");
- break;
- case XMLEvent.CHARACTERS:
- System.out.println("CHARACTERS [" + event.asCharacters().getData() + "]");
- break;
- case XMLEvent.COMMENT:
- System.out.println("COMMENT");
- break;
- case XMLEvent.DTD:
- System.out.println("DTD");
- break;
- case XMLEvent.END_DOCUMENT:
- System.out.println("END_DOCUMENT");
- break;
- case XMLEvent.END_ELEMENT:
- System.out.println("END_ELEMENT " + event.asEndElement().getName());
- break;
- case XMLEvent.ENTITY_DECLARATION:
- System.out.println("ENTITY_DECLARATION");
- break;
- case XMLEvent.ENTITY_REFERENCE:
- System.out.println("ENTITY_REFERENCE");
- break;
- case XMLEvent.NAMESPACE:
- System.out.println("NAMESPACE");
- break;
- case XMLEvent.NOTATION_DECLARATION:
- System.out.println("NOTATION_DECLARATION");
- break;
- case XMLEvent.PROCESSING_INSTRUCTION:
- System.out.println("PROCESSING_INSTRUCTION");
- break;
- case XMLEvent.SPACE:
- System.out.println("SPACE");
- break;
- case XMLEvent.START_DOCUMENT:
- System.out.println("START_DOCUMENT");
- break;
- case XMLEvent.START_ELEMENT:
- System.out.println("START_ELEMENT [name=" + event.asStartElement().getName() + "][namespaceURI=" + event.asStartElement().getName().getNamespaceURI() + "][prefix="
- + event.asStartElement().getName().getPrefix() + "][localPart=" + event.asStartElement().getName().getLocalPart() + "]");
- break;
- default:
- System.out.println("DEFAULT");
- }
- }
- }
-}
diff --git a/src/fr/devinsy/util/xml/XMLTag.java b/src/fr/devinsy/util/xml/XMLTag.java
deleted file mode 100644
index 806f754..0000000
--- a/src/fr/devinsy/util/xml/XMLTag.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
- *
- * This file is part of Devinsy-utils.
- *
- * Devinsy-utils is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Devinsy-utils is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Devinsy-utils. If not, see
- */
-package fr.devinsy.util.xml;
-
-import javax.xml.namespace.QName;
-
-/**
- *
- * @author Christian Pierre MOMON (christian.momon@devinsy.fr)
- */
-public class XMLTag
-{
-
- public enum TagType
- {
- HEADER, START, END, EMPTY, CONTENT, FOOTER
- }
-
- private QName name;
- private TagType type;
- private XMLAttributes attributes;
- private String content;
-
- /**
- *
- */
- public XMLTag(final QName name, final TagType type, final XMLAttributes attributes)
- {
- this.name = name;
- this.type = type;
- this.attributes = attributes;
- this.content = null;
- }
-
- public XMLAttributes attributes()
- {
- return this.attributes;
- }
-
- public String getContent()
- {
- return this.content;
- }
-
- /**
- *
- * @return
- */
- public String getLabel()
- {
- String result;
-
- if (this.name == null)
- {
- result = "";
- }
- else
- {
- result = this.name.getLocalPart();
- }
-
- //
- return result;
- }
-
- public QName getName()
- {
- return this.name;
- }
-
- /**
- *
- * @return
- */
- public String getNamespaceURI()
- {
- String result;
-
- if (this.name == null)
- {
- result = "";
- }
- else
- {
- result = this.name.getNamespaceURI();
- }
-
- //
- return result;
- }
-
- /**
- *
- * @return
- */
- public String getPrefix()
- {
- String result;
-
- if (this.name == null)
- {
- result = "";
- }
- else
- {
- result = this.name.getPrefix();
- }
-
- //
- return result;
- }
-
- public TagType getType()
- {
- return this.type;
- }
-
- public void setContent(final String content)
- {
- this.content = content;
- }
-
- public void setName(final QName name)
- {
- this.name = name;
- }
-
- public void setType(final TagType type)
- {
- this.type = type;
- }
-}
diff --git a/src/fr/devinsy/util/xml/XMLTools.java b/src/fr/devinsy/util/xml/XMLTools.java
deleted file mode 100644
index a7de117..0000000
--- a/src/fr/devinsy/util/xml/XMLTools.java
+++ /dev/null
@@ -1,389 +0,0 @@
-/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
- *
- * This file is part of Devinsy-utils.
- *
- * Devinsy-utils is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Devinsy-utils is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Devinsy-utils. If not, see
- */
-package fr.devinsy.util.xml;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.zip.ZipInputStream;
-
-import javax.xml.stream.events.XMLEvent;
-import javax.xml.transform.sax.SAXSource;
-import javax.xml.transform.stream.StreamSource;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
-
-import org.apache.commons.lang3.StringEscapeUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- *
- * @author Christian Pierre MOMON (christian.momon@devinsy.fr)
- */
-public class XMLTools
-{
- /**
- *
- * @param source
- * @return
- */
- public static String escapeXmlBlank(final String source)
- {
- String result;
-
- if (StringUtils.isBlank(source))
- {
- result = "";
- }
- else
- {
- result = StringEscapeUtils.escapeXml(source);
- }
-
- //
- return result;
- }
-
- /**
- *
- *
- * @param source
- * @throws SAXException
- * @throws IOException
- * @throws PuckException
- */
- public static boolean isValid(final File xmlFile, final File xsdFile) throws SAXException, IOException
- {
- boolean result;
-
- //
- InputStream xmlSource;
- if (isZipFile(xmlFile))
- {
- ZipInputStream zin = new ZipInputStream(new FileInputStream(xmlFile));
- zin.getNextEntry();
- xmlSource = zin;
- }
- else
- {
- xmlSource = new FileInputStream(xmlFile);
- }
-
- //
- result = isValid(xmlSource, new FileInputStream(xsdFile));
-
- //
- return result;
- }
-
- /**
- *
- *
- * @param source
- * @throws SAXException
- * @throws IOException
- * @throws PuckException
- */
- public static boolean isValid(final File xmlFile, final InputStream xsdSource) throws SAXException, IOException
- {
- boolean result;
-
- //
- InputStream xmlSource;
- if (isZipFile(xmlFile))
- {
- ZipInputStream zin = new ZipInputStream(new FileInputStream(xmlFile));
- zin.getNextEntry();
- xmlSource = zin;
- }
- else
- {
- xmlSource = new FileInputStream(xmlFile);
- }
-
- //
- result = isValid(xmlSource, xsdSource);
-
- //
- return result;
- }
-
- /**
- *
- *
- * @param source
- * @throws SAXException
- * @throws IOException
- * @throws PuckException
- */
- public static boolean isValid(final InputStream xmlSource, final InputStream xsdSource) throws SAXException, IOException
- {
- boolean result;
-
- if (xmlSource == null)
- {
- result = false;
- }
- else
- {
- try
- {
- //
- SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
- InputSource sourceentree = new InputSource(xsdSource);
- SAXSource sourceXSD = new SAXSource(sourceentree);
- Schema schema = factory.newSchema(sourceXSD);
- Validator validator = schema.newValidator();
-
- //
- validator.validate(new StreamSource(xmlSource));
- result = true;
-
- }
- catch (final IllegalArgumentException exception)
- {
- exception.printStackTrace();
- result = false;
- }
- }
-
- //
- return result;
- }
-
- /**
- *
- * @param file
- * @return
- * @throws IOException
- */
- public static boolean isZipFile(final File file) throws IOException
- {
- boolean result;
-
- //
- byte[] buffer = new byte[4];
- FileInputStream is = null;
- try
- {
- is = new FileInputStream(file);
- is.read(buffer);
- }
- finally
- {
- if (is != null)
- {
- is.close();
- }
- }
-
- // 50 4B 3 4
- if ((buffer[0] == 0x50) && (buffer[1] == 0x4B) && (buffer[2] == 0x03) && (buffer[3] == 0x04))
- {
- result = true;
- }
- else
- {
- result = false;
- }
-
- //
- return result;
- }
-
- /**
- *
- */
- public static String readTag(final BufferedReader in) throws Exception
- {
- String result;
-
- Pattern TAG_PATTERN = Pattern.compile("^<([\\w-_\\.]+)>.*([\\w-_\\.]+)>$");
- Pattern SHORT_TAG_PATTERN = Pattern.compile("^<.+/>$");
-
- result = in.readLine();
- boolean ended = false;
- while (!ended)
- {
- /*
- * DEBUG Matcher tagMatcher2 = TAG_PATTERN.matcher(result); if
- * (tagMatcher2.find()) { logger.info("group count,0,1,2 = [" +
- * tagMatcher2.groupCount() + "][" + tagMatcher2.group(0) + "][" +
- * tagMatcher2.group(1) + "][" + tagMatcher2.group(2) + "]"); }
- */
-
- Matcher tagMatcher = TAG_PATTERN.matcher(result);
- Matcher shortTagMatcher = SHORT_TAG_PATTERN.matcher(result);
-
- if ((tagMatcher.find()) && (tagMatcher.groupCount() == 2) && (tagMatcher.group(1).equals(tagMatcher.group(2))))
- {
- ended = true;
- }
- else if (shortTagMatcher.matches())
- {
- ended = true;
- }
- else
- {
- result += in.readLine();
- }
- }
-
- //
- return (result);
- }
-
- /**
- *
- * @param source
- * @return
- */
- public static String toHTLM5(final String source)
- {
- String result;
-
- if (StringUtils.isBlank(source))
- {
- result = "";
- }
- else
- {
- result = source.replace(" ", " ");
- }
-
- //
- return result;
- }
-
- /**
- *
- * @param value
- * @return
- */
- public static String toString(final XMLEvent source)
- {
- String result;
-
- switch (source.getEventType())
- {
- case XMLEvent.ATTRIBUTE:
- result = "ATTRIBUTE ";
- break;
- case XMLEvent.CDATA:
- result = "CDATA";
- break;
- case XMLEvent.CHARACTERS:
- result = "CHARACTERS [" + source.asCharacters().getData() + "]";
- break;
- case XMLEvent.COMMENT:
- result = "COMMENT";
- break;
- case XMLEvent.DTD:
- result = "DTD";
- break;
- case XMLEvent.END_DOCUMENT:
- result = "END_DOCUMENT";
- break;
- case XMLEvent.END_ELEMENT:
- result = "END_ELEMENT " + source.asEndElement().getName();
- break;
- case XMLEvent.ENTITY_DECLARATION:
- result = "ENTITY_DECLARATION";
- break;
- case XMLEvent.ENTITY_REFERENCE:
- result = "ENTITY_REFERENCE";
- break;
- case XMLEvent.NAMESPACE:
- result = "NAMESPACE";
- break;
- case XMLEvent.NOTATION_DECLARATION:
- result = "NOTATION_DECLARATION";
- break;
- case XMLEvent.PROCESSING_INSTRUCTION:
- result = "PROCESSING_INSTRUCTION";
- break;
- case XMLEvent.SPACE:
- result = "SPACE";
- break;
- case XMLEvent.START_DOCUMENT:
- result = "START_DOCUMENT";
- break;
- case XMLEvent.START_ELEMENT:
- result = "START_ELEMENT [name=" + source.asStartElement().getName() + "][namespaceURI=" + source.asStartElement().getName().getNamespaceURI() + "][prefix="
- + source.asStartElement().getName().getPrefix() + "][localPart=" + source.asStartElement().getName().getLocalPart() + "]";
- break;
- default:
- result = null;
- }
-
- //
- return result;
- }
-
- /**
- *
- * @param event
- * @return
- */
- public static String toString(final XMLTag source)
- {
- String result;
-
- if (source == null)
- {
- result = "null";
- }
- else
- {
- result = "[label=" + source.getLabel() + "][type=" + source.getType().toString() + "][content=" + source.getContent() + "]";
- }
-
- //
- return result;
- }
-
- /**
- *
- * @param source
- * @return
- */
- public static String unescapeXmlBlank(final String source)
- {
- String result;
-
- if (StringUtils.isBlank(source))
- {
- result = null;
- }
- else
- {
- result = StringEscapeUtils.unescapeXml(source);
- }
-
- //
- return result;
- }
-}
diff --git a/src/fr/devinsy/util/xml/XMLWriter.java b/src/fr/devinsy/util/xml/XMLWriter.java
deleted file mode 100644
index d5b41ec..0000000
--- a/src/fr/devinsy/util/xml/XMLWriter.java
+++ /dev/null
@@ -1,315 +0,0 @@
-/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
- *
- * This file is part of Devinsy-utils.
- *
- * Devinsy-utils is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Devinsy-utils is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Devinsy-utils. If not, see
- */
-package fr.devinsy.util.xml;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-import java.io.Writer;
-
-import org.apache.commons.lang3.ArrayUtils;
-
-/**
- *
- * @author Christian Pierre MOMON (christian.momon@devinsy.fr)
- */
-public class XMLWriter
-{
-
- protected PrintWriter out;
-
- /**
- * Default constructor (useful for extend this class).
- */
- protected XMLWriter()
- {
- this.out = null;
- }
-
- /**
- * Initialize a XML Writer to a file.
- *
- * @param file
- * Where write the XML data.
- *
- * @throws FileNotFoundException
- * @throws UnsupportedEncodingException
- */
- public XMLWriter(final File file) throws UnsupportedEncodingException, FileNotFoundException
- {
- this.out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8"));
- }
-
- /**
- * Initialize a XML Writer to a OutputStream
.
- *
- * @param target
- * Where write the XML data.
- *
- * @throws UnsupportedEncodingException
- */
- public XMLWriter(final OutputStream target) throws UnsupportedEncodingException
- {
- this.out = new PrintWriter(new OutputStreamWriter(target, "UTF-8"));
- }
-
- /**
- * Initialize a XML Writer to a Writer
.
- *
- * @param target
- * Where write the XML data.
- *
- * @throws UnsupportedEncodingException
- */
- public XMLWriter(final Writer target) throws UnsupportedEncodingException
- {
- this.out = new PrintWriter(target);
- }
-
- /**
- * This method closes the target stream.
- */
- public void close() throws IOException
- {
- if (this.out != null)
- {
- this.out.flush();
- this.out.close();
- }
- }
-
- /**
- * This method flushes the target stream.
- */
- public void flush() throws IOException
- {
- if (this.out != null)
- {
- this.out.flush();
- }
- }
-
- /**
- * This method writes a XML comment.
- *
- * @param comment
- * The comment to write.
- */
- public void writeComment(final String comment)
- {
- this.out.print("");
- }
-
- /**
- * This method writes a XML tag with no content.
- */
- public void writeEmptyTag(final String label, final String... attributes)
- {
- this.out.print("<");
- this.out.print(label);
- writeTagAttributes(attributes);
- this.out.print("/>");
- }
-
- /**
- * This method writes a XML ender tag.
- */
- public void writeEndTag(final String label)
- {
- this.out.print("");
- this.out.print(label);
- this.out.print(">");
- }
-
- /**
- * This method writes a XML start tag.
- */
- public void writeStartTag(final String label, final String... attributes)
- {
- this.out.print("<");
- this.out.print(label);
- writeTagAttributes(attributes);
- this.out.print(">");
- }
-
- /**
- * This method write a XML tag with attributes and boolean content data.
- *
- * @param label
- * @param content
- * @param attributes
- */
- public void writeTag(final String label, final boolean content, final String... attributes)
- {
- writeStartTag(label, attributes);
- writeTagContent(String.valueOf(content));
- writeEndTag(label);
- }
-
- /**
- * This method write a XML tag with attributes and long content data.
- *
- * @param label
- * @param content
- * @param attributes
- */
- public void writeTag(final String label, final long content, final String... attributes)
- {
- writeStartTag(label, attributes);
- writeTagContent(String.valueOf(content));
- writeEndTag(label);
- }
-
- /**
- * This method write a XML tag with attributes and content data. Content
- * data are converted in XML format.
- *
- * @param label
- * @param content
- * @param attributes
- */
- public void writeTag(final String label, final String content, final String... attributes)
- {
- if (content == null)
- {
- writeEmptyTag(label, attributes);
- }
- else
- {
- writeStartTag(label, attributes);
- writeTagContent(content);
- writeEndTag(label);
- }
- }
-
- /**
- * This method writes attributes of a tag.
- *
- * @param attributes
- */
- private void writeTagAttributes(final String... attributes)
- {
- //
- if ((attributes != null) && (attributes.length > 0))
- {
- for (int count = 0; count < attributes.length; count += 2)
- {
- this.out.print(" ");
- this.out.print(attributes[count]);
- this.out.print("=\"");
- this.out.print(attributes[count + 1]);
- this.out.print("\"");
- }
- }
- }
-
- /**
- * This method writes content using XML escape.
- *
- * @param content
- * data to write in XML format.
- */
- private void writeTagContent(final String content)
- {
- //
- for (int count = 0; count < content.length(); count++)
- {
- //
- char car = content.charAt(count);
-
- switch (car)
- {
- case '<':
- this.out.print("<");
- break;
- case '>':
- this.out.print(">");
- break;
- case '&':
- this.out.print("&");
- break;
- case '"':
- this.out.print(""");
- break;
- case '\'':
- this.out.print("'");
- break;
- default:
- this.out.print(car);
- }
- }
- }
-
- /**
- * This method writes a XML header with attributes.
- *
- * @param attributes
- */
- public void writeXMLHeader(final String... attributes)
- {
-
- //
- this.out.print("");
- }
-}
diff --git a/src/fr/devinsy/util/xml/XMLZipReader.java b/src/fr/devinsy/util/xml/XMLZipReader.java
deleted file mode 100644
index a988c32..0000000
--- a/src/fr/devinsy/util/xml/XMLZipReader.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
- *
- * This file is part of Devinsy-utils.
- *
- * Devinsy-utils is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Devinsy-utils is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Devinsy-utils. If not, see
- */
-package fr.devinsy.util.xml;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.zip.ZipInputStream;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-
-/**
- *
- * @author Christian Pierre MOMON (christian.momon@devinsy.fr)
- */
-public class XMLZipReader extends XMLReader
-{
-
- /**
- *
- * @param file
- * @throws IOException
- * @throws XMLStreamException
- */
- public XMLZipReader(final File file) throws IOException, XMLStreamException
- {
- super();
-
- XMLInputFactory factory = XMLInputFactory.newInstance();
- ZipInputStream zis = new ZipInputStream(new FileInputStream(file));
- zis.getNextEntry();
- this.in = factory.createXMLEventReader(zis, "UTF-8");
- }
-
- /**
- *
- * @param target
- * @throws IOException
- * @throws XMLStreamException
- */
- public XMLZipReader(final InputStream source) throws IOException, XMLStreamException
- {
- super();
-
- XMLInputFactory factory = XMLInputFactory.newInstance();
- ZipInputStream zis = new ZipInputStream(source);
- zis.getNextEntry();
- this.in = factory.createXMLEventReader(zis, "UTF-8");
- }
-}
diff --git a/src/fr/devinsy/util/xml/XMLZipWriter.java b/src/fr/devinsy/util/xml/XMLZipWriter.java
deleted file mode 100644
index 515ccf2..0000000
--- a/src/fr/devinsy/util/xml/XMLZipWriter.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
- *
- * This file is part of Devinsy-utils.
- *
- * Devinsy-utils is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Devinsy-utils is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Devinsy-utils. If not, see
- */
-package fr.devinsy.util.xml;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.util.zip.Deflater;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import fr.devinsy.util.FileTools;
-
-/**
- *
- * @author Christian Pierre MOMON (christian.momon@devinsy.fr)
- */
-public class XMLZipWriter extends XMLWriter
-{
- private ZipOutputStream zos;
-
- /**
- *
- * @param file
- * @throws IOException
- */
- public XMLZipWriter(final File file) throws IOException
- {
- super();
-
- this.zos = new ZipOutputStream(new FileOutputStream(file));
- this.zos.setLevel(Deflater.BEST_COMPRESSION);
- this.zos.setMethod(ZipOutputStream.DEFLATED);
- this.zos.setComment("Generated by XMLZipWriter");
- this.zos.putNextEntry(new ZipEntry(FileTools.setExtension(file, ".xml").getName()));
- this.out = new PrintWriter(new OutputStreamWriter(this.zos, "UTF-8"));
- }
-
- /**
- *
- * @param file
- * @throws IOException
- */
- public XMLZipWriter(final File file, final String generator) throws IOException
- {
- super();
-
- this.zos = new ZipOutputStream(new FileOutputStream(file));
- this.zos.setLevel(Deflater.BEST_COMPRESSION);
- this.zos.setMethod(ZipOutputStream.DEFLATED);
- this.zos.setComment(generator);
- this.zos.putNextEntry(new ZipEntry(FileTools.setExtension(file, ".xml").getName()));
- this.out = new PrintWriter(new OutputStreamWriter(this.zos, "UTF-8"));
- }
-
- /**
- *
- * @param target
- * @throws IOException
- */
- public XMLZipWriter(final OutputStream target, final String generator) throws IOException
- {
- super();
- this.zos = new ZipOutputStream(target);
- this.zos.setLevel(Deflater.BEST_COMPRESSION);
- this.zos.setMethod(ZipOutputStream.DEFLATED);
- if (generator != null)
- {
- this.zos.setComment(generator);
- }
- this.out = new PrintWriter(new OutputStreamWriter(this.zos, "UTF-8"));
- }
-
- /**
- *
- * @param target
- * @throws IOException
- */
- public XMLZipWriter(final OutputStream target, final String fileName, final String generator) throws IOException
- {
- super();
- this.zos = new ZipOutputStream(target);
- this.zos.setLevel(Deflater.BEST_COMPRESSION);
- this.zos.setMethod(ZipOutputStream.DEFLATED);
- if (generator != null)
- {
- this.zos.setComment(generator);
- }
- openEntry(fileName);
- this.out = new PrintWriter(new OutputStreamWriter(this.zos, "UTF-8"));
- }
-
- /**
- * @throws IOException
- *
- */
- @Override
- public void close() throws IOException
- {
- closeEntry();
- super.close();
- }
-
- /**
- * @throws IOException
- *
- */
- public void closeEntry() throws IOException
- {
- flush();
- this.zos.closeEntry();
- }
-
- /**
- *
- * @param fileName
- * @throws IOException
- */
- public void openEntry(final String fileName) throws IOException
- {
- if (fileName == null)
- {
- throw new NullPointerException("fileName is null.");
- }
- else
- {
- this.zos.putNextEntry(new ZipEntry(FileTools.setExtension(fileName, ".xml")));
- }
- }
-}
diff --git a/src/org/apache/jackrabbit/util/ISO8601.java b/src/org/apache/jackrabbit/util/ISO8601.java
deleted file mode 100644
index 3f3c85a..0000000
--- a/src/org/apache/jackrabbit/util/ISO8601.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.util;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-/**
- * The ISO8601
utility class provides helper methods
- * to deal with date/time formatting using a specific ISO8601-compliant
- * format (see ISO 8601).
- *
- * The currently supported format is:
- *
- * ±YYYY-MM-DDThh:mm:ss.SSSTZD
- *
- * where:
- *
- * ±YYYY = four-digit year with optional sign where values <= 0 are
- * denoting years BCE and values > 0 are denoting years CE,
- * e.g. -0001 denotes the year 2 BCE, 0000 denotes the year 1 BCE,
- * 0001 denotes the year 1 CE, and so on...
- * MM = two-digit month (01=January, etc.)
- * DD = two-digit day of month (01 through 31)
- * hh = two digits of hour (00 through 23) (am/pm NOT allowed)
- * mm = two digits of minute (00 through 59)
- * ss = two digits of second (00 through 59)
- * SSS = three digits of milliseconds (000 through 999)
- * TZD = time zone designator, Z for Zulu (i.e. UTC) or an offset from UTC
- * in the form of +hh:mm or -hh:mm
- *
- */
-public final class ISO8601 {
- /**
- * Parses an ISO8601-compliant date/time string.
- *
- * @param text the date/time string to be parsed
- * @return a Calendar
, or null
if the input could
- * not be parsed
- * @throws IllegalArgumentException if a null
argument is passed
- */
- public static Calendar parse(String text) {
- if (text == null) {
- throw new IllegalArgumentException("argument can not be null");
- }
-
- // check optional leading sign
- char sign;
- int start;
- if (text.startsWith("-")) {
- sign = '-';
- start = 1;
- } else if (text.startsWith("+")) {
- sign = '+';
- start = 1;
- } else {
- sign = '+'; // no sign specified, implied '+'
- start = 0;
- }
-
- /**
- * the expected format of the remainder of the string is:
- * YYYY-MM-DDThh:mm:ss.SSSTZD
- *
- * note that we cannot use java.text.SimpleDateFormat for
- * parsing because it can't handle years <= 0 and TZD's
- */
-
- int year, month, day, hour, min, sec, ms;
- String tzID;
- try {
- // year (YYYY)
- year = Integer.parseInt(text.substring(start, start + 4));
- start += 4;
- // delimiter '-'
- if (text.charAt(start) != '-') {
- return null;
- }
- start++;
- // month (MM)
- month = Integer.parseInt(text.substring(start, start + 2));
- start += 2;
- // delimiter '-'
- if (text.charAt(start) != '-') {
- return null;
- }
- start++;
- // day (DD)
- day = Integer.parseInt(text.substring(start, start + 2));
- start += 2;
- // delimiter 'T'
- if (text.charAt(start) != 'T') {
- return null;
- }
- start++;
- // hour (hh)
- hour = Integer.parseInt(text.substring(start, start + 2));
- start += 2;
- // delimiter ':'
- if (text.charAt(start) != ':') {
- return null;
- }
- start++;
- // minute (mm)
- min = Integer.parseInt(text.substring(start, start + 2));
- start += 2;
- // delimiter ':'
- if (text.charAt(start) != ':') {
- return null;
- }
- start++;
- // second (ss)
- sec = Integer.parseInt(text.substring(start, start + 2));
- start += 2;
- // delimiter '.'
- if (text.charAt(start) != '.') {
- return null;
- }
- start++;
- // millisecond (SSS)
- ms = Integer.parseInt(text.substring(start, start + 3));
- start += 3;
- // time zone designator (Z or +00:00 or -00:00)
- if (text.charAt(start) == '+' || text.charAt(start) == '-') {
- // offset to UTC specified in the format +00:00/-00:00
- tzID = "GMT" + text.substring(start);
- } else if (text.substring(start).equals("Z")) {
- tzID = "GMT";
- } else {
- // invalid time zone designator
- return null;
- }
- } catch (IndexOutOfBoundsException e) {
- return null;
- } catch (NumberFormatException e) {
- return null;
- }
-
- TimeZone tz = TimeZone.getTimeZone(tzID);
- // verify id of returned time zone (getTimeZone defaults to "GMT")
- if (!tz.getID().equals(tzID)) {
- // invalid time zone
- return null;
- }
-
- // initialize Calendar object
- Calendar cal = Calendar.getInstance(tz);
- cal.setLenient(false);
- // year and era
- if (sign == '-' || year == 0) {
- // not CE, need to set era (BCE) and adjust year
- cal.set(Calendar.YEAR, year + 1);
- cal.set(Calendar.ERA, GregorianCalendar.BC);
- } else {
- cal.set(Calendar.YEAR, year);
- cal.set(Calendar.ERA, GregorianCalendar.AD);
- }
- // month (0-based!)
- cal.set(Calendar.MONTH, month - 1);
- // day of month
- cal.set(Calendar.DAY_OF_MONTH, day);
- // hour
- cal.set(Calendar.HOUR_OF_DAY, hour);
- // minute
- cal.set(Calendar.MINUTE, min);
- // second
- cal.set(Calendar.SECOND, sec);
- // millisecond
- cal.set(Calendar.MILLISECOND, ms);
-
- try {
- /**
- * the following call will trigger an IllegalArgumentException
- * if any of the set values are illegal or out of range
- */
- cal.getTime();
- /**
- * in addition check the validity of the year
- */
- getYear(cal);
- } catch (IllegalArgumentException e) {
- return null;
- }
-
- return cal;
- }
-
- /**
- * Formats a Calendar
value into an ISO8601-compliant
- * date/time string.
- *
- * @param cal the time value to be formatted into a date/time string.
- * @return the formatted date/time string.
- * @throws IllegalArgumentException if a null
argument is passed
- * or the calendar cannot be represented as defined by ISO 8601 (i.e. year
- * with more than four digits).
- */
- public static String format(Calendar cal) throws IllegalArgumentException {
- if (cal == null) {
- throw new IllegalArgumentException("argument can not be null");
- }
-
- /**
- * the format of the date/time string is:
- * YYYY-MM-DDThh:mm:ss.SSSTZD
- *
- * note that we cannot use java.text.SimpleDateFormat for
- * formatting because it can't handle years <= 0 and TZD's
- */
- StringBuffer buf = new StringBuffer();
- // year ([-]YYYY)
- appendZeroPaddedInt(buf, getYear(cal), 4);
- buf.append('-');
- // month (MM)
- appendZeroPaddedInt(buf, cal.get(Calendar.MONTH) + 1, 2);
- buf.append('-');
- // day (DD)
- appendZeroPaddedInt(buf, cal.get(Calendar.DAY_OF_MONTH), 2);
- buf.append('T');
- // hour (hh)
- appendZeroPaddedInt(buf, cal.get(Calendar.HOUR_OF_DAY), 2);
- buf.append(':');
- // minute (mm)
- appendZeroPaddedInt(buf, cal.get(Calendar.MINUTE), 2);
- buf.append(':');
- // second (ss)
- appendZeroPaddedInt(buf, cal.get(Calendar.SECOND), 2);
- buf.append('.');
- // millisecond (SSS)
- appendZeroPaddedInt(buf, cal.get(Calendar.MILLISECOND), 3);
- // time zone designator (Z or +00:00 or -00:00)
- TimeZone tz = cal.getTimeZone();
- // determine offset of timezone from UTC (incl. daylight saving)
- int offset = tz.getOffset(cal.getTimeInMillis());
- if (offset != 0) {
- int hours = Math.abs((offset / (60 * 1000)) / 60);
- int minutes = Math.abs((offset / (60 * 1000)) % 60);
- buf.append(offset < 0 ? '-' : '+');
- appendZeroPaddedInt(buf, hours, 2);
- buf.append(':');
- appendZeroPaddedInt(buf, minutes, 2);
- } else {
- buf.append('Z');
- }
- return buf.toString();
- }
-
- /**
- * Returns the astronomical year of the given calendar.
- *
- * @param cal a calendar instance.
- * @return the astronomical year.
- * @throws IllegalArgumentException if calendar cannot be represented as
- * defined by ISO 8601 (i.e. year with more
- * than four digits).
- */
- public static int getYear(Calendar cal) throws IllegalArgumentException {
- // determine era and adjust year if necessary
- int year = cal.get(Calendar.YEAR);
- if (cal.isSet(Calendar.ERA)
- && cal.get(Calendar.ERA) == GregorianCalendar.BC) {
- /**
- * calculate year using astronomical system:
- * year n BCE => astronomical year -n + 1
- */
- year = 0 - year + 1;
- }
-
- if (year > 9999 || year < -9999) {
- throw new IllegalArgumentException("Calendar has more than four " +
- "year digits, cannot be formatted as ISO8601: " + year);
- }
- return year;
- }
-
- /**
- * Appends a zero-padded number to the given string buffer.
- *
- * This is an internal helper method which doesn't perform any
- * validation on the given arguments.
- *
- * @param buf String buffer to append to
- * @param n number to append
- * @param precision number of digits to append
- */
- private static void appendZeroPaddedInt(StringBuffer buf, int n, int precision) {
- if (n < 0) {
- buf.append('-');
- n = -n;
- }
-
- for (int exp = precision - 1; exp > 0; exp--) {
- if (n < Math.pow(10, exp)) {
- buf.append('0');
- } else {
- break;
- }
- }
- buf.append(n);
- }
-}
diff --git a/src/org/apache/jackrabbit/util/note b/src/org/apache/jackrabbit/util/note
deleted file mode 100644
index 558093b..0000000
--- a/src/org/apache/jackrabbit/util/note
+++ /dev/null
@@ -1 +0,0 @@
-Extract from jackrabbit-2.1.1-src.zip
\ No newline at end of file
diff --git a/test/FileIteratorSandbox.java b/test/FileIteratorSandbox.java
deleted file mode 100644
index 08452c6..0000000
--- a/test/FileIteratorSandbox.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Copyright (C) 2013 Christian Pierre MOMON
- *
- * This file is part of Devinsy-utils.
- *
- * Devinsy-utils is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Devinsy-utils is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Devinsy-utils. If not, see
- */
-import java.io.File;
-
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.PatternLayout;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import fr.devinsy.util.FileIterator;
-
-/**
- *
- */
-public class FileIteratorSandbox
-{
- private static final Logger logger;
-
- static
- {
- // Initialize logger.
- org.apache.log4j.BasicConfigurator.configure();
- org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.DEBUG);
-
- logger = LoggerFactory.getLogger(FileIteratorSandbox.class);
-
- //
- org.apache.log4j.Logger defaultLogger = org.apache.log4j.Logger.getRootLogger();
- defaultLogger.removeAllAppenders();
- defaultLogger.addAppender(new ConsoleAppender(new PatternLayout("%d{ISO8601} - dutils [%-5p] %34.34c.%-25M - %m%n")));
-
- //
- logger.debug("Log initialized.");
- }
-
- /**
- *
- */
- public static void main(final String[] args)
- {
- test();
- }
-
- /**
- *
- */
- protected static void test()
- {
- System.out.println("user.dir=" + System.getProperty("user.dir"));
-
- try
- {
- // File f = new File("TestTree/DirectoryOne/titi2");
- // File f = new File("/home/cpm/.kde//cache-cpmstar");
- File f = new File("tests/TestTree/xine.jpg");
- System.out.println("exists=" + f.exists());
- System.out.println("canonical path = " + f.getCanonicalPath());
- System.out.println("absolute path = " + f.getAbsolutePath());
- System.out.println("name = " + f.getName());
- System.out.println("parent = " + f.getParent());
- System.out.println("path = " + f.getPath());
- System.out.println("path = " + f.lastModified());
- System.out.println("path = " + f.length());
- System.out.println("path = " + f.isFile());
- System.out.println("path = " + f.isDirectory());
- System.out.println("list = " + f.list());
-
- System.out.println("----");
- // FileIterator i = new FileIterator(new File("tests/TestTree"));
- FileIterator i = new FileIterator(new File("tests/TestTree/xine.jpg"), null, true);
- // FileIterator i = new FileIterator(new
- // File("/home/cpm/.kde/cache-cpmstar"), ".*cache.*", false);
- // FileIterator i = new FileIterator(new File("tests/TestTree"),
- // ".*dsc.*", false);
- // FileIterator i = new FileIterator(new
- // File("/home/cpm/Images/Photos/"));
- // FileIterator i = new FileIterator(new
- // File("/home/cpm/Images/Photos/"), ".*\\.(JPG|jpg)", false);
- // FileIterator i = new FileIterator(new
- // File("/home/cpm/Images/Photos/"), ".*anni_moi.*", false);
-
- while (i.hasNext())
- {
- // System.out.println(i.toString());
- System.out.println("File=[" + i.next().getPath() + "]");
- }
- i.reset();
- System.out.println("Cardinal=" + i.finalCountdown());
- }
- catch (Exception exception)
- {
- System.out.println("ERROR:" + exception.getMessage());
- }
- }
-}
diff --git a/test/Foot1Test.java b/test/Foot1Test.java
deleted file mode 100644
index dda5c6a..0000000
--- a/test/Foot1Test.java
+++ /dev/null
@@ -1,19 +0,0 @@
-import org.junit.Test;
-
-public class Foot1Test
-{
- // private Logger logger =
- // LoggerFactory.getLogger(PdfGenerationAmqpServiceInjectedTest.class);
-
- /**
- *
- */
- @Test
- public void test1a()
- {
- // logger.debug("===== test starting...");
-
- // logger.debug("===== test done.");
- }
-
-}
diff --git a/test/TestTree/.test/arf b/test/TestTree/.test/arf
deleted file mode 100644
index 613a3f5..0000000
--- a/test/TestTree/.test/arf
+++ /dev/null
@@ -1 +0,0 @@
-test sioux
diff --git a/test/TestTree/20081111-nouvelle_voiture/dsc01469.jpg b/test/TestTree/20081111-nouvelle_voiture/dsc01469.jpg
deleted file mode 100755
index 49b1665..0000000
Binary files a/test/TestTree/20081111-nouvelle_voiture/dsc01469.jpg and /dev/null differ
diff --git a/test/TestTree/20081111-nouvelle_voiture/dsc01470.jpg b/test/TestTree/20081111-nouvelle_voiture/dsc01470.jpg
deleted file mode 100755
index 88a4027..0000000
Binary files a/test/TestTree/20081111-nouvelle_voiture/dsc01470.jpg and /dev/null differ
diff --git a/test/TestTree/20081111-nouvelle_voiture/dsc01472.jpg b/test/TestTree/20081111-nouvelle_voiture/dsc01472.jpg
deleted file mode 100755
index 8fff0e5..0000000
Binary files a/test/TestTree/20081111-nouvelle_voiture/dsc01472.jpg and /dev/null differ
diff --git a/test/TestTree/20081111-nouvelle_voiture/dsc01474.jpg b/test/TestTree/20081111-nouvelle_voiture/dsc01474.jpg
deleted file mode 100755
index 0e662f1..0000000
Binary files a/test/TestTree/20081111-nouvelle_voiture/dsc01474.jpg and /dev/null differ
diff --git a/test/TestTree/DirectoryOne/titi b/test/TestTree/DirectoryOne/titi
deleted file mode 100644
index cbd38df..0000000
--- a/test/TestTree/DirectoryOne/titi
+++ /dev/null
@@ -1 +0,0 @@
-azertyuiop
diff --git a/test/TestTree/DirectoryOne/toto b/test/TestTree/DirectoryOne/toto
deleted file mode 100644
index 388a530..0000000
--- a/test/TestTree/DirectoryOne/toto
+++ /dev/null
@@ -1 +0,0 @@
-good weather today
diff --git a/test/TestTree/DirectoryOne/tu tu b/test/TestTree/DirectoryOne/tu tu
deleted file mode 100644
index 20b7025..0000000
--- a/test/TestTree/DirectoryOne/tu tu
+++ /dev/null
@@ -1 +0,0 @@
-Ceci est un test.
diff --git a/test/TestTree/P/dsc01469.jpg b/test/TestTree/P/dsc01469.jpg
deleted file mode 100755
index 49b1665..0000000
Binary files a/test/TestTree/P/dsc01469.jpg and /dev/null differ
diff --git a/test/TestTree/P/dsc01470.jpg b/test/TestTree/P/dsc01470.jpg
deleted file mode 100755
index 88a4027..0000000
Binary files a/test/TestTree/P/dsc01470.jpg and /dev/null differ
diff --git a/test/TestTree/P/dsc01472.jpg b/test/TestTree/P/dsc01472.jpg
deleted file mode 100755
index 8fff0e5..0000000
Binary files a/test/TestTree/P/dsc01472.jpg and /dev/null differ
diff --git a/test/TestTree/P/dsc01474.jpg b/test/TestTree/P/dsc01474.jpg
deleted file mode 100755
index 0e662f1..0000000
Binary files a/test/TestTree/P/dsc01474.jpg and /dev/null differ
diff --git a/test/TestTree/xine.jpg b/test/TestTree/xine.jpg
deleted file mode 100644
index a89443b..0000000
Binary files a/test/TestTree/xine.jpg and /dev/null differ
diff --git a/test/TestTree/xine_snapshot-4.jpg b/test/TestTree/xine_snapshot-4.jpg
deleted file mode 100644
index a89443b..0000000
Binary files a/test/TestTree/xine_snapshot-4.jpg and /dev/null differ
diff --git a/test/TestTree/xine_snapshot-9.jpg b/test/TestTree/xine_snapshot-9.jpg
deleted file mode 100644
index 5ef999b..0000000
Binary files a/test/TestTree/xine_snapshot-9.jpg and /dev/null differ
diff --git a/test/fr/devinsy/util/FileToolsTest.java b/test/fr/devinsy/util/FileToolsTest.java
deleted file mode 100644
index 2653b83..0000000
--- a/test/fr/devinsy/util/FileToolsTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * Copyright (C) 2014 Christian Pierre MOMON
- *
- * This file is part of Devinsy-utils.
- *
- * Devinsy-utils is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Devinsy-utils is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Devinsy-utils. If not, see
- */
-package fr.devinsy.util;
-
-import java.io.IOException;
-
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import fr.devinsy.util.strings.StringList;
-
-/**
- *
- * @author Christian P. Momon
- */
-public class FileToolsTest
-{
- static protected org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(FileToolsTest.class);
-
- /**
- *
- */
- @Before
- public void before()
- {
- BasicConfigurator.configure();
- Logger.getRootLogger().setLevel(Level.ERROR);
- }
-
- /**
- *
- */
- @Test
- public void loadToStringListURL01() throws IOException
- {
- //
- logger.debug("===== test starting...");
- //
- StringList source = FileTools.loadToStringList(FileTools.class.getResource("/fr/devinsy/util/lines.txt"));
-
- //
- Assert.assertEquals(4, source.size());
- Assert.assertEquals("trois", source.get(3 - 1));
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- * @throws IOException
- *
- */
- @Test
- public void testGetExtension()
- {
- //
- logger.debug("===== test starting...");
-
- //
- String extension = FileTools.getExtension("test.ext");
-
- //
- Assert.assertEquals(extension, "ext");
-
- //
- logger.debug("===== test done.");
- }
-}
diff --git a/test/fr/devinsy/util/cmdexec/CmdExecSandbox.java b/test/fr/devinsy/util/cmdexec/CmdExecSandbox.java
index d0c6418..b09c48c 100644
--- a/test/fr/devinsy/util/cmdexec/CmdExecSandbox.java
+++ b/test/fr/devinsy/util/cmdexec/CmdExecSandbox.java
@@ -1,108 +1,119 @@
-package fr.devinsy.util.cmdexec;
-
-/**
- * Copyright (C) 2013 Christian Pierre MOMON
+/*
+ * Copyright (C) 2013,2017 Christian Pierre MOMON
*
- * This file is part of Devinsy-utils.
+ * This file is part of Devinsy-unix.
*
- * Devinsy-utils is free software: you can redistribute it and/or modify
+ * Devinsy-unix is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
- * Devinsy-utils is distributed in the hope that it will be useful,
+ * Devinsy-unix is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
- * along with Devinsy-utils. If not, see
+ * along with Devinsy-unix. If not, see
*/
+package fr.devinsy.util.cmdexec;
+
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.PatternLayout;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- *
+ * The Class CmdExecSandbox.
*/
class CmdExecSandbox
{
- static private final Logger logger;
+ static private final Logger logger;
- static
- {
- // Initialize logger.
- org.apache.log4j.BasicConfigurator.configure();
- org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.INFO);
+ static
+ {
+ // Initialize logger.
+ org.apache.log4j.BasicConfigurator.configure();
+ org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.INFO);
- logger = LoggerFactory.getLogger(CmdExecSandbox.class);
- logger.info("Enter");
+ logger = LoggerFactory.getLogger(CmdExecSandbox.class);
+ logger.info("Enter");
- //
- logger.info("Set the log file format…");
- org.apache.log4j.Logger defaultLogger = org.apache.log4j.Logger.getRootLogger();
- defaultLogger.removeAllAppenders();
- defaultLogger.addAppender(new ConsoleAppender(new PatternLayout("%d{ISO8601} - dutils [%-5p] %34.34c.%-25M - %m%n")));
+ //
+ logger.info("Set the log file format…");
+ org.apache.log4j.Logger defaultLogger = org.apache.log4j.Logger.getRootLogger();
+ defaultLogger.removeAllAppenders();
+ defaultLogger.addAppender(new ConsoleAppender(new PatternLayout("%d{ISO8601} - dutils [%-5p] %34.34c.%-25M - %m%n")));
- logger.info("… done.");
+ logger.info("… done.");
- logger.debug("Exit");
- }
+ logger.debug("Exit");
+ }
- /**
- *
- */
- public static String check(final String title, final StringBuffer source, final String model)
- {
- String result;
-
- if (source.indexOf(model) == -1)
- {
- result = String.format("%-40s -> KO <-", title) + "\nGet:\n" + source + "\nWaiting:\n" + model;
-
- }
- else
- {
- result = String.format("%-40s [ OK ] ", title);
- }
-
- //
- return (result);
- }
-
- /**
- *
- */
- public static void main(final String[] args)
- {
- System.out.println("Automatic test action for CmdExec!");
-
- test1();
-
- }
-
- /**
+ /**
+ * Check.
*
+ * @param title
+ * the title
+ * @param source
+ * the source
+ * @param model
+ * the model
+ * @return the string
*/
- public static void test1()
- {
- try
- {
- System.out.println("Launch…s");
+ public static String check(final String title, final StringBuffer source, final String model)
+ {
+ String result;
- // String command = "/bin/sort -r /etc/passwd";
- String[] command = { "/usr/bin/sort", "-r", "/etc/passwd" };
+ if (source.indexOf(model) == -1)
+ {
+ result = String.format("%-40s -> KO <-", title) + "\nGet:\n" + source + "\nWaiting:\n" + model;
- CmdExec cmd = new CmdExec(command, StreamGobbler.StreamWay.BUFFER, StreamGobbler.StreamWay.BUFFER);
- System.out.println("exitVal=[" + cmd.getExitValue() + "]");
- System.out.println("out=[" + cmd.getOutStream() + "]");
- System.out.println("err=[" + cmd.getErrStream() + "]");
- }
- catch (Exception exception)
- {
- exception.printStackTrace();
- logger.info("ERRRO=" + exception);
- }
- }
+ }
+ else
+ {
+ result = String.format("%-40s [ OK ] ", title);
+ }
+
+ //
+ return result;
+ }
+
+ /**
+ * The main method.
+ *
+ * @param args
+ * the arguments
+ */
+ public static void main(final String[] args)
+ {
+ System.out.println("Automatic test action for CmdExec!");
+
+ test1();
+
+ }
+
+ /**
+ * Test 1.
+ */
+ public static void test1()
+ {
+ try
+ {
+ System.out.println("Launch…s");
+
+ // String command = "/bin/sort -r /etc/passwd";
+ String[] command = { "/usr/bin/sort", "-r", "/etc/passwd" };
+
+ CmdExec cmd = new CmdExec(command, StreamGobbler.StreamWay.BUFFER, StreamGobbler.StreamWay.BUFFER);
+ System.out.println("exitVal=[" + cmd.getExitValue() + "]");
+ System.out.println("out=[" + cmd.getOutStream() + "]");
+ System.out.println("err=[" + cmd.getErrStream() + "]");
+ }
+ catch (Exception exception)
+ {
+ exception.printStackTrace();
+ logger.info("ERRRO=" + exception);
+ }
+ }
}
diff --git a/test/fr/devinsy/util/lines.txt b/test/fr/devinsy/util/lines.txt
deleted file mode 100644
index de1c537..0000000
--- a/test/fr/devinsy/util/lines.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-un
-deux
-trois
-quatre
\ No newline at end of file
diff --git a/test/fr/devinsy/util/strings/StringListTest.java b/test/fr/devinsy/util/strings/StringListTest.java
deleted file mode 100644
index 9afe379..0000000
--- a/test/fr/devinsy/util/strings/StringListTest.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/**
- * Copyright (C) 2013,2014 Christian Pierre MOMON
- *
- * This file is part of Devinsy-utils.
- *
- * Devinsy-utils is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Devinsy-utils is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Devinsy-utils. If not, see
- */
-package fr.devinsy.util.strings;
-
-import java.util.Iterator;
-
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import fr.devinsy.util.strings.StringList;
-import fr.devinsy.util.strings.StringListCharIterator;
-import fr.devinsy.util.strings.StringListCharPosition;
-
-/**
- *
- * @author Christian P. Momon
- */
-public class StringListTest
-{
- static protected org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(StringListTest.class);
-
- /**
- *
- */
- @Before
- public void before()
- {
- BasicConfigurator.configure();
- Logger.getRootLogger().setLevel(Level.ERROR);
- }
-
- /**
- *
- */
- @Test
- public void testCharAt01()
- {
- //
- logger.debug("===== test starting...");
-
- //
- StringList source = new StringList();
- source.append("abcdefghijklm");
-
- //
- char target = source.charAt(0);
- Assert.assertEquals(target, 'a');
-
- //
- target = source.charAt(4);
- Assert.assertEquals(target, 'e');
-
- //
- target = source.charAt(11);
- Assert.assertEquals(target, 'l');
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- *
- */
- @Test
- public void testCharAt02()
- {
- //
- logger.debug("===== test starting...");
-
- //
- StringList source = new StringList();
- source.append("abc");
- source.append("def");
- source.append("ghi");
- source.append("jkl");
- source.append("mno");
-
- //
- char target = source.charAt(0);
- Assert.assertEquals('a', target);
-
- //
- target = source.charAt(4);
- Assert.assertEquals('e', target);
-
- //
- target = source.charAt(11);
- Assert.assertEquals('l', target);
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- *
- */
- @Test(expected = IndexOutOfBoundsException.class)
- public void testCharAtException01()
- {
- //
- logger.debug("===== test starting...");
-
- //
- StringList source = new StringList();
- source.append("abcdefghijklm");
-
- //
- char target = source.charAt(-2);
- Assert.assertEquals('a', target);
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- *
- */
- @Test(expected = IndexOutOfBoundsException.class)
- public void testCharAtException02()
- {
- //
- logger.debug("===== test starting...");
-
- //
- StringList source = new StringList();
- source.append("abcdefghijklm");
-
- //
- char target = source.charAt(100);
- Assert.assertEquals('a', target);
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- *
- */
- @Test(expected = IndexOutOfBoundsException.class)
- public void testCharAtException03()
- {
- //
- logger.debug("===== test starting...");
-
- //
- StringList source = new StringList();
- source.append("abcdefghijklm");
-
- //
- char target = source.charAt(source.length());
- Assert.assertEquals('a', target);
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- *
- */
- @Test
- public void testConstructor01()
- {
- //
- logger.debug("===== test starting...");
-
- String[] source = { "a", "b", "c" };
-
- //
- StringList target = new StringList(source);
-
- Assert.assertEquals(3, target.size());
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- *
- */
- @Test
- public void testConstructor02()
- {
- //
- logger.debug("===== test starting...");
-
- //
- StringList target = new StringList("a", "b", "c");
-
- Assert.assertEquals(3, target.size());
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- *
- */
- @Test
- public void testIteratorOfChar01()
- {
- //
- logger.debug("===== test starting...");
-
- //
- StringList source = new StringList();
- source.append("abc");
- source.append("def");
- source.append("ghi");
- source.append("jkl");
- source.append("mno");
-
- //
- Iterator iterator = source.iteratorOfChar();
-
- for (int index = 0; index < source.length(); index++)
- {
- StringListCharPosition position = ((StringListCharIterator) iterator).nextPosition();
- System.out.println(index + ":" + source.charAt(index) + " " + position.getCharIndex() + " " + position.getStringIndex() + " " + position.getLocalCharIndex());
-
- Assert.assertTrue(iterator.hasNext());
-
- Character character = ((StringListCharIterator) iterator).next();
-
- Assert.assertEquals(character, new Character(source.charAt(index)));
- }
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- *
- */
- @Test
- public void testSubstring01()
- {
- //
- logger.debug("===== test starting...");
-
- //
- StringList source = new StringList();
- source.append("hamburger");
-
- //
- StringList target = source.substring(4, 8);
- Assert.assertEquals("urge", target.toString());
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- *
- */
- @Test
- public void testSubstring02()
- {
- //
- logger.debug("===== test starting...");
-
- //
- StringList source = new StringList();
- source.append("ham").append("bur").append("ger");
-
- //
- StringList target = source.substring(4, 8);
- Assert.assertEquals("urge", target.toString());
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- */
- @Test
- public void testSubstring03()
- {
- //
- logger.debug("===== test starting...");
-
- //
- StringList source = new StringList();
- source.append("smiles");
-
- //
- StringList target = source.substring(1, 5);
- Assert.assertEquals("mile", target.toString());
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- */
- @Test
- public void testSubstring04()
- {
- //
- logger.debug("===== test starting...");
-
- //
- StringList source = new StringList();
- source.append("sm").append("il").append("es");
-
- //
- StringList target = source.substring(1, 5);
- Assert.assertEquals("mile", target.toString());
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- *
- */
- @Test
- public void testToString01()
- {
- //
- logger.debug("===== test starting...");
-
- //
- StringList buffer = new StringList();
-
- String target = buffer.toString();
-
- Assert.assertTrue(target.equals(""));
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- *
- */
- @Test
- public void testToString02()
- {
- //
- logger.debug("===== test starting...");
-
- //
- String source = "abcdefghijklm";
-
- StringList buffer = new StringList();
- buffer.append(source);
-
- String target = buffer.toString();
-
- Assert.assertEquals(source, target);
- Assert.assertTrue(target.equals(source));
-
- //
- logger.debug("===== test done.");
- }
-
- /**
- *
- */
- @Test
- public void testToString03()
- {
- //
- logger.debug("===== test starting...");
-
- //
- String source1 = "abcdefghijklm";
- String source2 = "other stuff";
-
- StringList buffer = new StringList();
- buffer.append(source1);
- buffer.append(source2);
-
- String target = buffer.toString();
-
- Assert.assertTrue(target.equals(source1 + source2));
-
- //
- logger.debug("===== test done.");
- }
-
-}
diff --git a/test/fr/devinsy/util/strings/StringListUtilsTest.java b/test/fr/devinsy/util/strings/StringListUtilsTest.java
deleted file mode 100644
index 097d37f..0000000
--- a/test/fr/devinsy/util/strings/StringListUtilsTest.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/**
- * Copyright (C) 2013,2014 Christian Pierre MOMON
- *
- * This file is part of Devinsy-utils.
- *
- * Devinsy-utils is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Devinsy-utils is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Devinsy-utils. If not, see
- */
-package fr.devinsy.util.strings;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- *
- * @author Christian P. Momon
- */
-public class StringListUtilsTest
-{
- private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(StringListUtilsTest.class);
-
- /**
- *
- */
- @Before
- public void before()
- {
- BasicConfigurator.configure();
- Logger.getRootLogger().setLevel(Level.ERROR);
- }
-
- /**
- *
- */
- @Test
- public void testContainsBlank01()
- {
- Assert.assertFalse(StringListUtils.containsBlank((Collection) null));
- Assert.assertFalse(StringListUtils.containsBlank(new StringList("aaa", "bbb", "ccc")));
- Assert.assertTrue(StringListUtils.containsBlank(new StringList("aaa", null, "ccc")));
- Assert.assertTrue(StringListUtils.containsBlank(new StringList("aaa", "", "ccc")));
- Assert.assertTrue(StringListUtils.containsBlank(new StringList("aaa", " ", "ccc")));
- }
-
- /**
- *
- */
- @Test
- public void testContainsBlank02()
- {
- Assert.assertFalse(StringListUtils.containsBlank((String[]) null));
- Assert.assertFalse(StringListUtils.containsBlank("aaa", "bbb", "ccc"));
- Assert.assertTrue(StringListUtils.containsBlank("aaa", null, "ccc"));
- Assert.assertTrue(StringListUtils.containsBlank("aaa", "", "ccc"));
- Assert.assertTrue(StringListUtils.containsBlank("aaa", " ", "ccc"));
- }
-
- /**
- *
- */
- @Test
- public void testContainsBlank03()
- {
- Assert.assertFalse(StringListUtils.containsBlank((ArrayList) null));
- ArrayList source = new ArrayList();
- source.add("aaa");
- source.add("bbb");
- source.add("ccc");
- Assert.assertFalse(StringListUtils.containsBlank(source));
- source.set(1, null);
- Assert.assertTrue(StringListUtils.containsBlank(source));
- source.set(1, "");
- Assert.assertTrue(StringListUtils.containsBlank(source));
- source.set(1, " ");
- Assert.assertTrue(StringListUtils.containsBlank(source));
- }
-
- /**
- *
- */
- @Test
- public void testContainsEmpty01()
- {
- Assert.assertFalse(StringListUtils.containsEmpty((Collection) null));
- Assert.assertFalse(StringListUtils.containsEmpty(new StringList("aaa", "bbb", "ccc")));
- Assert.assertTrue(StringListUtils.containsEmpty(new StringList("aaa", null, "ccc")));
- Assert.assertTrue(StringListUtils.containsEmpty(new StringList("aaa", "", "ccc")));
- }
-
- /**
- *
- */
- @Test
- public void testContainsEmpty02()
- {
- Assert.assertFalse(StringListUtils.containsEmpty((String[]) null));
- Assert.assertFalse(StringListUtils.containsEmpty("aaa", "bbb", "ccc"));
- Assert.assertTrue(StringListUtils.containsEmpty("aaa", null, "ccc"));
- Assert.assertTrue(StringListUtils.containsEmpty("aaa", "", "ccc"));
- }
-
- /**
- *
- */
- @Test
- public void testContainsEmpty03()
- {
- Assert.assertFalse(StringListUtils.containsEmpty((ArrayList) null));
- ArrayList source = new ArrayList();
- source.add("aaa");
- source.add("bbb");
- source.add("ccc");
- Assert.assertFalse(StringListUtils.containsEmpty(source));
- source.set(1, null);
- Assert.assertTrue(StringListUtils.containsEmpty(source));
- source.set(1, "");
- Assert.assertTrue(StringListUtils.containsEmpty(source));
- }
-
- /**
- *
- */
- @Test
- public void testContainsNull01()
- {
- Assert.assertFalse(StringListUtils.containsNull((Collection) null));
- Assert.assertFalse(StringListUtils.containsNull(new StringList("aaa", "bbb", "ccc")));
- Assert.assertTrue(StringListUtils.containsNull(new StringList("aaa", null, "ccc")));
- }
-
- /**
- *
- */
- @Test
- public void testContainsNull02()
- {
- Assert.assertFalse(StringListUtils.containsNull((String[]) null));
- Assert.assertFalse(StringListUtils.containsNull("aaa", "bbb", "ccc"));
- Assert.assertTrue(StringListUtils.containsNull("aaa", null, "ccc"));
- }
-
- /**
- *
- */
- @Test
- public void testContainsNull03()
- {
- Assert.assertFalse(StringListUtils.containsNull((ArrayList) null));
- ArrayList source = new ArrayList();
- source.add("aaa");
- source.add("bbb");
- source.add("ccc");
- Assert.assertFalse(StringListUtils.containsNull(source));
- source.set(1, null);
- Assert.assertTrue(StringListUtils.containsNull(source));
- }
-}
diff --git a/test/fr/devinsy/util/util/rss/RSSCacheTest.java b/test/fr/devinsy/util/util/rss/RSSCacheTest.java
deleted file mode 100644
index dd3aa8a..0000000
--- a/test/fr/devinsy/util/util/rss/RSSCacheTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Copyright (C) 2014 Christian Pierre MOMON
- *
- * This file is part of Devinsy-utils.
- *
- * Devinsy-utils is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Devinsy-utils is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Devinsy-utils. If not, see
- */
-package fr.devinsy.util.util.rss;
-
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Before;
-import org.junit.Test;
-
-import fr.devinsy.util.rss.RSSCache;
-
-/**
- *
- * @author Christian P. Momon
- */
-public class RSSCacheTest
-{
- static protected org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(RSSCacheTest.class);
-
- /**
- *
- */
- @Before
- public void before()
- {
- BasicConfigurator.configure();
- Logger.getRootLogger().setLevel(Level.ERROR);
- }
-
- /**
- *
- */
- @Test
- public void test01()
- {
- //
- logger.debug("===== test starting...");
-
- RSSCache cache = RSSCache.instance();
-
- cache.put("ALPHA", "Mignonne, allons voir si la rose");
- cache.put("BRAVO", "Qui ce matin avoit desclose");
- cache.put("CHARLIE", "Sa robe de pourpre au Soleil,");
-
- cache.setOudated("CHARLIE");
-
- //
- logger.debug("===== test done.");
- }
-}
diff --git a/test/fr/devinsy/util/xml/XMLReaderTest.java b/test/fr/devinsy/util/xml/XMLReaderTest.java
deleted file mode 100644
index 02e4f1a..0000000
--- a/test/fr/devinsy/util/xml/XMLReaderTest.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/**
- * Copyright (C) 2014 Christian Pierre MOMON
- *
- * This file is part of Devinsy-utils.
- *
- * Devinsy-utils is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Devinsy-utils is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Devinsy-utils. If not, see
- */
-package fr.devinsy.util.xml;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.junit.Before;
-
-import fr.devinsy.util.strings.StringList;
-
-/**
- *
- * @author Christian P. Momon
- */
-public class XMLReaderTest
-{
- static private org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(XMLReaderTest.class);
-
- /**
- *
- */
- @Before
- public void before()
- {
- BasicConfigurator.configure();
- Logger.getRootLogger().setLevel(Level.ERROR);
- }
-
- /**
- * @throws XMLStreamException
- * @throws FileNotFoundException
- * @throws XMLBadFormatException
- *
- */
- // @Test
- public void testFoo01() throws FileNotFoundException, XMLStreamException, XMLBadFormatException
- {
- //
- logger.debug("===== test starting...");
-
- // XMLReader in = new XMLReader(new
- // File("/home/cpm/C/Puck/TY/Ebrei 08.puc"));
- // XMLReader in = new XMLReader(new
- // File("/home/cpm/C/Puck/TY/T/kidarep.xml"));
- XMLReader in = new XMLReader(new File("/home/cpm/C/Puck/TY/T2/sikevadb-2014-06-08-17h55mn49s.xml"));
-
- boolean ended = false;
- while (!ended)
- {
- XMLTag tag = in.readTag();
-
- if (tag == null)
- {
- ended = true;
- }
- else
- {
- // System.out.println(String.format("tag %s", tag.getLabel()));
- }
-
- //
- logger.debug("===== test done.");
- }
- System.out.println("over");
- }
-
- /**
- * @throws XMLStreamException
- * @throws FileNotFoundException
- * @throws XMLBadFormatException
- *
- */
- // @Test
- public void testFoo02() throws FileNotFoundException, XMLStreamException, XMLBadFormatException
- {
- //
- logger.debug("===== test starting...");
-
- // XMLReader in = new XMLReader(new
- // File("/home/cpm/C/Puck/TY/Ebrei 08.puc"));
- XMLReader in = new XMLReader(new File("/home/cpm/C/Puck/TY/T/accounts.xml"));
- // XMLReader in = new XMLReader(new
- // File("/home/cpm/C/Puck/TY/T2/sikevadb-2014-06-08-17h55mn49s.xml"));
-
- boolean ended = false;
- StringList buffer = new StringList();
- while (!ended)
- {
- XMLTag tag = in.readTag();
-
- if (tag == null)
- {
- ended = true;
- }
- else
- {
- if (tag.getContent() != null)
- {
- System.out.println(buffer.append(tag.getContent()));
- }
- }
-
- //
- logger.debug("===== test done.");
- }
- System.out.println("over");
- }
-
-}
diff --git a/test/one/Foo2Test.java b/test/one/Foo2Test.java
deleted file mode 100644
index 07ebac5..0000000
--- a/test/one/Foo2Test.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package one;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class Foo2Test
-{
- /**
- *
- */
- @Test
- public void test2a()
- {
- // logger.debug("===== test starting...");
- Assert.assertEquals(true, true);
- // logger.debug("===== test done.");
- }
-
-}