iterator = this.iterator();
-
- while (iterator.hasNext())
- {
- out.append(iterator.next().toString() + "\n");
- }
-
- result = out.toString();
-
- //
- return (result);
- }
-}
-
-// ////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/src/fr/devinsy/util/unix/acl/AclEntry.java b/src/fr/devinsy/util/unix/acl/AclEntry.java
deleted file mode 100644
index 09e1eb3..0000000
--- a/src/fr/devinsy/util/unix/acl/AclEntry.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * Copyright (C) 2010, 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.unix.acl;
-
-/**
- *
- * @author Christian Pierre MOMON (christian.momon@devinsy.fr)
- */
-public class AclEntry
-{
- // private static final Logger logger =
- // LoggerFactory.getLogger(AclEntry.class);
-
- /*
- user::rwx
- user:cpm:rwx #effective:rwx
- user:goo39:rwx #effective:rwx
- group::--- #effective:---
- group:goo40:rwx #effective:rwx
- mask::rwx
- other::---
- */
-
- public enum Type
- {
- NONE, USER, GROUP, MASK, OTHER
- };
-
- protected Type type;
- protected String id;
- protected String permission;
-
- /**
- *
- */
- public AclEntry(final Type type, final String id, final String permission)
- {
- this.type = type;
- this.id = id;
- this.permission = permission;
- }
-
- /**
- *
- */
- public String id()
- {
- String result;
-
- result = this.id;
-
- //
- return (result);
- }
-
- /**
- *
- */
- public String permission()
- {
- String result;
-
- result = this.type.toString() + ":" + this.id + ":" + this.permission;
-
- //
- return (result);
- }
-
- /**
- *
- */
- @Override
- public String toString()
- {
- String result;
-
- result = this.permission;
-
- //
- return (result);
- }
-
- /**
- *
- */
- public Type type()
- {
- Type result;
-
- result = this.type;
-
- //
- return (result);
- }
-}
-
-// ////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/src/fr/devinsy/util/unix/acl/AclManager.java b/src/fr/devinsy/util/unix/acl/AclManager.java
deleted file mode 100644
index 7484141..0000000
--- a/src/fr/devinsy/util/unix/acl/AclManager.java
+++ /dev/null
@@ -1,424 +0,0 @@
-/**
- * Copyright (C) 2010, 2013-2015 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.unix.acl;
-
-import java.io.File;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import fr.devinsy.util.cmdexec.CmdExec;
-import fr.devinsy.util.strings.StringListUtils;
-import fr.devinsy.util.unix.Unix;
-
-/**
- *
- * @author Christian Pierre MOMON (christian.momon@devinsy.fr)
- */
-public class AclManager
-{
- private static final Logger logger = LoggerFactory.getLogger(AclManager.class);
- public static final String SUDO = "/usr/bin/sudo";
-
- final static public Pattern USER_PATTERN = Pattern.compile("^user:(.*):(.*)$");
- final static public Pattern GROUP_PATTERN = Pattern.compile("^group:(.*):(.*)$");
- final static public Pattern MASK_PATTERN = Pattern.compile("^mask:(.*):(.*)$");
- final static public Pattern OTHER_PATTERN = Pattern.compile("^other:(.*):(.*)$");
- final static public Pattern DEFAULT_USER_PATTERN = Pattern.compile("^default:user:(.*):(.*)$");
- final static public Pattern DEFAULT_GROUP_PATTERN = Pattern.compile("^default:group:(.*):(.*)$");
- final static public Pattern DEFAULT_MASK_PATTERN = Pattern.compile("^default:mask:(.*):(.*)$");
- final static public Pattern DEFAULT_OTHER_PATTERN = Pattern.compile("^default:other:(.*):(.*)$");
-
- /**
- *
- */
- public static void clearGroup(final String group, final String filePathName) throws Exception
- {
- if ((group == null) || (group.length() == 0) || (filePathName == null) || (filePathName.length() == 0))
- {
- throw new Exception("Bad parameters [" + group + "][" + filePathName + "].");
- }
- else
- {
- Unix.setfacl("-R", "-L", "-x", "group:" + group, filePathName);
- Unix.setfacl("-R", "-L", "-d", "-x", "group:" + group, filePathName);
- }
- }
-
- /**
- *
- */
- public static void clearId(final String id, final String filePathName) throws Exception
- {
- clearUser(id, filePathName);
- clearGroup(id, filePathName);
- }
-
- /**
- *
- */
- public static void clearUser(final String login, final String filePathName) throws Exception
- {
- if ((login == null) || (login.length() == 0) || (filePathName == null) || (filePathName.length() == 0))
- {
- throw new Exception("Bad parameters [" + login + "][" + filePathName + "].");
- }
- else
- {
- Unix.setfacl("-R", "-L", "-x", "user:" + login, filePathName);
- Unix.setfacl("-R", "-L", "-d", "-x", "user:" + login, filePathName);
- }
- }
-
- /**
- *
- */
- public static Acl getAcl(final String filePathName) throws Exception
- {
- Acl result;
-
- result = new Acl(filePathName);
-
- String[] entries = getAclEntryLines(filePathName);
-
- // Login pattern: "^[a-z_][a-z0-9_-]*$".
- logger.debug("Line=[" + entries[1] + "]");
- Matcher matcher = Pattern.compile("^#\\sowner:\\s([a-z_][a-z0-9_-]*)$").matcher(entries[1]);
- if (matcher.matches())
- {
- logger.debug("group=[" + matcher.group(1) + "]");
- result.setOwner(matcher.group(1));
- }
-
- // Group pattern: "^[a-z_][a-z0-9_-]*$".
- logger.debug("Line=[" + entries[2] + "]");
- matcher = Pattern.compile("^#\\sgroup:\\s([a-z_][a-z0-9_-]*)$").matcher(entries[2]);
- if (matcher.matches())
- {
- logger.debug("group=[" + matcher.group(1) + "]");
- result.setOwner(matcher.group(1));
- }
-
- for (int nEntry = 3; nEntry < entries.length; nEntry++)
- {
- String entryLine = entries[nEntry];
- logger.debug("Line=[" + entryLine + "]");
-
- //
- Matcher userMatcher = USER_PATTERN.matcher(entryLine);
- Matcher groupMatcher = GROUP_PATTERN.matcher(entryLine);
- Matcher maskMatcher = MASK_PATTERN.matcher(entryLine);
- Matcher otherMatcher = OTHER_PATTERN.matcher(entryLine);
- Matcher defaultUserMatcher = DEFAULT_USER_PATTERN.matcher(entryLine);
- Matcher defaultGroupMatcher = DEFAULT_GROUP_PATTERN.matcher(entryLine);
- Matcher defaultMaskMatcher = DEFAULT_MASK_PATTERN.matcher(entryLine);
- Matcher defaultOtherMatcher = DEFAULT_OTHER_PATTERN.matcher(entryLine);
-
- AclEntry entry;
- if (userMatcher.matches())
- {
- entry = new AclEntry(AclEntry.Type.USER, userMatcher.group(1), userMatcher.group(2));
- result.currentAcl().add(entry);
- }
- else if (groupMatcher.matches())
- {
- entry = new AclEntry(AclEntry.Type.GROUP, groupMatcher.group(1), groupMatcher.group(2));
- result.currentAcl().add(entry);
- }
- else if (maskMatcher.matches())
- {
- entry = new AclEntry(AclEntry.Type.MASK, maskMatcher.group(1), maskMatcher.group(2));
- result.currentAcl().add(entry);
- }
- else if (otherMatcher.matches())
- {
- entry = new AclEntry(AclEntry.Type.OTHER, otherMatcher.group(1), otherMatcher.group(2));
- result.currentAcl().add(entry);
- }
- else if (defaultUserMatcher.matches())
- {
- entry = new AclEntry(AclEntry.Type.USER, defaultUserMatcher.group(1), defaultUserMatcher.group(2));
- result.defaultAcl().add(entry);
- }
- else if (defaultGroupMatcher.matches())
- {
- entry = new AclEntry(AclEntry.Type.GROUP, defaultGroupMatcher.group(1), defaultGroupMatcher.group(2));
- result.defaultAcl().add(entry);
- }
- else if (defaultMaskMatcher.matches())
- {
- entry = new AclEntry(AclEntry.Type.MASK, defaultMaskMatcher.group(1), defaultMaskMatcher.group(2));
- result.defaultAcl().add(entry);
- }
- else if (defaultOtherMatcher.matches())
- {
- entry = new AclEntry(AclEntry.Type.OTHER, defaultOtherMatcher.group(1), defaultOtherMatcher.group(2));
- result.defaultAcl().add(entry);
- }
- else
- {
- throw new Exception("Unknow ACL entry line pattern for [" + entryLine + "].");
- }
-
- logger.debug("Acl entry decoded: [" + entry.toString() + "]");
- }
-
- //
- return (result);
- }
-
- /**
- *
- */
- public static String getAclData(final String filePathName) throws Exception
- {
- String result;
-
- try
- {
- logger.info("Getting Acl data for [" + filePathName + "].");
- result = CmdExec.run(SUDO, "/usr/bin/getfacl", "--no-effective", filePathName);
- logger.info("Acl data got for [" + filePathName + "].");
- }
- catch (Exception exception)
- {
- throw new Exception("Error getting ACL for [" + filePathName + "].", exception);
- }
-
- //
- return (result);
- }
-
- /**
- *
- */
- public static String[] getAclEntryLines(final String filePathName)
- {
- String[] result;
-
- try
- {
- result = getAclData(filePathName).split("\n");
- }
- catch (Exception exception)
- {
- result = new String[0];
- }
-
- //
- return (result);
- }
-
- /**
- *
- */
- public static boolean isUsed(final AclEntry.Type type, final String id, final String filePathName) throws Exception
- {
- boolean result;
-
- result = isUsed(type, id, filePathName, 0);
-
- //
- return (result);
- }
-
- /**
- *
- */
- public static boolean isUsed(final AclEntry.Type type, final String id, final String filePathName, final int depth) throws Exception
- {
- boolean result;
-
- if ((type == null) || (id == null) || (id.length() == 0) || (filePathName == null) || (filePathName.length() == 0) || (depth < 0))
- {
- throw new Exception("Bad parameter: [" + type + "][" + id + "][" + filePathName + "][" + depth + "].");
- }
- else
- {
- File file = new File(filePathName);
- if (!file.exists())
- {
- throw new Exception("File does not exist [" + filePathName + "].");
- }
- else
- {
- Acl acl = getAcl(filePathName);
- if (acl.contains(type, id))
- {
- result = true;
- }
- else if ((file.isDirectory()) && (depth > 0))
- {
- result = isUsed(type, id, filePathName, file.list(), depth - 1);
- }
- else
- {
- result = false;
- }
- }
- }
-
- //
- return (result);
- }
-
- /**
- *
- */
- public static boolean isUsed(final AclEntry.Type type, final String id, final String filePath, final String[] filePathNames, final int depth) throws Exception
- {
- boolean result;
-
- result = false;
- boolean ended = false;
- int nLine = 0;
- while (!ended)
- {
- if (nLine < filePathNames.length)
- {
- String filePathName = filePathNames[nLine];
- if (isUsed(type, id, filePath + "/" + filePathName, depth))
- {
- ended = true;
- result = true;
- }
- else
- {
- nLine += 1;
- }
- }
- else
- {
- ended = true;
- result = false;
- }
- }
-
- //
- return (result);
- }
-
- /**
- *
- */
- public static boolean isUsed(final String id, final String filePathName) throws Exception
- {
- boolean result;
-
- result = isUsed(id, filePathName, 0);
-
- //
- return (result);
- }
-
- /**
- *
- */
- public static boolean isUsed(final String id, final String filePathName, final int depth) throws Exception
- {
- boolean result;
-
- if ((id == null) || (id.length() == 0) || (filePathName == null) || (filePathName.length() == 0) || (depth < 0))
- {
- throw new Exception("Bad parameter: [" + id + "][" + filePathName + "][" + depth + "].");
- }
- else
- {
- File file = new File(filePathName);
- if (!file.exists())
- {
- throw new Exception("File does not exist [" + filePathName + "].");
- }
- else
- {
- Acl acl = getAcl(filePathName);
- if (acl.containsId(id))
- {
- result = true;
- }
- else if ((file.isDirectory()) && (depth > 0))
- {
- result = isUsed(id, file.list(), depth - 1);
- }
- else
- {
- result = false;
- }
- }
- }
-
- //
- return (result);
- }
-
- /**
- *
- */
- public static boolean isUsed(final String id, final String[] filePathNames, final int depth) throws Exception
- {
- boolean result;
-
- result = false;
- boolean ended = false;
- int nLine = 0;
- while (!ended)
- {
- if (nLine < filePathNames.length)
- {
- String filePathName = filePathNames[nLine];
- if (isUsed(id, filePathName, depth))
- {
- ended = true;
- result = true;
- }
- else
- {
- nLine += 1;
- }
- }
- else
- {
- ended = true;
- result = false;
- }
- }
-
- //
- return (result);
- }
-
- /**
- *
- */
- public static void setfacl(final String... args) throws Exception
- {
- try
- {
- CmdExec.run(SUDO, "setfacl", args, 1, 5);
- }
- catch (Exception exception)
- {
- throw new Exception("Error running setfacl command for " + StringListUtils.toStringWithBrackets(args) + ":" + exception.getMessage() + ".");
- }
- }
-}
-
-// ////////////////////////////////////////////////////////////////////////
\ No newline at end of file
diff --git a/src/fr/devinsy/util/xml/XMLAttributes.java b/src/fr/devinsy/util/xml/XMLAttributes.java
index 640185f..9e0c678 100644
--- a/src/fr/devinsy/util/xml/XMLAttributes.java
+++ b/src/fr/devinsy/util/xml/XMLAttributes.java
@@ -1,20 +1,20 @@
/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
+ * Copyright (C) 2013-2014,2017 Christian Pierre MOMON
*
- * This file is part of Devinsy-utils.
+ * This file is part of Devinsy-strings.
*
- * Devinsy-utils is free software: you can redistribute it and/or modify
+ * Devinsy-strings 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-strings 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-strings. If not, see
*/
package fr.devinsy.util.xml;
diff --git a/src/fr/devinsy/util/xml/XMLBadFormatException.java b/src/fr/devinsy/util/xml/XMLBadFormatException.java
index 268c1f0..d6b3e40 100644
--- a/src/fr/devinsy/util/xml/XMLBadFormatException.java
+++ b/src/fr/devinsy/util/xml/XMLBadFormatException.java
@@ -1,20 +1,20 @@
/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
+ * Copyright (C) 2013-2014,2017 Christian Pierre MOMON
*
- * This file is part of Devinsy-utils.
+ * This file is part of Devinsy-strings.
*
- * Devinsy-utils is free software: you can redistribute it and/or modify
+ * Devinsy-strings 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-strings 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-strings. If not, see
*/
package fr.devinsy.util.xml;
diff --git a/src/fr/devinsy/util/xml/XMLReader.java b/src/fr/devinsy/util/xml/XMLReader.java
index 57dd535..2dcd87d 100644
--- a/src/fr/devinsy/util/xml/XMLReader.java
+++ b/src/fr/devinsy/util/xml/XMLReader.java
@@ -1,21 +1,20 @@
/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
- * Copyright (C) 2017 Christian Pierre MOMON
+ * Copyright (C) 2013-2014,2017 Christian Pierre MOMON
*
- * This file is part of Devinsy-utils.
+ * This file is part of Devinsy-strings.
*
- * Devinsy-utils is free software: you can redistribute it and/or modify
+ * Devinsy-strings 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-strings 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-strings. If not, see
*/
package fr.devinsy.util.xml;
diff --git a/src/fr/devinsy/util/xml/XMLTag.java b/src/fr/devinsy/util/xml/XMLTag.java
index 806f754..7721ee7 100644
--- a/src/fr/devinsy/util/xml/XMLTag.java
+++ b/src/fr/devinsy/util/xml/XMLTag.java
@@ -1,20 +1,20 @@
/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
+ * Copyright (C) 2013-2014,2017 Christian Pierre MOMON
*
- * This file is part of Devinsy-utils.
+ * This file is part of Devinsy-strings.
*
- * Devinsy-utils is free software: you can redistribute it and/or modify
+ * Devinsy-strings 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-strings 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-strings. If not, see
*/
package fr.devinsy.util.xml;
@@ -29,7 +29,12 @@ public class XMLTag
public enum TagType
{
- HEADER, START, END, EMPTY, CONTENT, FOOTER
+ HEADER,
+ START,
+ END,
+ EMPTY,
+ CONTENT,
+ FOOTER
}
private QName name;
diff --git a/src/fr/devinsy/util/xml/XMLTools.java b/src/fr/devinsy/util/xml/XMLTools.java
index a7de117..e3bf573 100644
--- a/src/fr/devinsy/util/xml/XMLTools.java
+++ b/src/fr/devinsy/util/xml/XMLTools.java
@@ -1,20 +1,20 @@
/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
+ * Copyright (C) 2013-2014,2017 Christian Pierre MOMON
*
- * This file is part of Devinsy-utils.
+ * This file is part of Devinsy-strings.
*
- * Devinsy-utils is free software: you can redistribute it and/or modify
+ * Devinsy-strings 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-strings 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-strings. If not, see
*/
package fr.devinsy.util.xml;
diff --git a/src/fr/devinsy/util/xml/XMLWriter.java b/src/fr/devinsy/util/xml/XMLWriter.java
index d5b41ec..a44ba02 100644
--- a/src/fr/devinsy/util/xml/XMLWriter.java
+++ b/src/fr/devinsy/util/xml/XMLWriter.java
@@ -1,20 +1,20 @@
/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
+ * Copyright (C) 2013-2014,2017 Christian Pierre MOMON
*
- * This file is part of Devinsy-utils.
+ * This file is part of Devinsy-strings.
*
- * Devinsy-utils is free software: you can redistribute it and/or modify
+ * Devinsy-strings 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-strings 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-strings. If not, see
*/
package fr.devinsy.util.xml;
diff --git a/src/fr/devinsy/util/xml/XMLZipReader.java b/src/fr/devinsy/util/xml/XMLZipReader.java
index a988c32..14cbe36 100644
--- a/src/fr/devinsy/util/xml/XMLZipReader.java
+++ b/src/fr/devinsy/util/xml/XMLZipReader.java
@@ -1,20 +1,20 @@
/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
+ * Copyright (C) 2013-2014,2017 Christian Pierre MOMON
*
- * This file is part of Devinsy-utils.
+ * This file is part of Devinsy-strings.
*
- * Devinsy-utils is free software: you can redistribute it and/or modify
+ * Devinsy-strings 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-strings 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-strings. If not, see
*/
package fr.devinsy.util.xml;
diff --git a/src/fr/devinsy/util/xml/XMLZipWriter.java b/src/fr/devinsy/util/xml/XMLZipWriter.java
index 515ccf2..7cde068 100644
--- a/src/fr/devinsy/util/xml/XMLZipWriter.java
+++ b/src/fr/devinsy/util/xml/XMLZipWriter.java
@@ -1,20 +1,20 @@
/**
- * Copyright (C) 2013-2014 Christian Pierre MOMON
+ * Copyright (C) 2013-2014,2017 Christian Pierre MOMON
*
- * This file is part of Devinsy-utils.
+ * This file is part of Devinsy-strings.
*
- * Devinsy-utils is free software: you can redistribute it and/or modify
+ * Devinsy-strings 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-strings 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-strings. If not, see
*/
package fr.devinsy.util.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
index 2653b83..8c190ef 100644
--- a/test/fr/devinsy/util/FileToolsTest.java
+++ b/test/fr/devinsy/util/FileToolsTest.java
@@ -1,20 +1,20 @@
/**
- * Copyright (C) 2014 Christian Pierre MOMON
+ * Copyright (C) 2014,2017 Christian Pierre MOMON
*
- * This file is part of Devinsy-utils.
+ * This file is part of Devinsy-strings.
*
- * Devinsy-utils is free software: you can redistribute it and/or modify
+ * Devinsy-strings 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-strings 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-strings. If not, see
*/
package fr.devinsy.util;
diff --git a/test/fr/devinsy/util/cmdexec/CmdExecSandbox.java b/test/fr/devinsy/util/cmdexec/CmdExecSandbox.java
deleted file mode 100644
index d0c6418..0000000
--- a/test/fr/devinsy/util/cmdexec/CmdExecSandbox.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package fr.devinsy.util.cmdexec;
-
-/**
- * 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 org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.PatternLayout;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- */
-class CmdExecSandbox
-{
- static private final Logger logger;
-
- 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.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.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();
-
- }
-
- /**
- *
- */
- 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/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
index 02e4f1a..13f4529 100644
--- a/test/fr/devinsy/util/xml/XMLReaderTest.java
+++ b/test/fr/devinsy/util/xml/XMLReaderTest.java
@@ -1,20 +1,20 @@
/**
- * Copyright (C) 2014 Christian Pierre MOMON
+ * Copyright (C) 2014,2017 Christian Pierre MOMON
*
- * This file is part of Devinsy-utils.
+ * This file is part of Devinsy-strings.
*
- * Devinsy-utils is free software: you can redistribute it and/or modify
+ * Devinsy-strings 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-strings 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-strings. If not, see
*/
package fr.devinsy.util.xml;
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.");
- }
-
-}