Skip to Content.
Sympa Menu

perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r5761 - in trunk/perfsonar-java-base2/src: main/java/org/perfsonar/base2/service/configuration/migration test/java/org/perfsonar/base2/service/configuration/migration

Subject: perfsonar development work

List archive

[pS-dev] [GEANT/SA2/ps-java-services] r5761 - in trunk/perfsonar-java-base2/src: main/java/org/perfsonar/base2/service/configuration/migration test/java/org/perfsonar/base2/service/configuration/migration


Chronological Thread 
  • From:
  • To:
  • Subject: [pS-dev] [GEANT/SA2/ps-java-services] r5761 - in trunk/perfsonar-java-base2/src: main/java/org/perfsonar/base2/service/configuration/migration test/java/org/perfsonar/base2/service/configuration/migration
  • Date: Mon, 4 Oct 2010 15:59:24 +0100

Author: psnc.pietrzak
Date: 2010-10-04 15:59:24 +0100 (Mon, 04 Oct 2010)
New Revision: 5761

Added:

trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/FileNamePatternTest.java
Modified:

trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollection.java

trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java
Log:
Bug fix - In RPM based distros the regex pattern does not match configuration
files.

Modified:
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
2010-10-04 14:55:33 UTC (rev 5760)
+++
trunk/perfsonar-java-base2/src/main/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollection.java
2010-10-04 14:59:24 UTC (rev 5761)
@@ -30,7 +30,7 @@
private static final String RENAME_SUFFIX = ".remove";
protected static final String DEFAULT_CONFIG_PATH = "perfsonar" +
File.separator + "conf";
protected final File configPath;
- protected static final Pattern filenamePattern =
Pattern.compile(".*[.]properties");
+ protected static final Pattern filenamePattern =
Pattern.compile(".*[.]properties([.]rpm.*)?");

public ConfigFilesCollection(File configPath) {
this.configPath = configPath;

Modified:
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
2010-10-04 14:55:33 UTC (rev 5760)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java
2010-10-04 14:59:24 UTC (rev 5761)
@@ -1,7 +1,6 @@
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;
@@ -26,18 +25,6 @@
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"));
}

Added:
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/FileNamePatternTest.java
===================================================================
---
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/FileNamePatternTest.java
(rev 0)
+++
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/FileNamePatternTest.java
2010-10-04 14:59:24 UTC (rev 5761)
@@ -0,0 +1,48 @@
+package org.perfsonar.base2.service.configuration.migration;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+/**
+ * @author <a
href="mailto:">Blazej
Pietrzak</a>
+ */
+@RunWith(Parameterized.class)
+public class FileNamePatternTest {
+ @Parameters
+ public static Collection<Object[]> getData() {
+ final Collection<Object[]> result = new ArrayList<Object[]>();
+ result.add(new Object[] { "abcdef.properties", true });
+ result.add(new Object[] { "abcdef.properties.rpmsave", true
});
+ result.add(new Object[] { "abcdef.properties.rpmorig", true
});
+ result.add(new Object[] { ".properties", true });
+ result.add(new Object[] { "abcdef.properties.rpmnew", true });
+ result.add(new Object[] { "abcdef.properties.remove", false
});
+ result.add(new Object[] { "abcdef.properties.old", false });
+ result.add(new Object[] { "configurationproperties", false });
+ result.add(new Object[] { "properties.rpmsave", false });
+ return result;
+ }
+
+ private final String path;
+ private final boolean expected;
+ private final ConfigFilesCollection config = new
ConfigFilesCollection();
+
+ public FileNamePatternTest(String path, boolean value) {
+ this.path = path;
+ this.expected = value;
+ }
+
+ @Test
+ public void checkIfPathPointsToConfigurationFile() {
+ assertTrue(path + " " + (expected ? "should" : "shouldn't")
+ + " match configuration pattern.",
+ config.matchesFileName(path) == expected);
+ }
+}



  • [pS-dev] [GEANT/SA2/ps-java-services] r5761 - in trunk/perfsonar-java-base2/src: main/java/org/perfsonar/base2/service/configuration/migration test/java/org/perfsonar/base2/service/configuration/migration, svn-noreply, 10/04/2010

Archive powered by MHonArc 2.6.16.

Top of Page