You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by md...@apache.org on 2014/04/30 21:39:54 UTC
[1/3] git commit: ACCUMULO-2765 Convert FrameworkTest to junit4
Repository: accumulo
Updated Branches:
refs/heads/1.6.0-SNAPSHOT b3c893671 -> 1c38957c4
refs/heads/master 7a826251d -> 1dae0298f
ACCUMULO-2765 Convert FrameworkTest to junit4
Use JUnit 4
To enable new features
Don't catch exceptions
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1c38957c
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1c38957c
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1c38957c
Branch: refs/heads/1.6.0-SNAPSHOT
Commit: 1c38957c453df84462a2cd837b155d590d012d05
Parents: b3c8936
Author: Mike Drob <md...@cloudera.com>
Authored: Wed Apr 30 15:29:18 2014 -0400
Committer: Mike Drob <md...@cloudera.com>
Committed: Wed Apr 30 15:29:18 2014 -0400
----------------------------------------------------------------------
.../accumulo/test/randomwalk/FrameworkTest.java | 48 ++++++++++----------
1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c38957c/test/src/test/java/org/apache/accumulo/test/randomwalk/FrameworkTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/randomwalk/FrameworkTest.java b/test/src/test/java/org/apache/accumulo/test/randomwalk/FrameworkTest.java
index d43347e..ca003ab 100644
--- a/test/src/test/java/org/apache/accumulo/test/randomwalk/FrameworkTest.java
+++ b/test/src/test/java/org/apache/accumulo/test/randomwalk/FrameworkTest.java
@@ -16,52 +16,52 @@
*/
package org.apache.accumulo.test.randomwalk;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
-import junit.framework.TestCase;
-
import org.apache.accumulo.test.randomwalk.unit.CreateTable;
-import org.junit.Assert;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
-public class FrameworkTest extends TestCase {
+public class FrameworkTest {
- public void testXML() {
+ // Need to use fully qualified name here because of conflict with org.apache.accumulo.test.randomwalk.Test
+ @org.junit.Test
+ public void testXML() throws SAXException, URISyntaxException, ParserConfigurationException, IOException {
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema moduleSchema = sf.newSchema(getFile("/randomwalk/module.xsd"));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder docbuilder;
+ dbf.setSchema(moduleSchema);
- SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- Schema moduleSchema = null;
- try {
- moduleSchema = sf.newSchema(new File(this.getClass().getResource("/randomwalk/module.xsd").toURI()));
- } catch (Exception e) {
- Assert.fail("Caught exception: " + e);
- }
+ DocumentBuilder docbuilder = dbf.newDocumentBuilder();
+ Document document = docbuilder.parse(getFile("/randomwalk/Basic.xml"));
- dbf.setSchema(moduleSchema);
+ assertNotEquals("Parsing randomwalk xml should result in nodes.", 0, document.getChildNodes().getLength());
+ }
- try {
- File f = new File(this.getClass().getResource("/randomwalk/Basic.xml").toURI());
- docbuilder = dbf.newDocumentBuilder();
- docbuilder.parse(f);
- } catch (Exception e) {
- Assert.fail("Caught exception: " + e);
- }
+ private File getFile(String resource) throws URISyntaxException {
+ return new File(this.getClass().getResource(resource).toURI());
}
+ @org.junit.Test
public void testRWTest() {
-
Test t1 = new CreateTable();
- assertTrue(t1.toString().equals("org.apache.accumulo.test.randomwalk.unit.CreateTable"));
+ assertEquals("org.apache.accumulo.test.randomwalk.unit.CreateTable", t1.toString());
Test t2 = new CreateTable();
- assertTrue(t1.equals(t2));
+ assertEquals("CreateTable test nodes were not equal.", t1, t2);
}
}
[3/3] git commit: Merge branch '1.6.0-SNAPSHOT'
Posted by md...@apache.org.
Merge branch '1.6.0-SNAPSHOT'
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1dae0298
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1dae0298
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1dae0298
Branch: refs/heads/master
Commit: 1dae0298fd2c1bee80855e5c4067ef569c6299b5
Parents: 7a82625 1c38957
Author: Mike Drob <md...@cloudera.com>
Authored: Wed Apr 30 15:33:41 2014 -0400
Committer: Mike Drob <md...@cloudera.com>
Committed: Wed Apr 30 15:33:41 2014 -0400
----------------------------------------------------------------------
.../accumulo/test/randomwalk/FrameworkTest.java | 48 ++++++++++----------
1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
[2/3] git commit: ACCUMULO-2765 Convert FrameworkTest to junit4
Posted by md...@apache.org.
ACCUMULO-2765 Convert FrameworkTest to junit4
Use JUnit 4
To enable new features
Don't catch exceptions
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/1c38957c
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/1c38957c
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/1c38957c
Branch: refs/heads/master
Commit: 1c38957c453df84462a2cd837b155d590d012d05
Parents: b3c8936
Author: Mike Drob <md...@cloudera.com>
Authored: Wed Apr 30 15:29:18 2014 -0400
Committer: Mike Drob <md...@cloudera.com>
Committed: Wed Apr 30 15:29:18 2014 -0400
----------------------------------------------------------------------
.../accumulo/test/randomwalk/FrameworkTest.java | 48 ++++++++++----------
1 file changed, 24 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c38957c/test/src/test/java/org/apache/accumulo/test/randomwalk/FrameworkTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/randomwalk/FrameworkTest.java b/test/src/test/java/org/apache/accumulo/test/randomwalk/FrameworkTest.java
index d43347e..ca003ab 100644
--- a/test/src/test/java/org/apache/accumulo/test/randomwalk/FrameworkTest.java
+++ b/test/src/test/java/org/apache/accumulo/test/randomwalk/FrameworkTest.java
@@ -16,52 +16,52 @@
*/
package org.apache.accumulo.test.randomwalk;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
-import junit.framework.TestCase;
-
import org.apache.accumulo.test.randomwalk.unit.CreateTable;
-import org.junit.Assert;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
-public class FrameworkTest extends TestCase {
+public class FrameworkTest {
- public void testXML() {
+ // Need to use fully qualified name here because of conflict with org.apache.accumulo.test.randomwalk.Test
+ @org.junit.Test
+ public void testXML() throws SAXException, URISyntaxException, ParserConfigurationException, IOException {
+ SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+ Schema moduleSchema = sf.newSchema(getFile("/randomwalk/module.xsd"));
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder docbuilder;
+ dbf.setSchema(moduleSchema);
- SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
- Schema moduleSchema = null;
- try {
- moduleSchema = sf.newSchema(new File(this.getClass().getResource("/randomwalk/module.xsd").toURI()));
- } catch (Exception e) {
- Assert.fail("Caught exception: " + e);
- }
+ DocumentBuilder docbuilder = dbf.newDocumentBuilder();
+ Document document = docbuilder.parse(getFile("/randomwalk/Basic.xml"));
- dbf.setSchema(moduleSchema);
+ assertNotEquals("Parsing randomwalk xml should result in nodes.", 0, document.getChildNodes().getLength());
+ }
- try {
- File f = new File(this.getClass().getResource("/randomwalk/Basic.xml").toURI());
- docbuilder = dbf.newDocumentBuilder();
- docbuilder.parse(f);
- } catch (Exception e) {
- Assert.fail("Caught exception: " + e);
- }
+ private File getFile(String resource) throws URISyntaxException {
+ return new File(this.getClass().getResource(resource).toURI());
}
+ @org.junit.Test
public void testRWTest() {
-
Test t1 = new CreateTable();
- assertTrue(t1.toString().equals("org.apache.accumulo.test.randomwalk.unit.CreateTable"));
+ assertEquals("org.apache.accumulo.test.randomwalk.unit.CreateTable", t1.toString());
Test t2 = new CreateTable();
- assertTrue(t1.equals(t2));
+ assertEquals("CreateTable test nodes were not equal.", t1, t2);
}
}