incubator-accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject svn commit: r1189014 - /incubator/accumulo/trunk/src/start/src/test/java/org/apache/accumulo/start/Test.java
Date Wed, 26 Oct 2011 03:42:12 GMT
Author: vines
Date: Wed Oct 26 03:42:11 2011
New Revision: 1189014

URL: http://svn.apache.org/viewvc?rev=1189014&view=rev
Log:
Accumulo-64 - Didn't provide support for when no site.xml file was present. We now use the
example if not available. This should resolve build problems with jenkins.

Modified:
    incubator/accumulo/trunk/src/start/src/test/java/org/apache/accumulo/start/Test.java

Modified: incubator/accumulo/trunk/src/start/src/test/java/org/apache/accumulo/start/Test.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/start/src/test/java/org/apache/accumulo/start/Test.java?rev=1189014&r1=1189013&r2=1189014&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/start/src/test/java/org/apache/accumulo/start/Test.java (original)
+++ incubator/accumulo/trunk/src/start/src/test/java/org/apache/accumulo/start/Test.java Wed
Oct 26 03:42:11 2011
@@ -176,19 +176,28 @@ public class Test extends TestCase {
     String configFile = System.getProperty("org.apache.accumulo.config.file", "accumulo-site.xml");
     String SITE_CONF = System.getenv("ACCUMULO_HOME") + "/conf/" + configFile;
     File oldConf = new File(SITE_CONF);
+    boolean exists = oldConf.exists();
     String siteBkp = SITE_CONF + ".bkp";
-    if (oldConf.exists())
+    if (exists)
     {
-      oldConf.renameTo(new File(siteBkp));
+      if (oldConf.exists())
+      {
+        oldConf.renameTo(new File(siteBkp));
+      }
+      oldConf = new File(siteBkp);
     }
-    oldConf = new File(siteBkp);
     String randomFolder = System.getenv("ACCUMULO_HOME") + "/lib/notExt" + new Random().nextInt();
-
+    File rf = new File(randomFolder);
+    rf.mkdirs();
     try {
       
       DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
       DocumentBuilder db = dbf.newDocumentBuilder();
-      Document d = db.parse(siteBkp);
+      Document d;
+      if (exists)
+    	  d = db.parse(siteBkp);
+      else
+    	  d = db.parse(new File(SITE_CONF+".example"));
       
       NodeList pnodes = d.getElementsByTagName("property");
       for (int i = pnodes.getLength() - 1; i >= 0; i--) {
@@ -218,9 +227,8 @@ public class Test extends TestCase {
       
     } finally {
       new File(SITE_CONF).delete();
-      if (oldConf.exists())
+      if (exists)
         oldConf.renameTo(new File(SITE_CONF));
-      File rf = new File(randomFolder);
       for (File deleteMe : rf.listFiles())
         deleteMe.delete();
       rf.delete();



Mime
View raw message