perfsonar-dev - [GEANT/SA2/ps-java-services] r5593 - in trunk/perfsonar-java-base2/src: main/java/org/perfsonar/base2/service/configuration main/java/org/perfsonar/base2/service/configuration/migration main/java/org/perfsonar/base2/service/configuration/migration/grammar main/java/org/perfsonar/base2/service/configuration/migration/grammar/function test/java/org/perfsonar/base2/service/configuration test/java/org/perfsonar/base2/service/configuration/migration test/java/org/perfsonar/base2/service/configuration/migration/grammar test/java/org/perfsonar/base2/service/configuration/migration/grammar/function
Subject: perfsonar development work
List archive
[GEANT/SA2/ps-java-services] r5593 - in trunk/perfsonar-java-base2/src: main/java/org/perfsonar/base2/service/configuration main/java/org/perfsonar/base2/service/configuration/migration main/java/org/perfsonar/base2/service/configuration/migration/grammar main/java/org/perfsonar/base2/service/configuration/migration/grammar/function test/java/org/perfsonar/base2/service/configuration test/java/org/perfsonar/base2/service/configuration/migration test/java/org/perfsonar/base2/service/configuration/migration/grammar test/java/org/perfsonar/base2/service/configuration/migration/grammar/function
Chronological Thread
- From:
- To:
- Subject: [GEANT/SA2/ps-java-services] r5593 - in trunk/perfsonar-java-base2/src: main/java/org/perfsonar/base2/service/configuration main/java/org/perfsonar/base2/service/configuration/migration main/java/org/perfsonar/base2/service/configuration/migration/grammar main/java/org/perfsonar/base2/service/configuration/migration/grammar/function test/java/org/perfsonar/base2/service/configuration test/java/org/perfsonar/base2/service/configuration/migration test/java/org/perfsonar/base2/service/configuration/migration/grammar test/java/org/perfsonar/base2/service/configuration/migration/grammar/function
- Date: Mon, 26 Apr 2010 15:16:06 +0100
Author: psnc.pietrzak
Date: 2010-04-26 15:16:05 +0100 (Mon, 26 Apr 2010)
New Revision: 5593
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollection.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/MigratorComponent.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/TemplateEngine.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/BaseExpression.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/Expression.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/Interpreter.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/Loop.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/LoopExpression.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/PropertyExpression.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/Function.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/FunctionExpression.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/IndexerFunction.java
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/ReplaceFunction.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/AllMigrationTests.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigurationMigratorTest.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/components.properties
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/configuration.xml.template
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/expected.xml
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/AllGrammarTests.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/LoopExpressionTest.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/LoopTest.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/PropertyExpressionTest.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/AllFunctionTests.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/FunctionExpressionTest.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/FunctionTestCase.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/IndexerFunctionTest.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/ReplaceFunctionTest.java
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/log4j.properties
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/objects.config
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/service.properties
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/servlet.properties
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/wizard.properties
Log:
PSSERVICES-484 - Implemented migration tool from psbase-1 to psbase-2
configuration file.
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollection.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollection.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollection.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,98 @@
+package org.perfsonar.base2.service.configuration.migration;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Properties;
+import java.util.regex.Pattern;
+
+/**
+ * Represents a collection of psbase-1 configuration files.
+ *
+ * It is assumed that all configuration files matching
+ * the regular expression <i>".*[.]properties"</i> are psbase-1
+ * configuration files.
+ *
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ *
+ */
+public class ConfigFilesCollection {
+
+ private static final String RENAME_SUFFIX = ".remove";
+ protected static final String DEFAULT_CONFIG_PATH = "perfsonar" +
File.separator + "conf";
+ protected final String configPath;
+ protected static final Pattern filenamePattern =
Pattern.compile(".*[.]properties");
+
+ public ConfigFilesCollection(String configPath) {
+ this.configPath = configPath;
+ }
+ public ConfigFilesCollection() {
+ this.configPath = DEFAULT_CONFIG_PATH;
+ }
+
+ /**
+ * @return a collection of psbase-1 configuration files
+ * @throws IOException if I/O error occurs.
+ */
+ protected Collection<File> getFiles() throws IOException {
+ final Collection<File> result = new ArrayList<File>();
+ final File file = new File(configPath);
+ if (!file.exists())
+ throw new FileNotFoundException();
+ if (!file.isDirectory())
+ throw new IOException("Invalid directory path: " +
configPath);
+
+ for (File temp : file.listFiles(new FileFilter() {
+ @Override
+ public boolean accept(File file) {
+ return matchesFileName(file.getName());
+ }}))
+
+ result.add(temp);
+
+ return result;
+ }
+
+ protected boolean matchesFileName(String name) {
+ return filenamePattern.matcher(name).matches();
+ }
+
+ /**
+ * Returns the properties from all psbase-1 configuration files.
+ *
+ * @return properties from all configuration files
+ * @throws IOException if I/O error occurs
+ */
+ public Properties loadProperties() throws IOException {
+ final Properties result = new Properties();
+ for (File file : getFiles()) {
+ final Properties temp = new Properties();
+ final InputStream in = new BufferedInputStream(new
FileInputStream(file));
+ temp.load(in);
+ in.close();
+ result.putAll(temp);
+ }
+ return result;
+ }
+
+ /**
+ * Renames the psbase-1 configuration files to *.remove
+ *
+ * @throws IOException if I/O error occurs
+ */
+ public void removeFiles() throws IOException {
+ for (File file : getFiles()) {
+ final File newFile = new File(file.getAbsolutePath()
+ RENAME_SUFFIX);
+ if (newFile.exists())
+ throw new IOException("Cannot rename the file
" + file.getAbsolutePath() + " to " + newFile.getName() + ", because the file
with the given name already exists.");
+ if (!file.renameTo(newFile))
+ throw new IOException("Cannot rename the file
" + file.getAbsolutePath() + " to " + newFile.getName());
+ }
+ }
+}
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/MigratorComponent.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/MigratorComponent.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/MigratorComponent.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,65 @@
+package org.perfsonar.base2.service.configuration.migration;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.perfsonar.base2.service.configuration.Component;
+import org.perfsonar.base2.service.exceptions.PerfSONARException;
+
+/**
+ * The component that rewrites configuration files from base-1 to base-2.
+ *
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ *
+ */
+public class MigratorComponent extends Component {
+ private TemplateEngine engine;
+ private ConfigFilesCollection configFiles;
+
+ /**
+ * @see org.perfsonar.base2.service.configuration.Component#destroy()
+ */
+ @Override
+ public void destroy() throws PerfSONARException { }
+
+ /**
+ * @see org.perfsonar.base2.service.configuration.Component#init()
+ */
+ @Override
+ public void init() throws PerfSONARException {
+ configFiles = new ConfigFilesCollection();
+ try {
+ engine = new
TemplateEngine(configFiles.loadProperties());
+ } catch (IOException ex) {
+ throw new PerfSONARException(ex.getMessage());
+ }
+ }
+
+ /**
+ * Converts psbase-1 configuration files to psbase-2 format.
+ *
+ * It reads template from configuration.xml.template file,
+ * parses the psbase-1 configuration files with that template
+ * and writes the result to the configuration.xml file.
+ * If the configuration.xml file is successfully created
+ * it then renames all the psbase-1 config to *.properties.remove
+ *
+ * @see org.perfsonar.base2.service.configuration.Component#run()
+ */
+ @Override
+ public void run() throws PerfSONARException {
+ try {
+ engine.createFileFromTemplate(
+ new
File(getFullPath("configuration.xml.template")),
+ getFullPath("configuration.xml"));
+
+ configFiles.removeFiles();
+ } catch (IOException ex) {
+ throw new PerfSONARException(ex.getMessage());
+ }
+ }
+
+ private String getFullPath(String fileName) {
+ return "conf" + File.separator + "perfsonar" + File.separator
+ fileName;
+ }
+}
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/TemplateEngine.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/TemplateEngine.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/TemplateEngine.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,112 @@
+package org.perfsonar.base2.service.configuration.migration;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Properties;
+
+import
org.perfsonar.base2.service.configuration.migration.grammar.Interpreter;
+
+/**
+ * Used to create a file from the template.
+ *
+ * The following expressions are implemented in the template engine:
+ * <ul>
+ * <li>property expressions <code>${property_name}</code></li>
+ * <li>function expressions <code>#function-name(arg1 "value1" arg2
"value2" .. argN "valueN")</code></li>
+ * <li>loop expressions <code>#for(var variable string "string" split
"regular expression")...#end()</code></li>
+ * </ul>
+ *
+ * <p>Property expressions are expressions where the variable is substituted
by its value.
+ * Properties are provided in the constructor of TemplateEngine class.</p>
+ *
+ * <p>Function expressions are used to perform a function.
+ * The following functions are supported:<br />
+ * <ul>
+ * <li><code>replace</code> - replaces a substring specified with regular
expression with another string</li>
+ * <li><code>indexer</code> - writes a current index value and increments
the index</li>
+ * </ul>
+ *
+ * <i>Replace</i> function is represented with the following syntax:<br />
+ * <code>#replace(string </code><i>"string"</i><code> regexp
</code><i>"regexp"</i><code> with </code><i>"replacement
string"</i><code>)</code><br />
+ * where:<br />
+ * <ul>
+ * <li><i>string</i> - the string on which the replace function will be
performed</li>
+ * <li><i>regexp</i> - the regular expression describing the substring to
replace</li>
+ * <li><i>with</i> - the replacement string</li>
+ * </ul>
+ * Example:<br />
+ * #replace(string "http://somewhere" regexp "http" with "https")<br />
+ * <br />
+ * <i>Indexer</i> function is represented with the following syntax:<br />
+ * <code>#indexer()</code><br />
+ * </p>
+ *
+ * <p>Loop expression is used to iterate substrings that are a result of
+ * a string split.<br />
+ * Loop expression is represented by the following expression:<br />
+ * <code>#for(var </code><i>variable-name</i><code> string </code><i>"string
to be splited"</i><code> split </code><i>"regular
expression"</i><code>)</code><br />
+ * <code> ... </code><br />
+ * <code>#end()</code><br />
+ * <br />
+ * where: <br />
+ * <ul>
+ * <li><i>variable-name</i> is a name of the property that stores the
substring<br /></li>
+ * <li><i>string to be splited</i> is the string on which the split
function will be executed<br /></li>
+ * <li><i>regular expression</i> is a regexp used to split the string<br
/></li>
+ * </ul>
+ * <br />
+ * Example:<br />
+ * <code>#for(var lsAddress string "${service.r.ls_url}" split
",")</code><br />
+ * <code><option name="lsAddress-#indexer()" value="${lsAddress}"
/></code><br />
+ * <code>#end()</code><br />
+ *
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ *
+ */
+public class TemplateEngine {
+ private final Interpreter interpreter;
+
+ /**
+ * Creates the engine.
+ *
+ * @param props properties store the variables and their values
+ */
+ public TemplateEngine(Properties props) {
+ interpreter = new Interpreter(props);
+ }
+
+ /**
+ * Creates a file from the template.
+ *
+ * @param template template file
+ * @param newFileName name of the file to be created
+ * @return file created from the template
+ * @throws IOException if I/O error occurs
+ */
+ public File createFileFromTemplate(File template, String newFileName)
throws IOException {
+ if (!template.exists())
+ throw new FileNotFoundException();
+ if (!template.isFile())
+ throw new IOException("Template must be an existing
file.");
+ final File result = new File(newFileName);
+ if (result.exists() && !result.isFile())
+ throw new IOException("Output must be a file.");
+
+ final BufferedReader reader = new BufferedReader(new
FileReader(template));
+ final BufferedWriter writer = new BufferedWriter(new
FileWriter(result));
+ for (String line = reader.readLine(); line != null; line =
reader.readLine()) {
+ interpreter.interpret(writer, line);
+ writer.newLine();
+ }
+ writer.flush();
+ writer.close();
+ reader.close();
+
+ return result;
+ }
+}
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/BaseExpression.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/BaseExpression.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/BaseExpression.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,51 @@
+package org.perfsonar.base2.service.configuration.migration.grammar;
+
+import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Base implementation for all of the expressions.
+ *
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public abstract class BaseExpression implements Expression {
+ protected abstract Pattern getPattern();
+ protected abstract void interpret();
+
+ private Matcher regexpMatcher;
+ protected Matcher getRegexpMatcher() {
+ return regexpMatcher;
+ }
+ protected void setRegexpMatcher(Matcher value) {
+ regexpMatcher = value;
+ }
+
+ private final StringBuffer buffer = new StringBuffer();
+
+ /**
+ * @see
org.perfsonar.service.configuration.migration.Expression#interpret(java.lang.String)
+ */
+ @Override
+ public String interpret(String line) throws IOException {
+ buffer.delete(0, buffer.length());
+ setRegexpMatcher(getPattern().matcher(line));
+ while (getRegexpMatcher().find())
+ interpret();
+
+ getRegexpMatcher().appendTail(buffer);
+ return buffer.toString();
+ }
+
+ /**
+ * Appends the string provided as an argument to the interpreted line.
+ * @param string to be appended to the resultant string representing
the interpreted input.
+ */
+ protected void append(String string) {
+ getRegexpMatcher().appendReplacement(buffer, encode(string));
+ }
+
+ private String encode(String string) {
+ return string.replace("$", "\\$");
+ }
+}
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/Expression.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/Expression.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/Expression.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,21 @@
+package org.perfsonar.base2.service.configuration.migration.grammar;
+
+import java.io.IOException;
+
+/**
+ * Represents the expression in the grammar.
+ *
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ *
+ */
+public interface Expression {
+
+ /**
+ * Interprets the expression provided as an argument.
+ *
+ * @param line line to be interpreted
+ * @return interpreted line
+ * @throws IOException when input/output error occurs
+ */
+ String interpret(String line) throws IOException;
+}
\ No newline at end of file
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/Interpreter.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/Interpreter.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/Interpreter.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,31 @@
+package org.perfsonar.base2.service.configuration.migration.grammar;
+
+import java.io.BufferedWriter;
+import java.io.IOException;
+import java.util.Properties;
+
+
+/**
+ * Facade for the grammar expressions.
+ *
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ *
+ */
+public class Interpreter {
+
+ private final LoopExpression loopExpr;
+ public Interpreter(Properties properties) {
+ loopExpr = new LoopExpression(properties);
+ }
+
+ /**
+ * Interprets the line and writes the result in the writer.
+ *
+ * @param writer where to write the interpreted result
+ * @param line line to be interpreted
+ * @throws IOException if I/O error occurs
+ */
+ public void interpret(BufferedWriter writer, String line) throws
IOException {
+ loopExpr.interpret(writer, line);
+ }
+}
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/Loop.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/Loop.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/Loop.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,55 @@
+package org.perfsonar.base2.service.configuration.migration.grammar;
+
+import java.util.regex.Matcher;
+
+/**
+ * Represents the loop.
+ *
+ * Used internally by the LoopExpression class.
+ *
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+class Loop {
+ private final Matcher matcher;
+ protected Loop(Matcher matcher) {
+ this.matcher = matcher;
+ }
+
+ protected String getVariableName() {
+ return matcher.group(2);
+ }
+
+ protected String getString() {
+ return matcher.group(3);
+ }
+
+ protected String getSplitRegexp() {
+ return matcher.group(4);
+ }
+
+ private boolean insideLoop = false;
+
+ protected boolean isEndStatement() {
+ if (matcher.group().contains("#end()")) {
+ insideLoop = false;
+ return true;
+ }
+ return false;
+ }
+
+ protected boolean isForStatement() {
+ if (matcher.group().startsWith("#for(")) {
+ insideLoop = true;
+ return true;
+ }
+ return false;
+ }
+
+ protected boolean isInsideLoop() {
+ return insideLoop;
+ }
+
+ public String[] split() {
+ return getString().split(getSplitRegexp());
+ }
+}
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/LoopExpression.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/LoopExpression.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/LoopExpression.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,145 @@
+package org.perfsonar.base2.service.configuration.migration.grammar;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import
org.perfsonar.base2.service.configuration.migration.grammar.function.FunctionExpression;
+
+
+/**
+ * Represents the loop expression.
+ * Loop expression is used to iterate substrings that are a result of
+ * a string split.
+ *
+ * Loop expression is represented by the following expression:
+ * <code>#for(var </code><i>variable-name</i><code> string </code><i>"string
to be splited"</i><code split </code><i>"regular
expression"</i><code>)</code><br />
+ * <code> ... </code><br />
+ * <code>#end()</code><br />
+ * <br />
+ * where: <br />
+ * <i>variable-name</i> is a name of the property that stores the
substring<br />
+ * <i>string to be splited</i> is the string on which the split function
will be executed<br />
+ * <i>regular expression</i> is a regexp used to split the string<br />
+ * <br />
+ * Example:<br />
+ * <code>#for(var lsAddress string "${service.r.ls_url}" split
",")</code><br />
+ * <code><option name="lsAddress-#indexer()" value="${lsAddress}"
/></code><br />
+ * <code>#end()</code><br />
+ *
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class LoopExpression {
+ private final static Pattern loopPattern =
Pattern.compile("([#]for\\(var\\s([a-zA-Z0-9_]+)\\sstring\\s\"(.+)\"\\ssplit\\s\"(.+)\"\\))|([#]end\\(\\))");
+ protected Pattern getPattern() {
+ return loopPattern;
+ }
+
+ private List<Expression> expressions = new ArrayList<Expression>();
+ public LoopExpression(Properties props) {
+ expressions.add(new PropertyExpression(props));
+ expressions.add(new FunctionExpression());
+ }
+
+ private boolean insideLoop = false;
+ private Loop loop;
+
+ protected boolean isEndStatement() {
+ if (loop == null)
+ return false;
+ if (loop.isEndStatement()) {
+ insideLoop = false;
+ return true;
+ }
+ return false;
+ }
+
+ protected boolean isForStatement() {
+ if (loop == null)
+ return false;
+ if (loop.isForStatement()) {
+ insideLoop = true;
+ return true;
+ }
+ return false;
+ }
+
+ private final List<String> lines = new ArrayList<String>();
+ private String[] strings = new String[0];
+ private String varName = null;
+
+ /**
+ * Interprets the line and writes the result in the writer.
+ *
+ * @param writer where to write the interpreted result
+ * @param line line to be interpreted
+ * @throws IOException if I/O error occurs
+ */
+ public void interpret(Writer writer, String line) throws IOException {
+ filter(writer, interpretProperty(line),
getPattern().matcher(interpretProperty(line)));
+ }
+
+ private void filter(Writer writer, String line,
+ final Matcher regexpMatcher) throws IOException {
+
+ final boolean isLoopStatement = regexpMatcher.find();
+ if (isLoopStatement)
+ loop = new Loop(regexpMatcher);
+ else
+ loop = null;
+
+ if (!insideLoop && !isLoopStatement)
+ writer.write(interpret(line));
+ else if (isForStatement()) {
+ this.strings = loop.split();
+ final StringBuffer buffer = new StringBuffer();
+ regexpMatcher.appendReplacement(buffer, "");
+ writer.write(interpret(buffer.toString()));
+ buffer.delete(0, buffer.length());
+ regexpMatcher.appendTail(buffer);
+ varName = loop.getVariableName();
+ filter(writer, buffer.toString(), regexpMatcher);
+ } else if (isEndStatement()) {
+ final StringBuffer buffer = new StringBuffer();
+ regexpMatcher.appendReplacement(buffer, "");
+ if (buffer.length() > 0)
+ lines.add(buffer.toString());
+ for (int idx = 0; idx < strings.length; idx++) {
+ ((PropertyExpression)
expressions.get(0)).setProperty(varName, strings[idx]);
+ boolean first = true;
+ for (String tempLine : lines) {
+ if (!first)
+ newLine(writer);
+ else
+ first = false;
+ writer.write(interpret(tempLine));
+ }
+ ((PropertyExpression)
expressions.get(0)).removeProperty(varName);
+ }
+ buffer.delete(0, buffer.length());
+ regexpMatcher.appendTail(buffer);
+ filter(writer, buffer.toString(), regexpMatcher);
+ } else if (insideLoop)
+ lines.add(line);
+ }
+
+ private void newLine(Writer writer) throws IOException {
+ writer.write(System.getProperty("line.separator"));
+ }
+
+ private String interpret(String line) throws IOException {
+ String result = line;
+ for (Expression expr : expressions)
+ result = expr.interpret(result);
+
+ return result;
+ }
+
+ private String interpretProperty(String line) throws IOException {
+ return expressions.get(0).interpret(line);
+ }
+}
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/PropertyExpression.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/PropertyExpression.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/PropertyExpression.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,48 @@
+package org.perfsonar.base2.service.configuration.migration.grammar;
+
+import java.util.Properties;
+import java.util.regex.Pattern;
+
+/**
+ * Represents the property expression.
+ *
+ * Property expressions are the expressions where the variable
+ * is substituted by its value.
+ * Properties are read from the configuration files.
+ *
+ * Properties are represented with the following expression:
+ * <code>${property_name}</code>
+ *
+ * <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class PropertyExpression extends BaseExpression {
+
+ private final Pattern propertyPattern =
Pattern.compile("[$]\\{([a-zA-Z0-9_.]+)\\}");
+ private final Properties props;
+
+ public PropertyExpression(Properties props) {
+ this.props = props;
+ }
+
+ protected Pattern getPattern() {
+ return propertyPattern;
+ }
+
+ /**
+ * @see
org.perfsonar.base2.service.configuration.migration.grammar.BaseExpression#interpret()
+ */
+ @Override
+ public void interpret() {
+ if (props.getProperty(getRegexpMatcher().group(1)) != null)
+
append(props.getProperty(getRegexpMatcher().group(1)));
+ }
+
+ public void setProperty(String name, String value) {
+ props.setProperty(name, value);
+ }
+
+ public void removeProperty(String name) {
+ props.remove(name);
+ }
+
+}
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/Function.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/Function.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/Function.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,73 @@
+package org.perfsonar.base2.service.configuration.migration.grammar.function;
+
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Represents function.
+ *
+ * Used internally by the FunctionExpression class.
+ *
+ * @author <a
href="mailto:>Blazej
Pietrzak</a>
+ *
+ */
+class Function {
+ interface Executor {
+ String execute(Function function);
+ void reset();
+ }
+
+ private final Matcher functionMatcher;
+ protected Matcher getFunctionMatcher() {
+ return functionMatcher;
+ }
+
+ private static final Pattern argsPattern =
Pattern.compile("([a-zA-Z]+)\\s+\"([^\"]*)\"");
+ private final Map<String, Executor> executors = new Hashtable<String,
Executor>();
+
+ protected Function(Matcher function) {
+ this.functionMatcher = function;
+
+ executors.put("replace", new ReplaceFunction());
+ executors.put("indexer", new IndexerFunction());
+ }
+
+ protected void reset() {
+ for (Executor exec : executors.values())
+ exec.reset();
+ }
+
+ /**
+ * @return function name
+ */
+ public String getName() {
+ return getFunctionMatcher().group(1);
+ }
+
+ /**
+ * @return map of function's arguments where the key is the argument
name and the value is argument value
+ */
+ public Map<String, String> getArguments() {
+ final Map<String, String> result = new Hashtable<String,
String>();
+ final Matcher args =
argsPattern.matcher(getFunctionMatcher().group(2));
+
+ while (args.find())
+ for (int i = 0; i < args.groupCount() - 1; i += 2)
+ result.put(args.group(i + 1), args.group(i +
2));
+
+ return result;
+ }
+
+ /**
+ * Executes the function.
+ * @return result of the function
+ */
+ public String execute() {
+ if (executors.get(getName()) == null)
+ return getFunctionMatcher().group();
+
+ return executors.get(getName()).execute(this);
+ }
+}
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/FunctionExpression.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/FunctionExpression.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/FunctionExpression.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,38 @@
+package org.perfsonar.base2.service.configuration.migration.grammar.function;
+
+import java.util.regex.Pattern;
+
+import
org.perfsonar.base2.service.configuration.migration.grammar.BaseExpression;
+
+/**
+ * Represents the function expression.
+ *
+ * Function expressions are used to perform a function.
+ * The following functions are supported:
+ * <ul>
+ * <li><code>replace</code> - replaces a substring specified with regular
expression with another string</li>
+ * <li><code>indexer</code> - writes a current index value and increments
the index</li>
+ * </ul>
+ *
+ * <i>Replace</i> function is represented with the following syntax:<br />
+ * <code>#replace(string </code><i>"string"</i><code> regexp
</code><i>"reg-exp"</i><code> with </code><i>"replacement
string"</i><code>)</code><br />
+ * where:<br />
+ * <i>string</i> - the string on which the replace function will be performed
+ * <i>reg-exp</i> - the regular expression describing the substring to
replace
+ * <i>with</i> - the replacement string
+ * <i>Indexer</i> function is represented with the following syntax:<br />
+ * <code>#indexer</code><br />
+ *
+ * @author <a
href="mailto:>Blazej
Pietrzak</a>
+ *
+ */
+public class FunctionExpression extends BaseExpression {
+ private final Pattern functionPattern =
Pattern.compile("[#]([a-zA-Z0-9_]+)\\(([^()]*)\\)");
+ protected Pattern getPattern() {
+ return functionPattern;
+ }
+
+ public void interpret() {
+ append(new Function(getRegexpMatcher()).execute());
+ }
+}
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/IndexerFunction.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/IndexerFunction.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/IndexerFunction.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,38 @@
+package org.perfsonar.base2.service.configuration.migration.grammar.function;
+
+import
org.perfsonar.base2.service.configuration.migration.grammar.function.Function.Executor;
+
+/**
+ * Represents the indexer function.
+ *
+ * Used internally by the FunctionExpression class.
+ *
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ *
+ */
+class IndexerFunction implements Executor {
+ protected IndexerFunction() { }
+
+ private static int index = 0;
+
+ /**
+ * @see
org.perfsonar.service.configuration.migration.grammar.Function.Executor#execute()
+ */
+ @Override
+ public String execute(Function function) {
+ if (function.getArguments().size() != 0)
+ return function.getFunctionMatcher().group();
+
+ index++;
+ return Integer.toString(index);
+ }
+
+ /**
+ * @see
org.perfsonar.base2.service.configuration.migration.grammar.function.Function.Executor#reset()
+ */
+ @Override
+ public void reset() {
+ index = 0;
+ }
+
+}
Added:
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/ReplaceFunction.java
===================================================================
---
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/ReplaceFunction.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/grammar/function/ReplaceFunction.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,38 @@
+package org.perfsonar.base2.service.configuration.migration.grammar.function;
+
+import java.util.Map;
+
+import
org.perfsonar.base2.service.configuration.migration.grammar.function.Function.Executor;
+
+/**
+ * Represents the replace function.
+ *
+ * Used internally by the FunctionExpression class.
+ *
+ * @author <a
href="">Blazej
Pietrzak</a>
+ */
+class ReplaceFunction implements Executor {
+ protected ReplaceFunction() { }
+
+ /**
+ * Invokes replaceAll method from the String class.
+ *
+ * @see
org.perfsonar.service.configuration.migration.grammar.Function.Executor#execute()
+ */
+ @Override
+ public String execute(Function function) {
+ final Map<String, String> args = function.getArguments();
+ if (args.size() < 3)
+ return function.getFunctionMatcher().group();
+
+ return args.get("string").replaceAll(args.get("regexp"),
args.get("with"));
+ }
+
+ /**
+ * Does nothing.
+ *
+ * @see
org.perfsonar.base2.service.configuration.migration.grammar.function.Function.Executor#reset()
+ */
+ @Override
+ public void reset() { }
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/AllMigrationTests.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/AllMigrationTests.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/AllMigrationTests.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,24 @@
+package org.perfsonar.base2.service.configuration.migration;
+
+import
org.perfsonar.base2.service.configuration.migration.grammar.AllGrammarTests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class AllMigrationTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(
+ "Migration tool from base-1 to base-2 test cases");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(ConfigFilesCollectionTest.class);
+ suite.addTestSuite(ConfigurationMigratorTest.class);
+ suite.addTest(AllGrammarTests.suite());
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,101 @@
+package org.perfsonar.base2.service.configuration.migration;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import
org.perfsonar.base2.service.configuration.migration.ConfigFilesCollection;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class ConfigFilesCollectionTest extends TestCase {
+
+ private ConfigFilesCollection configCollection;
+ private static final String CONFIG_PATH
+ =
"src/test/java/org/perfsonar/base2/service/configuration/migration";
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ configCollection = new ConfigFilesCollection(CONFIG_PATH);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testMatchesInvalidName1() {
+
assertFalse(configCollection.matchesFileName("configurationproperties"));
+ }
+
+ public void testMatchesInvalidName2() {
+
assertFalse(configCollection.matchesFileName("configuration.properties.old"));
+ }
+
+ public void testMatches1() {
+
assertTrue(configCollection.matchesFileName("configuration.properties"));
+ }
+
+ public void testMatches2() {
+ assertTrue(configCollection.matchesFileName(".properties"));
+ }
+
+ public void testGetFiles() throws Exception {
+ assertEquals(createExpectedConfigFiles(".properties"),
configCollection.getFiles());
+ }
+
+ public void testGetFilesDirectoryDoesNotExist() throws IOException {
+ configCollection = new ConfigFilesCollection(CONFIG_PATH +
File.separator + "does_not_exist");
+ try {
+ configCollection.getFiles();
+ fail("FileNotFoundException not thrown for non
existing directory.");
+ } catch (FileNotFoundException ex) { }
+ }
+
+ public void testGetFilesFilePath() {
+ configCollection = new ConfigFilesCollection(CONFIG_PATH +
File.separator + "ConfigurationMigratorTest.class");
+ try {
+ configCollection.getFiles();
+ fail("IOException not thrown for invalid directory
path.");
+ } catch (IOException ex) { }
+ }
+
+ public void testRemoveFiles() throws IOException {
+ configCollection.removeFiles();
+ for (File file :
createExpectedConfigFiles(".properties.remove")) {
+ assertTrue(file.exists());
+ final String name = file.getName().substring(0,
file.getName().length() - ".remove".length());
+ assertTrue(file.renameTo(new File(CONFIG_PATH +
File.separator + name)));
+ }
+ }
+
+ public void testRemoveFilesWhereTheFileExists() throws IOException {
+ assertTrue(new File(CONFIG_PATH + File.separator +
"wizard.properties.remove").createNewFile());
+ try {
+ configCollection.removeFiles();
+ fail("IOException should be thrown.");
+ } catch (IOException ex) { }
+ assertTrue(new File(CONFIG_PATH + File.separator +
"wizard.properties.remove").delete());
+ for (File file :
createExpectedConfigFiles(".properties.remove")) {
+ if (file.getName().equals("wizard.properties.remove"))
+ continue;
+ assertTrue("File: " + file.getName(), file.exists());
+ final String name = file.getName().substring(0,
file.getName().length() - ".remove".length());
+ assertTrue(file.renameTo(new File(CONFIG_PATH +
File.separator + name)));
+ }
+ }
+
+ private Collection<File> createExpectedConfigFiles(String suffix) {
+ final Collection<File> expected = new ArrayList<File>();
+ expected.add(new File(CONFIG_PATH + File.separator +
"components" + suffix));
+ expected.add(new File(CONFIG_PATH + File.separator + "log4j"
+ suffix));
+ expected.add(new File(CONFIG_PATH + File.separator +
"service" + suffix));
+ expected.add(new File(CONFIG_PATH + File.separator +
"servlet" + suffix));
+ expected.add(new File(CONFIG_PATH + File.separator + "wizard"
+ suffix));
+ return expected;
+ }
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigurationMigratorTest.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigurationMigratorTest.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigurationMigratorTest.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,77 @@
+package org.perfsonar.base2.service.configuration.migration;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import
org.perfsonar.base2.service.configuration.migration.ConfigFilesCollection;
+import org.perfsonar.base2.service.configuration.migration.TemplateEngine;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class ConfigurationMigratorTest extends TestCase {
+
+ TemplateEngine migrator;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ migrator = new TemplateEngine(new
ConfigFilesCollection(getConfigPath()).loadProperties());
+ }
+
+ private String getConfigPath() {
+ return "src" + File.separator + "test" + File.separator +
"java" + File.separator +
TemplateEngine.class.getPackage().getName().replace(".", File.separator);
+ }
+
+ public void testCreateFromTemplateWhereTemplateIsaDirectory() {
+ try {
+ migrator.createFileFromTemplate(new
File(getConfigPath()), "configuration.xml");
+ fail("IOException not thrown.");
+ } catch (IOException ex) { }
+ }
+ public void testCreateFromTemplateWhereTemplateDoesNotExist() throws
IOException {
+ try {
+ migrator.createFileFromTemplate(new
File(getConfigPath() + File.separator + "does_not_exist"),
"configuration.xml");
+ fail("FileNotFoundException not thrown.");
+ } catch (FileNotFoundException ex) { }
+ }
+ public void testCreateFromTemplateWhereFileIsaDirectory() {
+ try {
+ migrator.createFileFromTemplate(new
File(getConfigPath() + File.separator + "configuration.xml.template"),
getConfigPath());
+ fail("IOException not thrown.");
+ } catch (IOException ex) { }
+ }
+ public void testCreateFromTemplate() throws IOException {
+ assertEquals(new File(getConfigPath() + File.separator +
"expected.xml"), migrator.createFileFromTemplate(new File(getConfigPath() +
File.separator + "configuration.xml.template"), getConfigPath() +
File.separator + "configuration.xml"));
+ assertTrue(new File(getConfigPath() + File.separator +
"configuration.xml").delete());
+ }
+
+ private void assertEquals(File expected, File actual) throws
IOException {
+ assertEquals(toString(expected), toString(actual));
+ }
+
+ private String toString(File file) throws IOException {
+ final BufferedReader reader = new BufferedReader(new
FileReader(file));
+ final StringBuffer result = new StringBuffer();
+ boolean first = true;
+ for (String line = reader.readLine(); line != null; line =
reader.readLine()) {
+ if (first == false)
+ result.append("\n");
+ else
+ first = false;
+ result.append(line);
+ }
+ reader.close();
+
+ return result.toString();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/components.properties
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/components.properties
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/components.properties
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,25 @@
+# File contains components to load
+# Config and logger MUST be load as first!
+
+#Group=PropertiesConfiguration
+#Description=Configuration component - must be the first one!
+config=org.perfsonar.base.auxiliary.components.configuration.properties.PropertiesConfigurationComponent
+
+#Group=Logging
+#Description=Logger component - must be the second one!
+logger=org.perfsonar.base.auxiliary.components.logger.log4j.Log4jLoggerComponent
+
+#Group=Scheduler
+#Description=Simple scheduler
+#scheduler=org.perfsonar.base.auxiliary.components.simplescheduler.Scheduler
+
+#Group=LS
+#Description=Registration in LS
+#registrator=org.perfsonar.service.base.registration.LSRegistrationComponent
+
+#Group=AuthN
+#Description=Authentication component
+authn=org.perfsonar.base.auxiliary.components.authn.wssec.WSSecAuthNComponent
+
+#Service specific components
+#...
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/configuration.xml.template
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/configuration.xml.template
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/configuration.xml.template
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,130 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<configuration xmlns="http://service.perfsonar.org/ns/config/base/0.9/">
+ <service name="sshtelnet-mp">
+ <lookupInformation>
+ <option name="accessPoint" value="${service.r.access_point}"/>
+ <option name="serviceName" value="${service.r.service_name}"/>
+ <option name="serviceType" value="${service.r.service_type}"/>
+ </lookupInformation>
+
+ <!-- Message Handlers - message types and service engines -->
+
+ <messageHandler>
+
+ <message type="EchoRequest"
+
handler="org.perfsonar.base2.service.messages.GenericMessageHandler">
+ <option name="ServiceEngine"
+
value="org.perfsonar.service.measurementPoint.EchoServiceEngine" />
+ <option name="authN" value="no" />
+ </message>
+
+ <message type="MetadataKeyRequest"
+
handler="org.perfsonar.base2.service.messages.GenericMessageHandler">
+ <option name="ServiceEngine"
+
value="org.perfsonar.service.measurementPoint.ServiceCapabilitiesEngine" />
+ <option name="authN" value="no" />
+ </message>
+
+ <message type="SetupDataRequest"
+
handler="org.perfsonar.base2.service.messages.GenericMessageHandler">
+ <option name="ServiceEngine"
+
value="org.perfsonar.service.measurementPoint.SetupDataServiceEngine" />
+ <option name="authN" value="no" />
+ </message>
+
+ </messageHandler>
+
+ <!-- Additional auxiliary components -->
+
+ <auxiliaryComponents>
+ <component name="XMLDB"
className="org.perfsonar.base2.service.storage.xml.XMLDBComponent">
+ <option name="dataStorageClassName"
value="org.perfsonar.base2.service.storage.xml.exist.ExistHTTPDataStorage" />
+ <option name="uri" value="#replace(string
"${component.mp.xmldb.db_uri}" regexp "" with "")"/>
+ <option name="username"
value="${component.mp.xmldb.db_username}"/>
+ <option name="password"
value="${component.mp.xmldb.db_password}"/>
+ </component>
+
+ <component name="Configuration"
className="org.perfsonar.service.measurementPoint.Configuration">
+ <option name="metadata-file"
value="${component.mp.xmldb.metadata_file_path}" />
+ <option name="token-path" value="${service.mp.tokenPath}" />
+ </component>
+
+ <!-- auth configuration -->
+ <component name="auth"
className="org.perfsonar.base2.service.authn.component.wssec.WSSecAuthNComponent">
+ <option name="as_endpoint" value="${service.as.point}"/>
+ <option name="comp_id" value="urn:compId"/>
+ </component>
+
+ <!-- Scheduler -->
+ <component name="scheduling"
className="org.perfsonar.base2.service.scheduler.SchedulingComponent">
+ <option name="schedulerClassName"
value="org.perfsonar.base2.service.scheduler.SimpleScheduler"/>
+ <option name="interval" value="60"/>
+
+ <actions>
+ <action name="registration"
className="org.perfsonar.base2.service.registration.LSRegistrationAction">
+ <option name="status" value="on" />
+ <option name="interval"
value="${component.registrator.interval}" />
+ <option name="registerDataSource"
value="org.perfsonar.base2.service.registration.MetadataExistDBRegisterDataSource"/>
+ <option name="registerEventType"
value="http://ogf.org/ns/nmwg/tools/org/perfsonar/service/lookup/registration/summary/2.0"/>
+ <option name="registrator"
value="org.perfsonar.base2.service.registration.GenericLSRegistrator"/>
+#for(var lsAddress string "${service.r.ls_url}" split ",")
+ <option name="lsAddress-#indexer()" value="${lsAddress}" />#end()
+ </action>
+
+ <!-- Checks whether a given metadata file has changed and updates
it in the database.
+ If the given metadata file is not stored in the database it
is added. -->
+ <action name="metadata-updater"
className="org.perfsonar.service.measurementPoint.MetadataUpdater">
+ <!-- Should the user configured in the "Configuration" section
be created if it does not exist -->
+ <option name="create-user" value="yes" />
+
+ <!-- login and password for the user that has rights to create
user accounts. Obligatory only when "create-user" option is set to "yes" -->
+ <option name="username" value="admin" />
+ <option name="password"
value="${component.mp.xmldb.db_adminpassword}" />
+ </action>
+ </actions>
+ </component>
+ </auxiliaryComponents>
+
+ <extension name="registerExtension-registerDataSource">
+ <option name="exist-config" value="XMLDB" />
+ </extension>
+
+ <!--
....................................................................................
-->
+
+ <!-- Protocol mappings, XML elements and their bingings -->
+
+ <protocolMappings>
+
+
+ <!-- default mapping -->
+
+
+ <!-- general mappings -->
+ <element name="{*}message"
+ mapping="org.perfsonar.base2.xml.nmwg.Message"/>
+ <element name="{*}metadata"
+ mapping="org.perfsonar.base2.xml.nmwg.Metadata"/>
+ <element name="{*}eventType"
+ mapping="org.perfsonar.base2.xml.nmwg.EventType"/>
+ <element name="{*}data"
+ mapping="org.perfsonar.base2.xml.nmwg.Data"/>
+ <element name="{*}subject"
+ mapping="org.perfsonar.base2.xml.nmwg.Subject"/>
+ <element name="{*}parameters"
+ mapping="org.perfsonar.base2.xml.nmwg.Parameters"/>
+ <element name="{*}parameter"
+ mapping="org.perfsonar.base2.xml.nmwg.Parameter"/>
+ <element name="*"
+ mapping="org.perfsonar.base2.xml.Element"/>
+ <element
name="{http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xquery/1.0/}subject"
+ mapping="org.perfsonar.base2.xml.TextElement"/>
+
+
+ </protocolMappings>
+
+
+ </service>
+
+
+</configuration>
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/expected.xml
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/expected.xml
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/expected.xml
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,132 @@
+<?xml version='1.0' encoding='UTF-8'?>
+
+<configuration xmlns="http://service.perfsonar.org/ns/config/base/0.9/">
+ <service name="sshtelnet-mp">
+ <lookupInformation>
+ <option name="accessPoint" value="http://somewhere"/>
+ <option name="serviceName" value="geant2-java-sshtelnet-mp"/>
+ <option name="serviceType" value="mp"/>
+ </lookupInformation>
+
+ <!-- Message Handlers - message types and service engines -->
+
+ <messageHandler>
+
+ <message type="EchoRequest"
+
handler="org.perfsonar.base2.service.messages.GenericMessageHandler">
+ <option name="ServiceEngine"
+
value="org.perfsonar.service.measurementPoint.EchoServiceEngine" />
+ <option name="authN" value="no" />
+ </message>
+
+ <message type="MetadataKeyRequest"
+
handler="org.perfsonar.base2.service.messages.GenericMessageHandler">
+ <option name="ServiceEngine"
+
value="org.perfsonar.service.measurementPoint.ServiceCapabilitiesEngine" />
+ <option name="authN" value="no" />
+ </message>
+
+ <message type="SetupDataRequest"
+
handler="org.perfsonar.base2.service.messages.GenericMessageHandler">
+ <option name="ServiceEngine"
+
value="org.perfsonar.service.measurementPoint.SetupDataServiceEngine" />
+ <option name="authN" value="no" />
+ </message>
+
+ </messageHandler>
+
+ <!-- Additional auxiliary components -->
+
+ <auxiliaryComponents>
+ <component name="XMLDB"
className="org.perfsonar.base2.service.storage.xml.XMLDBComponent">
+ <option name="dataStorageClassName"
value="org.perfsonar.base2.service.storage.xml.exist.ExistHTTPDataStorage" />
+ <option name="uri"
value="xmldb:exist://127.0.0.1:8080/exist/xmlrpc/db"/>
+ <option name="username" value="sshtelnet"/>
+ <option name="password" value="sshtelnet"/>
+ </component>
+
+ <component name="Configuration"
className="org.perfsonar.service.measurementPoint.Configuration">
+ <option name="metadata-file"
value="/etc/ps-mdm-sshtelnet-mp/sshtelnetmetadata.xml" />
+ <option name="token-path"
value="/usr/lib/perfsonar/services/ps-mdm-sshtelnet-mp/WEB-INF/classes/perfsonar/"
/>
+ </component>
+
+ <!-- auth configuration -->
+ <component name="auth"
className="org.perfsonar.base2.service.authn.component.wssec.WSSecAuthNComponent">
+ <option name="as_endpoint"
value="http://homer.rediris.es:8080/perfSONAR-AS/services/AuthService"/>
+ <option name="comp_id" value="urn:compId"/>
+ </component>
+
+ <!-- Scheduler -->
+ <component name="scheduling"
className="org.perfsonar.base2.service.scheduler.SchedulingComponent">
+ <option name="schedulerClassName"
value="org.perfsonar.base2.service.scheduler.SimpleScheduler"/>
+ <option name="interval" value="60"/>
+
+ <actions>
+ <action name="registration"
className="org.perfsonar.base2.service.registration.LSRegistrationAction">
+ <option name="status" value="on" />
+ <option name="interval" value="43200000" />
+ <option name="registerDataSource"
value="org.perfsonar.base2.service.registration.MetadataExistDBRegisterDataSource"/>
+ <option name="registerEventType"
value="http://ogf.org/ns/nmwg/tools/org/perfsonar/service/lookup/registration/summary/2.0"/>
+ <option name="registrator"
value="org.perfsonar.base2.service.registration.GenericLSRegistrator"/>
+
+
+ <option name="lsAddress-1" value="http://somewhere" />
+ <option name="lsAddress-2" value="https://somehow" />
+ </action>
+
+ <!-- Checks whether a given metadata file has changed and updates
it in the database.
+ If the given metadata file is not stored in the database it
is added. -->
+ <action name="metadata-updater"
className="org.perfsonar.service.measurementPoint.MetadataUpdater">
+ <!-- Should the user configured in the "Configuration" section
be created if it does not exist -->
+ <option name="create-user" value="yes" />
+
+ <!-- login and password for the user that has rights to create
user accounts. Obligatory only when "create-user" option is set to "yes" -->
+ <option name="username" value="admin" />
+ <option name="password" value="admin" />
+ </action>
+ </actions>
+ </component>
+ </auxiliaryComponents>
+
+ <extension name="registerExtension-registerDataSource">
+ <option name="exist-config" value="XMLDB" />
+ </extension>
+
+ <!--
....................................................................................
-->
+
+ <!-- Protocol mappings, XML elements and their bingings -->
+
+ <protocolMappings>
+
+
+ <!-- default mapping -->
+
+
+ <!-- general mappings -->
+ <element name="{*}message"
+ mapping="org.perfsonar.base2.xml.nmwg.Message"/>
+ <element name="{*}metadata"
+ mapping="org.perfsonar.base2.xml.nmwg.Metadata"/>
+ <element name="{*}eventType"
+ mapping="org.perfsonar.base2.xml.nmwg.EventType"/>
+ <element name="{*}data"
+ mapping="org.perfsonar.base2.xml.nmwg.Data"/>
+ <element name="{*}subject"
+ mapping="org.perfsonar.base2.xml.nmwg.Subject"/>
+ <element name="{*}parameters"
+ mapping="org.perfsonar.base2.xml.nmwg.Parameters"/>
+ <element name="{*}parameter"
+ mapping="org.perfsonar.base2.xml.nmwg.Parameter"/>
+ <element name="*"
+ mapping="org.perfsonar.base2.xml.Element"/>
+ <element
name="{http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xquery/1.0/}subject"
+ mapping="org.perfsonar.base2.xml.TextElement"/>
+
+
+ </protocolMappings>
+
+
+ </service>
+
+
+</configuration>
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/AllGrammarTests.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/AllGrammarTests.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/AllGrammarTests.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,24 @@
+package org.perfsonar.base2.service.configuration.migration.grammar;
+
+import
org.perfsonar.base2.service.configuration.migration.grammar.function.AllFunctionTests;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class AllGrammarTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Grammar test cases");
+ //$JUnit-BEGIN$
+ suite.addTest(AllFunctionTests.suite());
+ suite.addTestSuite(PropertyExpressionTest.class);
+ suite.addTestSuite(LoopExpressionTest.class);
+ suite.addTestSuite(LoopTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/LoopExpressionTest.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/LoopExpressionTest.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/LoopExpressionTest.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,81 @@
+package org.perfsonar.base2.service.configuration.migration.grammar;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Properties;
+
+import
org.perfsonar.base2.service.configuration.migration.grammar.LoopExpression;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class LoopExpressionTest extends TestCase {
+
+ private LoopExpression stmt;
+ protected void setUp() throws Exception {
+ super.setUp();
+ Properties props = new Properties();
+ props.setProperty("abc", "def");
+ stmt = new LoopExpression(props);
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testFilterNormalString() throws IOException {
+ final StringWriter writer = new StringWriter();
+ stmt.interpret(writer, "Ala ma kota i psa Asa.");
+ assertEquals("Ala ma kota i psa Asa.", writer.toString());
+ }
+
+ public void testFilterForString() throws IOException {
+ final StringWriter writer = new StringWriter();
+ stmt.interpret(writer, "value=\"#for(var temp string \"Ala ma
kota\" split \" \") ${temp}_#end()\"");
+ writer.flush();
+ assertEquals("value=\" Ala_ ma_ kota_\"", writer.toString());
+ }
+
+ public void testFilterForStringMultiline1() throws IOException {
+ final StringWriter writer = new StringWriter();
+ stmt.interpret(writer, "value=\"#for(var temp string \"Ala ma
kota\" split \" \")bak");
+ stmt.interpret(writer, "${temp}_#end()\"");
+ writer.flush();
+ assertEquals("value=\"bak"+ newLine()
+ + "Ala_bak" + newLine()
+ + "ma_bak" + newLine()
+ + "kota_\"", writer.toString());
+ }
+
+ public void testFilterForStringMultiline2() throws IOException {
+ final StringWriter writer = new StringWriter();
+ stmt.interpret(writer, "value=\"#for(var temp string \"Ala ma
kota\" split \" \")bak");
+ stmt.interpret(writer, "${temp}_${abc}");
+ stmt.interpret(writer, "#end()\"");
+ writer.flush();
+ assertEquals("value=\"bak"+ newLine()
+ + "Ala_defbak" + newLine()
+ + "ma_defbak" + newLine()
+ + "kota_def\"", writer.toString());
+ }
+
+ public void testFilterForStringMultiline3() throws IOException {
+ final StringWriter writer = new StringWriter();
+ stmt.interpret(writer, "<!-- Lookup Services -->#for(var
lsAddress string \"http://somewhere,https://somehow\" split \",\")");
+ stmt.interpret(writer, "<option name=\"lsAddress-1\"
value=\"${lsAddress}\" />#end()");
+ writer.flush();
+ assertEquals("<!-- Lookup Services -->"+ newLine()
+ + "<option name=\"lsAddress-1\"
value=\"http://somewhere\" />" + newLine()
+ + "<option name=\"lsAddress-1\"
value=\"https://somehow\" />",
+ writer.toString());
+
+
+
+ }
+
+ private String newLine() {
+ return System.getProperty("line.separator");
+ }
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/LoopTest.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/LoopTest.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/LoopTest.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,67 @@
+package org.perfsonar.base2.service.configuration.migration.grammar;
+
+import java.util.Properties;
+import java.util.regex.Matcher;
+
+import org.perfsonar.base2.service.configuration.migration.grammar.Loop;
+import
org.perfsonar.base2.service.configuration.migration.grammar.LoopExpression;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class LoopTest extends TestCase {
+
+ private Loop expr;
+
+ public void testPatternFor() {
+ expr = createForLoop("value=\"#for(var temp string \"Ala ma
kota\" split \" \") asdasd");
+ assertFalse(expr.isEndStatement());
+ assertTrue(expr.isForStatement());
+ assertEquals("temp", expr.getVariableName());
+ assertEquals("Ala ma kota", expr.getString());
+ assertEquals(" ", expr.getSplitRegexp());
+ }
+
+ public void testPatternEnd() {
+ expr = new Loop(createMatcher("value=\"#end()\""));
+ assertTrue(expr.isEndStatement());
+ assertFalse(expr.isForStatement());
+ }
+
+ public void testForEnd() {
+ expr = createForLoop("value=\"#for(var temp string \"Ala ma
kota\" split \" \")${var}_\"#end()\"\"");
+ assertFalse(expr.isEndStatement());
+ assertTrue(expr.isForStatement());
+ assertEquals("temp", expr.getVariableName());
+ assertEquals("Ala ma kota", expr.getString());
+ assertEquals(" ", expr.getSplitRegexp());
+ }
+
+ public void testSplit() {
+ expr = createForLoop("value=\"#for(var temp string \"Ala ma
kota\" split \" \")");
+ String[] expected = new String[3];
+ expected[0] = "Ala";
+ expected[1] = "ma";
+ expected[2] = "kota";
+ assertEqualTables(expected, expr.split());
+ }
+
+ private void assertEqualTables(String[] expected, String[] actual) {
+ if (expected.length != actual.length)
+ fail("Expected table with size=" + expected.length +
" but was " + actual.length);
+ for (int i = 0; i < actual.length; i++)
+ assertEquals(expected[i], actual[i]);
+ }
+
+ private Matcher createMatcher(String string) {
+ final Matcher result = new LoopExpression(new
Properties()).getPattern().matcher(string);
+ assertTrue(result.find());
+ return result;
+ }
+
+ private Loop createForLoop(String line) {
+ return new Loop(createMatcher(line));
+ }
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/PropertyExpressionTest.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/PropertyExpressionTest.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/PropertyExpressionTest.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,58 @@
+package org.perfsonar.base2.service.configuration.migration.grammar;
+
+import java.io.IOException;
+import java.util.Properties;
+import java.util.regex.Matcher;
+
+import
org.perfsonar.base2.service.configuration.migration.grammar.PropertyExpression;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class PropertyExpressionTest extends TestCase {
+
+ private PropertyExpression filter;
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ filter = new PropertyExpression(new Properties());
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testPropertyPatternLineWithProperty() {
+ final Matcher m = filter.getPattern().matcher("property
${prop.name}=${prop.value}.");
+ assertTrue(m.find());
+ assertEquals("prop.name", m.group(1));
+ assertTrue(m.find());
+ assertEquals("prop.value", m.group(1));
+ assertFalse(m.find());
+ }
+
+ public void testPropertyPatternLineWithoutProperty() {
+
assertFalse(filter.getPattern().matcher("property={prop.value}.").matches());
+ }
+
+ public void testFilter() throws IOException {
+ final Properties props = new Properties();
+ props.setProperty("name1", "interval");
+ props.setProperty("value1", "6000");
+ props.setProperty("name2", "enabled");
+ props.setProperty("value2", "yes");
+ filter = new PropertyExpression(props);
+ assertEquals("property interval=6000; enabled=yes",
filter.interpret("property ${name1}=${value1}; ${name2}=${value2}"));
+ }
+ public void testFilterPropertyDoesNotExist() throws IOException {
+ final Properties props = new Properties();
+ props.setProperty("name1", "interval");
+ props.setProperty("value1", "6000");
+ props.setProperty("value2", "yes");
+ filter = new PropertyExpression(props);
+ assertEquals("property interval=6000; ${name2}=yes",
filter.interpret("property ${name1}=${value1}; ${name2}=${value2}"));
+ }
+
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/AllFunctionTests.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/AllFunctionTests.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/AllFunctionTests.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,22 @@
+package org.perfsonar.base2.service.configuration.migration.grammar.function;
+
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class AllFunctionTests {
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite("Function expressions test
cases");
+ //$JUnit-BEGIN$
+ suite.addTestSuite(ReplaceFunctionTest.class);
+ suite.addTestSuite(IndexerFunctionTest.class);
+ suite.addTestSuite(FunctionExpressionTest.class);
+ //$JUnit-END$
+ return suite;
+ }
+
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/FunctionExpressionTest.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/FunctionExpressionTest.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/FunctionExpressionTest.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,36 @@
+package org.perfsonar.base2.service.configuration.migration.grammar.function;
+
+import java.io.IOException;
+
+import
org.perfsonar.base2.service.configuration.migration.grammar.function.FunctionExpression;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class FunctionExpressionTest extends TestCase {
+ private FunctionExpression filter;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ filter = new FunctionExpression();
+ }
+
+ public void testPatternLineWithFunction() {
+
assertTrue(filter.getPattern().matcher("value=\"#replace(string
\"${component.mp.xmldb.db_uri}\" regexp \"\" with \"\")\"").find());
+ }
+
+ public void testPatternLineWithoutFunction() {
+
assertFalse(filter.getPattern().matcher("property={prop.value}.").find());
+ }
+
+ public void testFilterReplace() throws IOException {
+ assertEquals("value=\"bas ${component.mp.xmldb.db_uri}
bbas\"", filter.interpret("value=\"#replace(string \"as
${component.mp.xmldb.db_uri} bas\" regexp \"as\" with \"bas\")\""));
+ }
+
+ public void testFilterFunctionNotImplemented() throws IOException {
+ assertEquals("value=\"#notImplemented()\"",
filter.interpret("value=\"#notImplemented()\""));
+ }
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/FunctionTestCase.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/FunctionTestCase.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/FunctionTestCase.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,34 @@
+package org.perfsonar.base2.service.configuration.migration.grammar.function;
+
+import java.util.regex.Matcher;
+
+import
org.perfsonar.base2.service.configuration.migration.grammar.function.Function;
+import
org.perfsonar.base2.service.configuration.migration.grammar.function.FunctionExpression;
+
+import junit.framework.TestCase;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public abstract class FunctionTestCase extends TestCase {
+
+ protected FunctionExpression filter = new FunctionExpression();
+ protected Function function;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ final Matcher temp = getFunctionMatcher(getLine());
+ assertTrue(temp.find());
+ function = new Function(temp);
+ function.reset();
+ }
+
+ private Matcher getFunctionMatcher(String line) {
+ return filter.getPattern().matcher(line);
+ }
+
+ protected abstract String getLine();
+
+ public abstract void testGetName();
+ public abstract void testGetArguments();
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/IndexerFunctionTest.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/IndexerFunctionTest.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/IndexerFunctionTest.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,24 @@
+package org.perfsonar.base2.service.configuration.migration.grammar.function;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class IndexerFunctionTest extends FunctionTestCase {
+
+ protected String getLine() {
+ return "<option name=\"lsAddress-#indexer()\"
value=\"${lsAddress}\" />";
+ }
+
+ public void testGetName() {
+ assertEquals("indexer", function.getName());
+ }
+
+ public void testGetArguments() {
+ assertEquals(0, function.getArguments().size());
+ }
+
+ public void testExecute() {
+ assertEquals("1", function.execute());
+ assertEquals("2", function.execute());
+ }
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/ReplaceFunctionTest.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/ReplaceFunctionTest.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/grammar/function/ReplaceFunctionTest.java
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,26 @@
+package org.perfsonar.base2.service.configuration.migration.grammar.function;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+public class ReplaceFunctionTest extends FunctionTestCase {
+ protected String getLine() {
+ return "value=\"#replace(string
\"${component.mp.xmldb.db_uri}\" regexp \"as\" with \"bas\")\"";
+ }
+
+ public void testGetName() {
+ assertEquals("replace", function.getName());
+ }
+
+ public void testGetArguments() {
+ Map<String, String> expected = new Hashtable<String,
String>();
+ expected.put("string", "${component.mp.xmldb.db_uri}");
+ expected.put("regexp", "as");
+ expected.put("with", "bas");
+ assertEquals(expected, function.getArguments());
+ }
+
+}
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/log4j.properties
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/log4j.properties
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/log4j.properties
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,226 @@
+## $Id$
+## project : perfSONAR
+## author: romradz
+
+##
+## All log levels in one log file.
+## By default debug level is switched off (commented).
+##
+
+# Group=Log levels
+# Description=Assigns debug log messages to the specified log appender.
+#log4j.logger.sonar-debug=DEBUG, psRootAppender
+
+# Group=Log levels
+# Description=Assigns info log messages to the specified log appender.
+#log4j.logger.sonar-info=INFO, psRootAppender
+
+# Group=Log levels
+# Description=Assigns warn log messages to the specified log appender.
+#log4j.logger.sonar-warn=WARN, psRootAppender
+
+# Group=Log levels
+# Description=Assigns error log messages to the specified log appender.
+#log4j.logger.sonar-error=ERROR, psRootAppender
+
+# Group=Log levels
+# Description=Assigns fatal log messages to the specified log appender.
+#log4j.logger.sonar-fatal=FATAL, psRootAppender
+
+
+
+##
+## Uncomment this block (and comment the one above)
+## if you want to have log levels in separate log files
+##
+## this section is only for developer tests
+##
+log4j.logger.sonar-debug=DEBUG, debugAppender, psRootAppender
+log4j.logger.sonar-info=INFO, infoAppender, psRootAppender
+log4j.logger.sonar-warn=WARN, warnAppender, psRootAppender
+log4j.logger.sonar-error=ERROR, errorAppender, psRootAppender
+log4j.logger.sonar-fatal=FATAL, fatalAppender, psRootAppender
+
+
+
+
+######################################### DEBUG
#######################################
+
+# Group=Debug message logging
+# Description=The maximum number of backup log files to create.
+log4j.appender.debugAppender.MaxBackupIndex=11
+
+# Group=Debug message logging
+# Description=The path to the log file, including the log file's name.
+log4j.appender.debugAppender.File=/var/log/ps-mdm-sshtelnet-mp/perfsonar_debug.log
+
+# Group=Debug message logging
+# Description=The class responsible for the logging layout.
+log4j.appender.debugAppender.layout=org.apache.log4j.PatternLayout
+
+# Group=Debug message logging
+# Description=The log message format.
+log4j.appender.debugAppender.layout.ConversionPattern=%d
%%GEANT2-JAVA-SSHTELNET-MP.%p%% %m%n
+
+# Group=Debug message logging
+# Description=The maximum size the log file can reach before it replaces the
oldest backup file and a new log file is started.
+log4j.appender.debugAppender.MaxFileSize=500KB
+
+# Group=Debug message logging
+# Description=The class responsible for appending log messages to the log
file.
+log4j.appender.debugAppender=org.apache.log4j.RollingFileAppender
+
+
+
+######################################### INFO
########################################
+
+# Group=Info message logging
+# Description=The maximum number of backup log files to create.
+log4j.appender.infoAppender.MaxBackupIndex=11
+
+# Group=Info message logging
+# Description=The path to the log file, including the log file's name.
+log4j.appender.infoAppender.File=/var/log/ps-mdm-sshtelnet-mp/perfsonar_info.log
+
+# Group=Info message logging
+# Description=The class responsible for the logging layout.
+log4j.appender.infoAppender.layout=org.apache.log4j.PatternLayout
+
+# Group=Info message logging
+# Description=The log message format.
+log4j.appender.infoAppender.layout.ConversionPattern=%d
%%GEANT2-JAVA-SSHTELNET-MP.%p%% %m%n
+
+# Group=Info message logging
+# Description=The maximum size the log file can reach before it replaces the
oldest backup file and a new log file is started.
+log4j.appender.infoAppender.MaxFileSize=500KB
+
+# Group=Info message logging
+# Description=The class responsible for appending log messages to the log
file.
+log4j.appender.infoAppender=org.apache.log4j.RollingFileAppender
+
+
+
+######################################### WARN
########################################
+
+# Group=Warn message logging
+# Description=The maximum number of backup log files to create.
+log4j.appender.warnAppender.MaxBackupIndex=11
+
+# Group=Warn message logging
+# Description=The path to the log file, including the log file's name.
+log4j.appender.warnAppender.File=/var/log/ps-mdm-sshtelnet-mp/perfsonar_warn.log
+
+# Group=Warn message logging
+# Description=The class responsible for the logging layout.
+log4j.appender.warnAppender.layout=org.apache.log4j.PatternLayout
+
+# Group=Warn message logging
+# Description=The log message format.
+log4j.appender.warnAppender.layout.ConversionPattern=%d
%%GEANT2-JAVA-SSHTELNET-MP.%p%% %m%n
+
+# Group=Warn message logging
+# Description=The maximum size the log file can reach before it replaces the
oldest backup file and a new log file is started.
+log4j.appender.warnAppender.MaxFileSize=500KB
+
+# Group=Warn message logging
+# Description=The class responsible for appending log messages to the log
file.
+log4j.appender.warnAppender=org.apache.log4j.RollingFileAppender
+
+
+
+######################################### ERROR
#######################################
+
+# Group=Error message logging
+# Description=The maximum number of backup log files to create.
+log4j.appender.errorAppender.MaxBackupIndex=11
+
+# Group=Error message logging
+# Description=The path to the log file, including the log file's name.
+log4j.appender.errorAppender.File=/var/log/ps-mdm-sshtelnet-mp/perfsonar_error.log
+
+# Group=Error message logging
+# Description=The class responsible for the logging layout.
+log4j.appender.errorAppender.layout=org.apache.log4j.PatternLayout
+
+# Group=Error message logging
+# Description=The log message format.
+log4j.appender.errorAppender.layout.ConversionPattern=%d
%%GEANT2-JAVA-SSHTELNET-MP.%p%% %m%n
+
+# Group=Error message logging
+# Description=The maximum size the log file can reach before it replaces the
oldest backup file and a new log file is started.
+log4j.appender.errorAppender.MaxFileSize=500KB
+
+# Group=Error message logging
+# Description=The class responsible for appending log messages to the log
file.
+log4j.appender.errorAppender=org.apache.log4j.RollingFileAppender
+
+
+
+######################################### FATAL
#######################################
+
+# Group=Fatal message logging
+# Description=The maximum number of backup log files to create.
+log4j.appender.fatalAppender.MaxBackupIndex=11
+
+# Group=Fatal message logging
+# Description=The path to the log file, including the log file's name.
+log4j.appender.fatalAppender.File=/var/log/ps-mdm-sshtelnet-mp/perfsonar_fatal.log
+
+# Group=Fatal message logging
+# Description=The class responsible for the logging layout.
+log4j.appender.fatalAppender.layout=org.apache.log4j.PatternLayout
+
+# Group=Fatal message logging
+# Description=The log message format.
+log4j.appender.fatalAppender.layout.ConversionPattern=%d
%%GEANT2-JAVA-SSHTELNET-MP.%p%% %m%n
+
+# Group=Fatal message logging
+# Description=The maximum size the log file can reach before it replaces the
oldest backup file and a new log file is started.
+log4j.appender.fatalAppender.MaxFileSize=500KB
+
+# Group=Fatal message logging
+# Description=The class responsible for appending log messages to the log
file.
+log4j.appender.fatalAppender=org.apache.log4j.RollingFileAppender
+
+
+
+######################################### ALL
#########################################
+
+# Group=All message logging
+# Description=The maximum number of backup log files to create.
+log4j.appender.psRootAppender.MaxBackupIndex=11
+
+# Group=All message logging
+# Description=The path to the log file, including the log file's name.
+log4j.appender.psRootAppender.File=/var/log/ps-mdm-sshtelnet-mp/perfsonar.log
+
+# Group=All message logging
+# Description=The class responsible for the logging layout.
+log4j.appender.psRootAppender.layout=org.apache.log4j.PatternLayout
+
+# Group=All message logging
+# Description=The log message format.
+log4j.appender.psRootAppender.layout.ConversionPattern=%d
%%GEANT2-JAVA-SSHTELNET-MP.%p%% %m%n
+
+# Group=All message logging
+# Description=The maximum size the log file can reach before it replaces the
oldest backup file and a new log file is started.
+log4j.appender.psRootAppender.MaxFileSize=500KB
+
+# Group=All message logging
+# Description=The class responsible for appending log messages to the log
file.
+log4j.appender.psRootAppender=org.apache.log4j.RollingFileAppender
+
+
+
+######################################### ROOT
#########################################
+
+# this section is only for developer's tests
+
+# ROOT
+#log4j.appender.rootAppender.MaxBackupIndex=11
+#log4j.appender.rootAppender.File=/var/log/ps-mdm-sshtelnet-mp/perfsonar_root.log
+#log4j.appender.rootAppender.layout=org.apache.log4j.PatternLayout
+#log4j.appender.rootAppender.layout.ConversionPattern=%d
%%GEANT2-JAVA-SSHTELNET-MP.%p%% %m%n
+#log4j.rootLogger=DEBUG, rootAppender
+#log4j.appender.rootAppender.MaxFileSize=500KB
+#log4j.appender.rootAppender=org.apache.log4j.RollingFileAppender
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/objects.config
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/objects.config
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/objects.config
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,181 @@
+http://ggf.org/ns/nmwg/base/2.0/commonTime/
org.ggf.ns.nmwg.base.v2_0.CommonTime
+http://ggf.org/ns/nmwg/base/2.0/store/ org.ggf.ns.nmwg.base.v2_0.Store
+http://ggf.org/ns/nmwg/base/2.0/message/
org.ggf.ns.nmwg.base.v2_0.Message
+http://ggf.org/ns/nmwg/base/2.0/element/
org.ggf.ns.nmwg.base.v2_0.Element
+http://ggf.org/ns/nmwg/base/2.0/metadata/
org.ggf.ns.nmwg.base.v2_0.Metadata
+http://ggf.org/ns/nmwg/base/2.0/eventType/
org.ggf.ns.nmwg.base.v2_0.EventType
+http://ggf.org/ns/nmwg/base/2.0/parameter/
org.ggf.ns.nmwg.base.v2_0.Parameter
+http://ggf.org/ns/nmwg/base/2.0/subject/
org.ggf.ns.nmwg.base.v2_0.Subject
+http://ggf.org/ns/nmwg/base/2.0/data/ org.ggf.ns.nmwg.base.v2_0.Data
+http://ggf.org/ns/nmwg/base/2.0/parameters/
org.ggf.ns.nmwg.base.v2_0.Parameters
+http://ggf.org/ns/nmwg/base/2.0/key/ org.ggf.ns.nmwg.base.v2_0.Key
+http://ggf.org/ns/nmwg/base/2.0/datum/ org.ggf.ns.nmwg.base.v2_0.Datum
+http://ggf.org/ns/nmwg/characteristic/utilization/2.0/subject/
org.ggf.ns.nmwg.characteristic.utilization.v2_0.Subject
+http://ggf.org/ns/nmwg/characteristic/utilization/2.0/parameters/
org.ggf.ns.nmwg.characteristic.utilization.v2_0.Parameters
+http://ggf.org/ns/nmwg/characteristic/utilization/2.0/datum/
org.ggf.ns.nmwg.characteristic.utilization.v2_0.Datum
+http://ggf.org/ns/nmwg/event/status/base/2.0/stateAdmin/
org.ggf.ns.nmwg.event.status.base.v2_0.StateAdmin
+http://ggf.org/ns/nmwg/event/status/base/2.0/stateOper/
org.ggf.ns.nmwg.event.status.base.v2_0.StateOper
+http://ggf.org/ns/nmwg/event/status/base/2.0/datum/
org.ggf.ns.nmwg.event.status.base.v2_0.Datum
+http://ggf.org/ns/nmwg/ops/average/2.0/subject/
org.ggf.ns.nmwg.ops.average.v2_0.Subject
+http://ggf.org/ns/nmwg/ops/average/2.0/parameters/
org.ggf.ns.nmwg.ops.average.v2_0.Parameters
+http://ggf.org/ns/nmwg/ops/cdf/2.0/subject/
org.ggf.ns.nmwg.ops.cdf.v2_0.Subject
+http://ggf.org/ns/nmwg/ops/cdf/2.0/parameters/
org.ggf.ns.nmwg.ops.cdf.v2_0.Parameters
+http://ggf.org/ns/nmwg/ops/histogram/2.0/subject/
org.ggf.ns.nmwg.ops.histogram.v2_0.Subject
+http://ggf.org/ns/nmwg/ops/histogram/2.0/parameters/
org.ggf.ns.nmwg.ops.histogram.v2_0.Parameters
+http://ggf.org/ns/nmwg/ops/max/2.0/subject/
org.ggf.ns.nmwg.ops.max.v2_0.Subject
+http://ggf.org/ns/nmwg/ops/max/2.0/parameters/
org.ggf.ns.nmwg.ops.max.v2_0.Parameters
+http://ggf.org/ns/nmwg/ops/mean/2.0/subject/
org.ggf.ns.nmwg.ops.mean.v2_0.Subject
+http://ggf.org/ns/nmwg/ops/mean/2.0/parameters/
org.ggf.ns.nmwg.ops.mean.v2_0.Parameters
+http://ggf.org/ns/nmwg/ops/median/2.0/subject/
org.ggf.ns.nmwg.ops.median.v2_0.Subject
+http://ggf.org/ns/nmwg/ops/median/2.0/parameters/
org.ggf.ns.nmwg.ops.median.v2_0.Parameters
+http://ggf.org/ns/nmwg/ops/min/2.0/subject/
org.ggf.ns.nmwg.ops.min.v2_0.Subject
+http://ggf.org/ns/nmwg/ops/min/2.0/parameters/
org.ggf.ns.nmwg.ops.min.v2_0.Parameters
+http://ggf.org/ns/nmwg/ops/select/2.0/subject/
org.ggf.ns.nmwg.ops.select.v2_0.Subject
+http://ggf.org/ns/nmwg/ops/select/2.0/parameters/
org.ggf.ns.nmwg.ops.select.v2_0.Parameters
+http://ggf.org/ns/nmwg/result/2.0/datum/
org.ggf.ns.nmwg.result.v2_0.Datum
+http://ggf.org/ns/nmwg/time/2.0/end/ org.ggf.ns.nmwg.time.v2_0.End
+http://ggf.org/ns/nmwg/time/2.0/time/ org.ggf.ns.nmwg.time.v2_0.Time
+http://ggf.org/ns/nmwg/time/2.0/value/ org.ggf.ns.nmwg.time.v2_0.Value
+http://ggf.org/ns/nmwg/time/2.0/start/ org.ggf.ns.nmwg.time.v2_0.Start
+http://ggf.org/ns/nmwg/tools/bwctl/2.0/subject/
org.ggf.ns.nmwg.tools.bwctl.v2_0.Subject
+http://ggf.org/ns/nmwg/tools/bwctl/2.0/parameters/
org.ggf.ns.nmwg.tools.bwctl.v2_0.Parameters
+http://ggf.org/ns/nmwg/tools/bwctl/2.0/datum/
org.ggf.ns.nmwg.tools.bwctl.v2_0.Datum
+http://ggf.org/ns/nmwg/tools/iperf/2.0/subject/
org.ggf.ns.nmwg.tools.iperf.v2_0.Subject
+http://ggf.org/ns/nmwg/tools/iperf/2.0/parameters/
org.ggf.ns.nmwg.tools.iperf.v2_0.Parameters
+http://ggf.org/ns/nmwg/tools/iperf/2.0/datum/
org.ggf.ns.nmwg.tools.iperf.v2_0.Datum
+http://ggf.org/ns/nmwg/tools/netflow/2.0/name/
org.ggf.ns.nmwg.tools.netflow.v2_0.Name
+http://ggf.org/ns/nmwg/tools/netflow/2.0/transportFormats/
org.ggf.ns.nmwg.tools.netflow.v2_0.TransportFormats
+http://ggf.org/ns/nmwg/tools/netflow/2.0/router/
org.ggf.ns.nmwg.tools.netflow.v2_0.Router
+http://ggf.org/ns/nmwg/tools/netflow/2.0/description/
org.ggf.ns.nmwg.tools.netflow.v2_0.Description
+http://ggf.org/ns/nmwg/tools/netflow/2.0/transportFormat/
org.ggf.ns.nmwg.tools.netflow.v2_0.TransportFormat
+http://ggf.org/ns/nmwg/tools/netflow/2.0/flowFormat/
org.ggf.ns.nmwg.tools.netflow.v2_0.FlowFormat
+http://ggf.org/ns/nmwg/tools/netflow/2.0/subject/
org.ggf.ns.nmwg.tools.netflow.v2_0.Subject
+http://ggf.org/ns/nmwg/tools/netflow/2.0/parameters/
org.ggf.ns.nmwg.tools.netflow.v2_0.Parameters
+http://ggf.org/ns/nmwg/tools/netflow/2.0/flowFormats/
org.ggf.ns.nmwg.tools.netflow.v2_0.FlowFormats
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/sql/1.0/subject/
org.ggf.ns.nmwg.tools.org.perfsonar.service.lookup.sql.v1_0.Subject
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/sql/1.0/parameters/
org.ggf.ns.nmwg.tools.org.perfsonar.service.lookup.sql.v1_0.Parameters
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/sql/1.0/datum/
org.ggf.ns.nmwg.tools.org.perfsonar.service.lookup.sql.v1_0.Datum
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xpath/1.0/subject/
org.ggf.ns.nmwg.tools.org.perfsonar.service.lookup.xpath.v1_0.Subject
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xpath/1.0/parameters/
org.ggf.ns.nmwg.tools.org.perfsonar.service.lookup.xpath.v1_0.Parameters
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xpath/1.0/datum/
org.ggf.ns.nmwg.tools.org.perfsonar.service.lookup.xpath.v1_0.Datum
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xquery/1.0/subject/
org.ggf.ns.nmwg.tools.org.perfsonar.service.lookup.xquery.v1_0.Subject
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xquery/1.0/parameters/
org.ggf.ns.nmwg.tools.org.perfsonar.service.lookup.xquery.v1_0.Parameters
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/lookup/xquery/1.0/datum/
org.ggf.ns.nmwg.tools.org.perfsonar.service.lookup.xquery.v1_0.Datum
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/serviceDescription/
org.ggf.ns.nmwg.tools.org.perfsonar.service.v1_0.ServiceDescription
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/accessPoint/
org.ggf.ns.nmwg.tools.org.perfsonar.service.v1_0.AccessPoint
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/service/
org.ggf.ns.nmwg.tools.org.perfsonar.service.v1_0.Service
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/subject/
org.ggf.ns.nmwg.tools.org.perfsonar.service.v1_0.Subject
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/parameters/
org.ggf.ns.nmwg.tools.org.perfsonar.service.v1_0.Parameters
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/serviceType/
org.ggf.ns.nmwg.tools.org.perfsonar.service.v1_0.ServiceType
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/serviceName/
org.ggf.ns.nmwg.tools.org.perfsonar.service.v1_0.ServiceName
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/serviceVersion/
org.ggf.ns.nmwg.tools.org.perfsonar.service.v1_0.ServiceVersion
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/organization/
org.ggf.ns.nmwg.tools.org.perfsonar.service.v1_0.Organization
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/contactEmail/
org.ggf.ns.nmwg.tools.org.perfsonar.service.v1_0.ContactEmail
+http://ggf.org/ns/nmwg/tools/org/perfsonar/service/1.0/datum/
org.ggf.ns.nmwg.tools.org.perfsonar.service.v1_0.Datum
+http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/subject/
org.ggf.ns.nmwg.tools.org.perfsonar.v1_0.Subject
+http://ggf.org/ns/nmwg/tools/org/perfsonar/1.0/parameters/
org.ggf.ns.nmwg.tools.org.perfsonar.v1_0.Parameters
+http://ggf.org/ns/nmwg/tools/owamp/2.0/subject/
org.ggf.ns.nmwg.tools.owamp.v2_0.Subject
+http://ggf.org/ns/nmwg/tools/owamp/2.0/parameters/
org.ggf.ns.nmwg.tools.owamp.v2_0.Parameters
+http://ggf.org/ns/nmwg/tools/owamp/2.0/datum/
org.ggf.ns.nmwg.tools.owamp.v2_0.Datum
+http://ggf.org/ns/nmwg/tools/passivetracefile/2.0/subject/
org.ggf.ns.nmwg.tools.passivetracefile.v2_0.Subject
+http://ggf.org/ns/nmwg/tools/passivetracefile/2.0/parameters/
org.ggf.ns.nmwg.tools.passivetracefile.v2_0.Parameters
+http://ggf.org/ns/nmwg/tools/passivetracefile/2.0/datum/
org.ggf.ns.nmwg.tools.passivetracefile.v2_0.Datum
+http://ggf.org/ns/nmwg/tools/ping/2.0/subject/
org.ggf.ns.nmwg.tools.ping.v2_0.Subject
+http://ggf.org/ns/nmwg/tools/ping/2.0/parameters/
org.ggf.ns.nmwg.tools.ping.v2_0.Parameters
+http://ggf.org/ns/nmwg/tools/ping/2.0/datum/
org.ggf.ns.nmwg.tools.ping.v2_0.Datum
+http://ggf.org/ns/nmwg/tools/schedule/2.0/subject/
org.ggf.ns.nmwg.tools.schedule.v2_0.Subject
+http://ggf.org/ns/nmwg/tools/schedule/2.0/parameters/
org.ggf.ns.nmwg.tools.schedule.v2_0.Parameters
+http://ggf.org/ns/nmwg/tools/schedule/2.0/datum/
org.ggf.ns.nmwg.tools.schedule.v2_0.Datum
+http://ggf.org/ns/nmwg/tools/traceroute/2.0/subject/
org.ggf.ns.nmwg.tools.traceroute.v2_0.Subject
+http://ggf.org/ns/nmwg/tools/traceroute/2.0/parameters/
org.ggf.ns.nmwg.tools.traceroute.v2_0.Parameters
+http://ggf.org/ns/nmwg/tools/traceroute/2.0/datum/
org.ggf.ns.nmwg.tools.traceroute.v2_0.Datum
+http://ggf.org/ns/nmwg/topology/base/3.0/name/
org.ggf.ns.nmwg.topology.base.v3_0.Name
+http://ggf.org/ns/nmwg/topology/base/3.0/zipCode/
org.ggf.ns.nmwg.topology.base.v3_0.ZipCode
+http://ggf.org/ns/nmwg/topology/base/3.0/city/
org.ggf.ns.nmwg.topology.base.v3_0.City
+http://ggf.org/ns/nmwg/topology/base/3.0/network/
org.ggf.ns.nmwg.topology.base.v3_0.Network
+http://ggf.org/ns/nmwg/topology/base/3.0/ifIndex/
org.ggf.ns.nmwg.topology.base.v3_0.IfIndex
+http://ggf.org/ns/nmwg/topology/base/3.0/hostName/
org.ggf.ns.nmwg.topology.base.v3_0.HostName
+http://ggf.org/ns/nmwg/topology/base/3.0/rack/
org.ggf.ns.nmwg.topology.base.v3_0.Rack
+http://ggf.org/ns/nmwg/topology/base/3.0/location/
org.ggf.ns.nmwg.topology.base.v3_0.Location
+http://ggf.org/ns/nmwg/topology/base/3.0/node/
org.ggf.ns.nmwg.topology.base.v3_0.Node
+http://ggf.org/ns/nmwg/topology/base/3.0/description/
org.ggf.ns.nmwg.topology.base.v3_0.Description
+http://ggf.org/ns/nmwg/topology/base/3.0/path/
org.ggf.ns.nmwg.topology.base.v3_0.Path
+http://ggf.org/ns/nmwg/topology/base/3.0/streetAddress/
org.ggf.ns.nmwg.topology.base.v3_0.StreetAddress
+http://ggf.org/ns/nmwg/topology/base/3.0/globalName/
org.ggf.ns.nmwg.topology.base.v3_0.GlobalName
+http://ggf.org/ns/nmwg/topology/base/3.0/capacity/
org.ggf.ns.nmwg.topology.base.v3_0.Capacity
+http://ggf.org/ns/nmwg/topology/base/3.0/ifName/
org.ggf.ns.nmwg.topology.base.v3_0.IfName
+http://ggf.org/ns/nmwg/topology/base/3.0/room/
org.ggf.ns.nmwg.topology.base.v3_0.Room
+http://ggf.org/ns/nmwg/topology/base/3.0/institution/
org.ggf.ns.nmwg.topology.base.v3_0.Institution
+http://ggf.org/ns/nmwg/topology/base/3.0/shelf/
org.ggf.ns.nmwg.topology.base.v3_0.Shelf
+http://ggf.org/ns/nmwg/topology/base/3.0/role/
org.ggf.ns.nmwg.topology.base.v3_0.Role
+http://ggf.org/ns/nmwg/topology/base/3.0/country/
org.ggf.ns.nmwg.topology.base.v3_0.Country
+http://ggf.org/ns/nmwg/topology/base/3.0/index/
org.ggf.ns.nmwg.topology.base.v3_0.Index
+http://ggf.org/ns/nmwg/topology/base/3.0/address/
org.ggf.ns.nmwg.topology.base.v3_0.Address
+http://ggf.org/ns/nmwg/topology/base/3.0/operSys/
org.ggf.ns.nmwg.topology.base.v3_0.OperSys
+http://ggf.org/ns/nmwg/topology/base/3.0/type/
org.ggf.ns.nmwg.topology.base.v3_0.Type
+http://ggf.org/ns/nmwg/topology/base/3.0/long/
org.ggf.ns.nmwg.topology.base.v3_0.Long
+http://ggf.org/ns/nmwg/topology/base/3.0/longitude/
org.ggf.ns.nmwg.topology.base.v3_0.Longitude
+http://ggf.org/ns/nmwg/topology/base/3.0/cpu/
org.ggf.ns.nmwg.topology.base.v3_0.Cpu
+http://ggf.org/ns/nmwg/topology/base/3.0/ifDescription/
org.ggf.ns.nmwg.topology.base.v3_0.IfDescription
+http://ggf.org/ns/nmwg/topology/base/3.0/floor/
org.ggf.ns.nmwg.topology.base.v3_0.Floor
+http://ggf.org/ns/nmwg/topology/base/3.0/cage/
org.ggf.ns.nmwg.topology.base.v3_0.Cage
+http://ggf.org/ns/nmwg/topology/base/3.0/lat/
org.ggf.ns.nmwg.topology.base.v3_0.Lat
+http://ggf.org/ns/nmwg/topology/base/3.0/latitude/
org.ggf.ns.nmwg.topology.base.v3_0.Latitude
+http://ggf.org/ns/nmwg/topology/base/3.0/state/
org.ggf.ns.nmwg.topology.base.v3_0.State
+http://ggf.org/ns/nmwg/topology/base/3.0/interface/
org.ggf.ns.nmwg.topology.base.v3_0.Interface
+http://ggf.org/ns/nmwg/topology/base/3.0/link/
org.ggf.ns.nmwg.topology.base.v3_0.Link
+http://ggf.org/ns/nmwg/topology/l2/3.0/name/
org.ggf.ns.nmwg.topology.l2.v3_0.Name
+http://ggf.org/ns/nmwg/topology/l2/3.0/network/
org.ggf.ns.nmwg.topology.l2.v3_0.Network
+http://ggf.org/ns/nmwg/topology/l2/3.0/ifIndex/
org.ggf.ns.nmwg.topology.l2.v3_0.IfIndex
+http://ggf.org/ns/nmwg/topology/l2/3.0/description/
org.ggf.ns.nmwg.topology.l2.v3_0.Description
+http://ggf.org/ns/nmwg/topology/l2/3.0/path/
org.ggf.ns.nmwg.topology.l2.v3_0.Path
+http://ggf.org/ns/nmwg/topology/l2/3.0/globalName/
org.ggf.ns.nmwg.topology.l2.v3_0.GlobalName
+http://ggf.org/ns/nmwg/topology/l2/3.0/capacity/
org.ggf.ns.nmwg.topology.l2.v3_0.Capacity
+http://ggf.org/ns/nmwg/topology/l2/3.0/vlan/
org.ggf.ns.nmwg.topology.l2.v3_0.Vlan
+http://ggf.org/ns/nmwg/topology/l2/3.0/role/
org.ggf.ns.nmwg.topology.l2.v3_0.Role
+http://ggf.org/ns/nmwg/topology/l2/3.0/index/
org.ggf.ns.nmwg.topology.l2.v3_0.Index
+http://ggf.org/ns/nmwg/topology/l2/3.0/address/
org.ggf.ns.nmwg.topology.l2.v3_0.Address
+http://ggf.org/ns/nmwg/topology/l2/3.0/type/
org.ggf.ns.nmwg.topology.l2.v3_0.Type
+http://ggf.org/ns/nmwg/topology/l2/3.0/ifHostName/
org.ggf.ns.nmwg.topology.l2.v3_0.IfHostName
+http://ggf.org/ns/nmwg/topology/l2/3.0/interface/
org.ggf.ns.nmwg.topology.l2.v3_0.Interface
+http://ggf.org/ns/nmwg/topology/l2/3.0/link/
org.ggf.ns.nmwg.topology.l2.v3_0.Link
+http://ggf.org/ns/nmwg/topology/l3/3.0/name/
org.ggf.ns.nmwg.topology.l3.v3_0.Name
+http://ggf.org/ns/nmwg/topology/l3/3.0/network/
org.ggf.ns.nmwg.topology.l3.v3_0.Network
+http://ggf.org/ns/nmwg/topology/l3/3.0/ifIndex/
org.ggf.ns.nmwg.topology.l3.v3_0.IfIndex
+http://ggf.org/ns/nmwg/topology/l3/3.0/subnet/
org.ggf.ns.nmwg.topology.l3.v3_0.Subnet
+http://ggf.org/ns/nmwg/topology/l3/3.0/netmask/
org.ggf.ns.nmwg.topology.l3.v3_0.Netmask
+http://ggf.org/ns/nmwg/topology/l3/3.0/path/
org.ggf.ns.nmwg.topology.l3.v3_0.Path
+http://ggf.org/ns/nmwg/topology/l3/3.0/globalName/
org.ggf.ns.nmwg.topology.l3.v3_0.GlobalName
+http://ggf.org/ns/nmwg/topology/l3/3.0/capacity/
org.ggf.ns.nmwg.topology.l3.v3_0.Capacity
+http://ggf.org/ns/nmwg/topology/l3/3.0/ifName/
org.ggf.ns.nmwg.topology.l3.v3_0.IfName
+http://ggf.org/ns/nmwg/topology/l3/3.0/ipAddress/
org.ggf.ns.nmwg.topology.l3.v3_0.IpAddress
+http://ggf.org/ns/nmwg/topology/l3/3.0/role/
org.ggf.ns.nmwg.topology.l3.v3_0.Role
+http://ggf.org/ns/nmwg/topology/l3/3.0/index/
org.ggf.ns.nmwg.topology.l3.v3_0.Index
+http://ggf.org/ns/nmwg/topology/l3/3.0/type/
org.ggf.ns.nmwg.topology.l3.v3_0.Type
+http://ggf.org/ns/nmwg/topology/l3/3.0/ifHostName/
org.ggf.ns.nmwg.topology.l3.v3_0.IfHostName
+http://ggf.org/ns/nmwg/topology/l3/3.0/ifDescription/
org.ggf.ns.nmwg.topology.l3.v3_0.IfDescription
+http://ggf.org/ns/nmwg/topology/l3/3.0/ifAddress/
org.ggf.ns.nmwg.topology.l3.v3_0.IfAddress
+http://ggf.org/ns/nmwg/topology/l3/3.0/asn/
org.ggf.ns.nmwg.topology.l3.v3_0.Asn
+http://ggf.org/ns/nmwg/topology/l3/3.0/interface/
org.ggf.ns.nmwg.topology.l3.v3_0.Interface
+http://ggf.org/ns/nmwg/topology/l3/3.0/link/
org.ggf.ns.nmwg.topology.l3.v3_0.Link
+http://ggf.org/ns/nmwg/topology/l4/3.0/endPoint/
org.ggf.ns.nmwg.topology.l4.v3_0.EndPoint
+http://ggf.org/ns/nmwg/topology/l4/3.0/path/
org.ggf.ns.nmwg.topology.l4.v3_0.Path
+http://ggf.org/ns/nmwg/topology/l4/3.0/role/
org.ggf.ns.nmwg.topology.l4.v3_0.Role
+http://ggf.org/ns/nmwg/topology/l4/3.0/address/
org.ggf.ns.nmwg.topology.l4.v3_0.Address
+http://ggf.org/ns/nmwg/topology/l4/3.0/endPointPair/
org.ggf.ns.nmwg.topology.l4.v3_0.EndPointPair
+http://ggf.org/ns/nmwg/topology/2.0/endPoint/
org.ggf.ns.nmwg.topology.v2_0.EndPoint
+http://ggf.org/ns/nmwg/topology/2.0/classOfService/
org.ggf.ns.nmwg.topology.v2_0.ClassOfService
+http://ggf.org/ns/nmwg/topology/2.0/src/
org.ggf.ns.nmwg.topology.v2_0.Src
+http://ggf.org/ns/nmwg/topology/2.0/ifIndex/
org.ggf.ns.nmwg.topology.v2_0.IfIndex
+http://ggf.org/ns/nmwg/topology/2.0/hostName/
org.ggf.ns.nmwg.topology.v2_0.HostName
+http://ggf.org/ns/nmwg/topology/2.0/dst/
org.ggf.ns.nmwg.topology.v2_0.Dst
+http://ggf.org/ns/nmwg/topology/2.0/direction/
org.ggf.ns.nmwg.topology.v2_0.Direction
+http://ggf.org/ns/nmwg/topology/2.0/capacity/
org.ggf.ns.nmwg.topology.v2_0.Capacity
+http://ggf.org/ns/nmwg/topology/2.0/ifName/
org.ggf.ns.nmwg.topology.v2_0.IfName
+http://ggf.org/ns/nmwg/topology/2.0/authRealm/
org.ggf.ns.nmwg.topology.v2_0.AuthRealm
+http://ggf.org/ns/nmwg/topology/2.0/ipAddress/
org.ggf.ns.nmwg.topology.v2_0.IpAddress
+http://ggf.org/ns/nmwg/topology/2.0/type/
org.ggf.ns.nmwg.topology.v2_0.Type
+http://ggf.org/ns/nmwg/topology/2.0/ifDescription/
org.ggf.ns.nmwg.topology.v2_0.IfDescription
+http://ggf.org/ns/nmwg/topology/2.0/ifAddress/
org.ggf.ns.nmwg.topology.v2_0.IfAddress
+http://ggf.org/ns/nmwg/topology/2.0/endPointPair/
org.ggf.ns.nmwg.topology.v2_0.EndPointPair
+http://ggf.org/ns/nmwg/topology/2.0/interface/
org.ggf.ns.nmwg.topology.v2_0.Interface
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/service.properties
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/service.properties
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/service.properties
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,130 @@
+#Changed at Wed Jan 30 11:12:44 CET 2008
+#Wed Jan 30 11:12:44 CET 2008
+
+#eXist Properties
+#----------------
+
+# Group=eXist
+# Description=The administrator password for the eXist DB.
+component.mp.xmldb.db_adminpassword=admin
+
+# Group=eXist
+# Description=The username for the eXist DB.
+component.mp.xmldb.db_username=sshtelnet
+
+# Group=eXist
+# Description=The name of the metadata configuration file which is to be
uploaded in the eXist.
+component.mp.xmldb.metadata_file_name=sshtelnetmetadata.xml
+
+#Group=eXist
+# Description=The location of the metadata configuration file which is to be
uploaded in the eXist
+component.mp.xmldb.metadata_file_path=/etc/ps-mdm-sshtelnet-mp/sshtelnetmetadata.xml
+
+# Group=eXist
+# Description=The URL to the eXist DB.
+component.mp.xmldb.db_uri=xmldb\:exist\://127.0.0.1\:8080/exist/xmlrpc/db
+
+# Group=eXist
+# Description=The user password for the eXist DB.
+component.mp.xmldb.db_password=sshtelnet
+
+# Group=eXist
+# Description=The type of access for the eXist database (has to be xmlrpc)
+component.mp.xmldb.db_access=xmlrpc
+
+#Internal properties
+#-------------------
+
+# Group=Internal
+# Description=The path to the log4j.properties configuration file. If you
want to enable syslog message logging, enter the path to the
log4j.syslog.properties file instead.
+service.log.log4j.config=/etc/ps-mdm-sshtelnet-mp/log4j.properties
+
+# Group=Internal
+# Description=The name of the class which is responsible for handling the
requests
+service.mp.class_name=org.perfsonar.service.measurementPoint.lookingGlassType.engine.adapters.WebserviceEngineAdapter
+
+# Group=Internal
+# Description=The location of the configuration for the SAX parser
+service.sax_parser.config=/etc/ps-mdm-sshtelnet-mp/objects.config
+
+# Group=Internal
+# Description=A CSV of request message types supported by the service.
+service.mp.message_types=SetupDataRequest,MetadataKeyRequest,EchoRequest
+
+# Group=Internal
+# Description=Type of service
+service.r.type=mp
+
+# Group=Internal
+# Description=The path where the temporary token files will be stored (be
sure to make the path writable!)
+service.mp.tokenPath=/usr/lib/perfsonar/services/ps-mdm-sshtelnet-mp/WEB-INF/classes/perfsonar/
+
+#LS properties
+#-------------
+
+# Group=LS
+# Description=The service type.
+service.r.service_type=mp
+
+# Group=LS
+# Description=The URL address of the LS service.
+service.r.ls_url=http://somewhere,https://somehow
+
+# Group=LS
+# Description=The URL address of the service configured by this
configuration file.
+service.r.access_point=http://somewhere
+
+# Group=LS
+# Description=The name of the organisation who is deploying the service.
+service.r.organization_name=X
+
+# Group=LS
+# Description=The name of the service (can contain multiple words).
+service.r.service_name=geant2-java-sshtelnet-mp
+
+# Group=LS
+# Description=The version number of the service.
+service.r.service_version=1.3.4.1
+
+# Group=LS
+# Description=The email address of the person who manages the service.
+service.r.contact_email=user@domain
+
+# Group=LS
+# Description=The description of the service.
+service.r.service_description=perfSONAR service
+
+# Group=LS
+# Description=The time (miliseconds) between register requests to the LS
service (default value is 43200000 ms; 12 hours).
+component.registrator.interval=43200000
+
+# Group=LS
+# Description=The name of the scheduler component (the implementation of
this component must also be declared in the components.properties file).
+component.registrator.scheduler_component=scheduler
+
+# Group=LS
+# Description=The name of the metadata configuration file which is to be
sent to the LS
+service.ls.registration_file=/etc/ps-mdm-sshtelnet-mp/sshtelnetmetadata.xml
+
+# Group=LS
+# Description=Enter 'xmldb' to take metadata elements for register requests
from the XML database, or 'file' to take them from the XML metadata
configuration file.
+service.ma.conf_file.store_type=xmldb
+
+# Group=LS
+# Description=Enter the content type of the service
+service.ls.service_content_type=sshtelnet mp
+
+#Authentication properties
+#-------------------------
+
+# Group=Authentication
+# Description=The URL address of the Authentication Service.
+service.as.point=http\://homer.rediris.es\:8080/perfSONAR-AS/services/AuthService
+
+# Group=Authentication
+# Description=The types of messages for which authentication is to be
enabled (if required).
+service.as.authn_for_msg_types=SetupDataRequest,MetadataKeyRequest
+
+# Group=Authentication
+# Description=Determines if authentication is enabled (on) or not (off).
+service.as.authn_active=off
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/servlet.properties
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/servlet.properties
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/servlet.properties
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,30 @@
+#Changed at Wed Jan 30 11:12:44 CET 2008
+#Wed Jan 30 11:12:44 CET 2008
+
+# Group=Servlet
+# Description=Type of service
+servlet.service_type=sshtelnetmp
+
+# Group=Wizard
+# Description=The class for handling the wizard for the SSHTELNET MP
+servlet.wizard.external_handler=org.perfsonar.service.measurementPoint.webAdmin.SSHTelnetHandler
+
+# Group=Servlet
+# Description=The property in the service.properties file responsible for
holding the admin password for the eXist database
+servlet.exist_adminpass.property=component.mp.xmldb.db_adminpassword
+
+# Group=Servlet
+# Description=The username for the servlet
+servlet.username=perfsonaruser
+
+# Group=Servlet
+# Description=The password for the servlet
+servlet.password=perfsonarpass
+
+# Group=Servlet
+# Description=The property in the service.properties file responsible for
holding the location of the eXist database
+servlet.exist_location.property=component.mp.xmldb.db_uri
+
+# Group=Servlet
+# Description=Controls the use of advanced features in the properties
management servlet. Default value is �off�
+servlet.extra_functionalities=off
Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/wizard.properties
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/wizard.properties
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/wizard.properties
2010-04-26 14:16:05 UTC (rev 5593)
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE properties [
+ <!ELEMENT properties ( comment?, property* )>
+<!ATTLIST properties version CDATA #FIXED "0.1">
+<!ELEMENT comment (#PCDATA) >
+<!ELEMENT property (entry,Comment,ProposedValue,Group+,AcceptedValue*) >
+<!ELEMENT entry (#PCDATA) >
+<!ATTLIST entry
+key CDATA #REQUIRED
+ password (true|false) #IMPLIED
+ required (true|false) #IMPLIED >
+<!ELEMENT Comment (#PCDATA) >
+<!ELEMENT ProposedValue (#PCDATA) >
+<!ELEMENT Group (#PCDATA) >
+<!ATTLIST Group
+ order CDATA #REQUIRED
+ check (true|false) #IMPLIED
+ dependsOn CDATA #IMPLIED
+>
+<!ELEMENT AcceptedValue (#PCDATA) >
+]>
+<properties>
+ <comment>Last Modification Thu Mar 06 19:53:22 CET 2008</comment>
+
+ <property>
+ <entry key="servlet.username" required="true">perfsonaruser</entry>
+ <Comment>Enter the username for logging in to the admin pages:</Comment>
+ <ProposedValue>perfsonaruser</ProposedValue>
+ <Group order="1" check="false">Administration</Group>
+ </property>
+
+ <property>
+ <entry key="servlet.password" required="true"
password="true">perfsonarpass</entry>
+ <Comment>Enter the password for logging in to the admin pages:</Comment>
+ <ProposedValue>perfsonarpass</ProposedValue>
+ <Group order="2">Administration</Group>
+ </property>
+
+
+ <property>
+ <entry key="service.as.authn_active" required="true">no</entry>
+ <Comment>Do you wish to enable authentication?</Comment>
+ <ProposedValue>yes</ProposedValue>
+ <Group order="1" check="true">Authentication</Group>
+ <AcceptedValue>yes</AcceptedValue>
+ <AcceptedValue>no</AcceptedValue>
+ </property>
+
+ <property>
+ <entry key="service.as.point"
required="true">http://homer.rediris.es:8080/perfSONAR-AS/services/AuthService</entry>
+ <Comment>Enter the URL address of the Authentication Service:</Comment>
+
<ProposedValue>http://homer.rediris.es:8080/perfSONAR-AS/services/AuthService</ProposedValue>
+ <Group order="2">Authentication</Group>
+ </property>
+
+ <property>
+ <entry key="service.as.authn_for_msg_types"
required="true">SetupDataRequest,MetadataKeyRequest</entry>
+ <Comment>Enter the message types which should be authenticated:</Comment>
+ <ProposedValue>SetupDataRequest,MetadataKeyRequest</ProposedValue>
+ <Group order="3">Authentication</Group>
+ </property>
+
+
+ <property>
+ <entry key="service.r.service_name"
required="true">ps-mdm-sshtelnet-mp</entry>
+ <Comment>Enter the service name:</Comment>
+ <ProposedValue>ps-mdm-sshtelnet-mp</ProposedValue>
+ <Group order="1">LS</Group>
+ </property>
+
+ <property>
+ <entry key="service.r.service_description">perfSONAR Java SSH TELNET
MP</entry>
+ <Comment>Enter a description for the service:</Comment>
+ <ProposedValue>perfSONAR Java SSH TELNET MP</ProposedValue>
+ <Group order="2">LS</Group>
+ </property>
+
+ <property>
+ <entry
key="service.r.contact_email">user@domain</entry>
+ <Comment>Enter the service administrator's email address:</Comment>
+
<ProposedValue>user@domain</ProposedValue>
+ <Group order="3">LS</Group>
+ </property>
+
+ <property>
+ <entry key="service.r.organization_name">Institution</entry>
+ <Comment>Enter the name of the organisation running this
service:</Comment>
+ <ProposedValue>Institution</ProposedValue>
+ <Group order="4">LS</Group>
+ </property>
+
+ <property>
+ <entry key="service.r.ls_url" required="true">http://somewhere</entry>
+ <Comment>Enter the LS URL:</Comment>
+ <ProposedValue>http://somewhere</ProposedValue>
+ <Group order="5">LS</Group>
+ </property>
+
+ <property>
+ <entry key="component.registrator.interval">900000</entry>
+ <Comment>Set the registration interval (milliseconds):</Comment>
+ <ProposedValue>900000</ProposedValue>
+ <Group order="6">LS</Group>
+ </property>
+
+ <property>
+ <entry key="service.r.access_point"
required="true">http://somewhere</entry>
+ <Comment>Enter the service access point:</Comment>
+ <ProposedValue>http://somewhere</ProposedValue>
+ <Group order="7">LS</Group>
+ </property>
+
+
+ <property>
+ <entry key="component.mp.xmldb.db_uri"
required="true">xmldb:exist://localhost:8080/exist/xmlrpc/db </entry>
+ <Comment>Enter the URI location of the eXist database:</Comment>
+ <ProposedValue>xmldb:exist://localhost:8080/exist/xmlrpc/db
</ProposedValue>
+ <Group order="1">eXist</Group>
+ </property>
+
+ <property>
+ <entry key="component.mp.xmldb.db_username"
required="true">sshtelnet</entry>
+ <Comment>Enter the service username for the eXist user:</Comment>
+ <ProposedValue>sshtelnet</ProposedValue>
+ <Group order="2">eXist</Group>
+ </property>
+
+ <property>
+ <entry key="component.mp.xmldb.db_password" required="true"
password="true">sshtelnet</entry>
+ <Comment>Enter the password for the eXist user:</Comment>
+ <ProposedValue>sshtelnet</ProposedValue>
+ <Group order="3">eXist</Group>
+ </property>
+
+ <property>
+ <entry key="create_user" required="true">no</entry>
+ <Comment>Do you wish to create a user with this name?</Comment>
+ <ProposedValue>yes</ProposedValue>
+ <Group order="4" check="true">eXist</Group>
+ <AcceptedValue>yes</AcceptedValue>
+ <AcceptedValue>no</AcceptedValue>
+ </property>
+
+ <property>
+ <entry key="old_adminpassword_1" required="true" password="true" />
+ <Comment>Enter the eXist administration password:</Comment>
+ <ProposedValue />
+ <Group order="5" dependsOn="4">eXist</Group>
+ </property>
+
+ <property>
+ <entry key="component.mp.xmldb.metadata_file_name"
required="true">sshtelnetmetadata.xml</entry>
+ <Comment>Enter the name of the metadata configuration file:</Comment>
+ <ProposedValue>sshtelnetmetadata.xml</ProposedValue>
+ <Group order="6">eXist</Group>
+ </property>
+
+ <property>
+ <entry key="component.mp.xmldb.metadata_file_path"
required="true">/etc/ps-mdm-sshtelnet-mp/sshtelnetmetadata.xml</entry>
+ <Comment>Enter the full path of the metadata configuration
file:</Comment>
+
<ProposedValue>/etc/ps-mdm-sshtelnet-mp/sshtelnetmetadata.xml</ProposedValue>
+ <Group order="7">eXist</Group>
+ </property>
+
+ <property>
+ <entry key="change_admin_pass" required="true">no</entry>
+ <Comment>Do you wish to change the exist Admin password?</Comment>
+ <ProposedValue>yes</ProposedValue>
+ <Group order="8" check="true">eXist</Group>
+ <AcceptedValue>yes</AcceptedValue>
+ <AcceptedValue>no</AcceptedValue>
+ </property>
+
+ <property>
+ <entry key="component.mp.xmldb.db_adminpassword" required="true"
password="true" />
+ <Comment>Enter the eXist administration password:</Comment>
+ <ProposedValue />
+ <Group order="9" dependsOn="8">eXist</Group>
+ </property>
+
+ <property>
+ <entry key="component.ma.xmldb.db_adminpassword_confirm" required="true"
password="true" />
+ <Comment>Confirm new eXist administration password:</Comment>
+ <ProposedValue />
+ <Group order="90" dependsOn="8">eXist</Group>
+ </property>
+
+ <property>
+ <entry key="old_adminpassword" required="true" password="true" />
+ <Comment>Enter the old eXist administration password:</Comment>
+ <ProposedValue />
+ <Group order="99" dependsOn="8">eXist</Group>
+ </property>
+</properties>
- [GEANT/SA2/ps-java-services] r5593 - in trunk/perfsonar-java-base2/src: main/java/org/perfsonar/base2/service/configuration main/java/org/perfsonar/base2/service/configuration/migration main/java/org/perfsonar/base2/service/configuration/migration/grammar main/java/org/perfsonar/base2/service/configuration/migration/grammar/function test/java/org/perfsonar/base2/service/configuration test/java/org/perfsonar/base2/service/configuration/migration test/java/org/perfsonar/base2/service/configuration/migration/grammar test/java/org/perfsonar/base2/service/configuration/migration/grammar/function, svn-noreply, 04/26/2010
Archive powered by MHonArc 2.6.16.