perfsonar-dev - [GEANT/SA2/ps-java-services] r5604 - in branches: . perfsonar-java-base2-stable-1.0/src/test/java/org/perfsonar/base2/service/configuration/migration
Subject: perfsonar development work
List archive
[GEANT/SA2/ps-java-services] r5604 - in branches: . perfsonar-java-base2-stable-1.0/src/test/java/org/perfsonar/base2/service/configuration/migration
Chronological Thread
- From:
- To:
- Subject: [GEANT/SA2/ps-java-services] r5604 - in branches: . perfsonar-java-base2-stable-1.0/src/test/java/org/perfsonar/base2/service/configuration/migration
- Date: Tue, 27 Apr 2010 12:51:15 +0100
Author: psnc.trzaszczka
Date: 2010-04-27 12:51:15 +0100 (Tue, 27 Apr 2010)
New Revision: 5604
Added:
branches/perfsonar-java-base2-stable-1.0/
branches/perfsonar-java-base2-stable-1.0/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java
Removed:
branches/perfsonar-java-base2-stable-1.0/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java
Log:
stabilization branch created
Copied: branches/perfsonar-java-base2-stable-1.0 (from rev 5601,
trunk/perfsonar-java-base2)
Deleted:
branches/perfsonar-java-base2-stable-1.0/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-04-27 11:23:43 UTC (rev 5601)
+++
branches/perfsonar-java-base2-stable-1.0/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java
2010-04-27 11:51:15 UTC (rev 5604)
@@ -1,110 +0,0 @@
-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 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(new
File(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 {
-
assertCollectionEquals(createExpectedConfigFiles(".properties"),
configCollection.getFiles());
- }
-
- public void testGetFilesDirectoryDoesNotExist() throws IOException {
- configCollection = new ConfigFilesCollection(new
File(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(new
File(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;
- }
-
- private void assertCollectionEquals(Collection expected, Collection
actual) {
- final Collection result = new ArrayList();
- for (Object obj : expected) {
- if (!actual.contains(obj))
- result.add(obj);
- }
-
- if (result.size() != 0)
- fail("The following are missing in the collection: "
+ result.toString());
- }
-}
Copied:
branches/perfsonar-java-base2-stable-1.0/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java
(from rev 5603,
trunk/perfsonar-java-base2/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java)
===================================================================
---
branches/perfsonar-java-base2-stable-1.0/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java
(rev 0)
+++
branches/perfsonar-java-base2-stable-1.0/src/test/java/org/perfsonar/base2/service/configuration/migration/ConfigFilesCollectionTest.java
2010-04-27 11:51:15 UTC (rev 5604)
@@ -0,0 +1,111 @@
+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 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(new
File(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 {
+
assertCollectionEquals(createExpectedConfigFiles(".properties"),
configCollection.getFiles());
+ }
+
+ public void testGetFilesDirectoryDoesNotExist() throws IOException {
+ configCollection = new ConfigFilesCollection(new
File(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(new
File(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;
+ if (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;
+ }
+
+ private void assertCollectionEquals(Collection expected, Collection
actual) {
+ final Collection result = new ArrayList();
+ for (Object obj : expected) {
+ if (!actual.contains(obj))
+ result.add(obj);
+ }
+
+ if (result.size() != 0)
+ fail("The following are missing in the collection: "
+ result.toString());
+ }
+}
- [GEANT/SA2/ps-java-services] r5604 - in branches: . perfsonar-java-base2-stable-1.0/src/test/java/org/perfsonar/base2/service/configuration/migration, svn-noreply, 04/27/2010
Archive powered by MHonArc 2.6.16.