Updated Branches: refs/heads/1.5.1-SNAPSHOT 0bc311b1a -> 5da415ae7
ACCUMULO-1222 Move resources from server to test and cleanup a not-so-useful test case Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/5da415ae Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/5da415ae Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/5da415ae Branch: refs/heads/1.5.1-SNAPSHOT Commit: 5da415ae7ba3b86410b4f3d6e957e8c829868721 Parents: 0bc311b Author: Josh Elser <els...@apache.org> Authored: Sat Sep 21 21:43:29 2013 -0400 Committer: Josh Elser <els...@apache.org> Committed: Sat Sep 21 21:44:22 2013 -0400 ---------------------------------------------------------------------- server/src/main/resources/randomwalk/Basic.xml | 37 ----------- server/src/main/resources/randomwalk/Simple.xml | 43 ------------ server/src/main/resources/randomwalk/module.xsd | 69 -------------------- .../accumulo/test/randomwalk/FrameworkTest.java | 46 +++---------- test/src/test/resources/randomwalk/Basic.xml | 37 +++++++++++ test/src/test/resources/randomwalk/Simple.xml | 43 ++++++++++++ test/src/test/resources/randomwalk/module.xsd | 69 ++++++++++++++++++++ test/src/test/resources/unit/Basic.xml | 37 +++++++++++ test/src/test/resources/unit/Simple.xml | 43 ++++++++++++ 9 files changed, 237 insertions(+), 187 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/5da415ae/server/src/main/resources/randomwalk/Basic.xml ---------------------------------------------------------------------- diff --git a/server/src/main/resources/randomwalk/Basic.xml b/server/src/main/resources/randomwalk/Basic.xml deleted file mode 100644 index 2dead02..0000000 --- a/server/src/main/resources/randomwalk/Basic.xml +++ /dev/null @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<module> - -<package prefix="test" value="org.apache.accumulo.test.randomwalk.unit"/> - -<init id="test.CreateTable"/> - -<node id="test.CreateTable"> - <edge id="unit/Simple.xml" weight="1"/> -</node> - -<node id="unit/Simple.xml"> - <edge id="unit/Simple.xml" weight="3"/> - <edge id="test.DeleteTable" weight="1"/> -</node> - -<node id="test.DeleteTable"> - <edge id="END" weight="1"/> -</node> - -</module> http://git-wip-us.apache.org/repos/asf/accumulo/blob/5da415ae/server/src/main/resources/randomwalk/Simple.xml ---------------------------------------------------------------------- diff --git a/server/src/main/resources/randomwalk/Simple.xml b/server/src/main/resources/randomwalk/Simple.xml deleted file mode 100644 index cad940e..0000000 --- a/server/src/main/resources/randomwalk/Simple.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> -<module> - -<package prefix="test" value="org.apache.accumulo.test.randomwalk.unit"/> - -<init id="dummy.all"/> - -<node id="dummy.all"> - <edge id="test.Ingest" weight="1"/> - <edge id="test.Verify" weight="1"/> - <edge id="test.Scan" weight="1"/> - <edge id="END" weight="1"/> -</node> - -<node id="test.Ingest"> - <edge id="dummy.all" weight="1"/> -</node> - -<node id="test.Verify"> - <edge id="dummy.all" weight="1"/> -</node> - -<node id="test.Scan"> - <edge id="dummy.all" weight="1"/> -</node> - -</module> http://git-wip-us.apache.org/repos/asf/accumulo/blob/5da415ae/server/src/main/resources/randomwalk/module.xsd ---------------------------------------------------------------------- diff --git a/server/src/main/resources/randomwalk/module.xsd b/server/src/main/resources/randomwalk/module.xsd deleted file mode 100644 index bcdaaae0..0000000 --- a/server/src/main/resources/randomwalk/module.xsd +++ /dev/null @@ -1,69 +0,0 @@ -<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> -<!-- - Licensed to the Apache Software Foundation (ASF) under one or more - contributor license agreements. See the NOTICE file distributed with - this work for additional information regarding copyright ownership. - The ASF licenses this file to You under the Apache License, Version 2.0 - (the "License"); you may not use this file except in compliance with - the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> - - <xsd:element name="module" type="ModuleType"/> - - <xsd:complexType name="ModuleType"> - <xsd:sequence> - <xsd:element name="package" type="PrefixType" minOccurs="0" maxOccurs="unbounded"/> - <xsd:element name="fixture" type="InitType" minOccurs="0" maxOccurs="1"/> - <xsd:element name="init" type="InitType"/> - <xsd:element name="node" type="NodeType" minOccurs="1" maxOccurs="unbounded"/> - </xsd:sequence> - </xsd:complexType> - - <xsd:complexType name="PrefixType"> - <xsd:attribute name="prefix" type="xsd:string"/> - <xsd:attribute name="value" type="xsd:string"/> - </xsd:complexType> - - <xsd:complexType name="InitType"> - <xsd:attribute name="id" type="xsd:string"/> - <xsd:attribute name="maxHops" type="xsd:nonNegativeInteger"/> - <xsd:attribute name="maxSec" type="xsd:nonNegativeInteger"/> - <xsd:attribute name="teardown" type="xsd:boolean"/> - </xsd:complexType> - - <xsd:complexType name="NodeType"> - <xsd:sequence> - <xsd:element name="alias" type="AliasType" minOccurs="0" maxOccurs="unbounded"/> - <xsd:element name="property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/> - <xsd:element name="edge" type="EdgeType" minOccurs="1" maxOccurs="unbounded"/> - </xsd:sequence> - <xsd:attribute name="id" type="xsd:string"/> - <xsd:attribute name="src" type="xsd:string"/> - <xsd:attribute name="maxHops" type="xsd:nonNegativeInteger"/> - <xsd:attribute name="maxSec" type="xsd:nonNegativeInteger"/> - <xsd:attribute name="teardown" type="xsd:boolean"/> - </xsd:complexType> - - <xsd:complexType name="EdgeType"> - <xsd:attribute name="id" type="xsd:string"/> - <xsd:attribute name="weight" type="xsd:positiveInteger"/> - </xsd:complexType> - - <xsd:complexType name="AliasType"> - <xsd:attribute name="name" type="xsd:string"/> - </xsd:complexType> - - <xsd:complexType name="PropertyType"> - <xsd:attribute name="key" type="xsd:string"/> - <xsd:attribute name="value" type="xsd:string"/> - </xsd:complexType> - -</xsd:schema> http://git-wip-us.apache.org/repos/asf/accumulo/blob/5da415ae/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 ce5b599..7829ac5 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 @@ -19,20 +19,17 @@ package org.apache.accumulo.test.randomwalk; import java.io.File; import java.util.Properties; +import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; -import javax.xml.XMLConstants; - -import org.apache.accumulo.test.randomwalk.Framework; -import org.apache.accumulo.test.randomwalk.Module; -import org.apache.accumulo.test.randomwalk.State; -import org.apache.accumulo.test.randomwalk.Test; -import org.apache.accumulo.test.randomwalk.unit.CreateTable; import junit.framework.TestCase; +import org.apache.accumulo.test.randomwalk.unit.CreateTable; +import org.junit.Assert; + public class FrameworkTest extends TestCase { public void testXML() { @@ -43,19 +40,19 @@ public class FrameworkTest extends TestCase { SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); Schema moduleSchema = null; try { - moduleSchema = sf.newSchema(new File(this.getClass().getClassLoader().getResource("randomwalk/module.xsd").toURI())); + moduleSchema = sf.newSchema(new File(this.getClass().getResource("/randomwalk/module.xsd").toURI())); } catch (Exception e) { - e.printStackTrace(); + Assert.fail("Caught exception: " + e); } dbf.setSchema(moduleSchema); try { - File f = new File(this.getClass().getClassLoader().getResource("randomwalk/Basic.xml").toURI()); + File f = new File(this.getClass().getResource("/randomwalk/Basic.xml").toURI()); docbuilder = dbf.newDocumentBuilder(); docbuilder.parse(f); } catch (Exception e) { - e.printStackTrace(); + Assert.fail("Caught exception: " + e); } } @@ -68,31 +65,4 @@ public class FrameworkTest extends TestCase { assertTrue(t1.equals(t2)); } - public void testModule() { - - // don't run test if accumulo home is not set - String acuHome = System.getenv("ACCUMULO_HOME"); - if (acuHome == null) - return; - - String confDir = acuHome + "/test/system/randomwalk/conf/"; - try { - Module module = new Module(new File(confDir + "modules/unit/Basic.xml")); - module.visit(new State(new Properties()), new Properties()); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void testFramework() { - - // don't run test if accumulo home is not set - String acuHome = System.getenv("ACCUMULO_HOME"); - if (acuHome == null) - return; - - Framework framework = Framework.getInstance(); - String confDir = acuHome + "/test/system/randomwalk/conf/"; - framework.run("unit/Basic.xml", new State(new Properties()), confDir); - } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/5da415ae/test/src/test/resources/randomwalk/Basic.xml ---------------------------------------------------------------------- diff --git a/test/src/test/resources/randomwalk/Basic.xml b/test/src/test/resources/randomwalk/Basic.xml new file mode 100644 index 0000000..2dead02 --- /dev/null +++ b/test/src/test/resources/randomwalk/Basic.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<module> + +<package prefix="test" value="org.apache.accumulo.test.randomwalk.unit"/> + +<init id="test.CreateTable"/> + +<node id="test.CreateTable"> + <edge id="unit/Simple.xml" weight="1"/> +</node> + +<node id="unit/Simple.xml"> + <edge id="unit/Simple.xml" weight="3"/> + <edge id="test.DeleteTable" weight="1"/> +</node> + +<node id="test.DeleteTable"> + <edge id="END" weight="1"/> +</node> + +</module> http://git-wip-us.apache.org/repos/asf/accumulo/blob/5da415ae/test/src/test/resources/randomwalk/Simple.xml ---------------------------------------------------------------------- diff --git a/test/src/test/resources/randomwalk/Simple.xml b/test/src/test/resources/randomwalk/Simple.xml new file mode 100644 index 0000000..cad940e --- /dev/null +++ b/test/src/test/resources/randomwalk/Simple.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<module> + +<package prefix="test" value="org.apache.accumulo.test.randomwalk.unit"/> + +<init id="dummy.all"/> + +<node id="dummy.all"> + <edge id="test.Ingest" weight="1"/> + <edge id="test.Verify" weight="1"/> + <edge id="test.Scan" weight="1"/> + <edge id="END" weight="1"/> +</node> + +<node id="test.Ingest"> + <edge id="dummy.all" weight="1"/> +</node> + +<node id="test.Verify"> + <edge id="dummy.all" weight="1"/> +</node> + +<node id="test.Scan"> + <edge id="dummy.all" weight="1"/> +</node> + +</module> http://git-wip-us.apache.org/repos/asf/accumulo/blob/5da415ae/test/src/test/resources/randomwalk/module.xsd ---------------------------------------------------------------------- diff --git a/test/src/test/resources/randomwalk/module.xsd b/test/src/test/resources/randomwalk/module.xsd new file mode 100644 index 0000000..bcdaaae0 --- /dev/null +++ b/test/src/test/resources/randomwalk/module.xsd @@ -0,0 +1,69 @@ +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + + <xsd:element name="module" type="ModuleType"/> + + <xsd:complexType name="ModuleType"> + <xsd:sequence> + <xsd:element name="package" type="PrefixType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="fixture" type="InitType" minOccurs="0" maxOccurs="1"/> + <xsd:element name="init" type="InitType"/> + <xsd:element name="node" type="NodeType" minOccurs="1" maxOccurs="unbounded"/> + </xsd:sequence> + </xsd:complexType> + + <xsd:complexType name="PrefixType"> + <xsd:attribute name="prefix" type="xsd:string"/> + <xsd:attribute name="value" type="xsd:string"/> + </xsd:complexType> + + <xsd:complexType name="InitType"> + <xsd:attribute name="id" type="xsd:string"/> + <xsd:attribute name="maxHops" type="xsd:nonNegativeInteger"/> + <xsd:attribute name="maxSec" type="xsd:nonNegativeInteger"/> + <xsd:attribute name="teardown" type="xsd:boolean"/> + </xsd:complexType> + + <xsd:complexType name="NodeType"> + <xsd:sequence> + <xsd:element name="alias" type="AliasType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="property" type="PropertyType" minOccurs="0" maxOccurs="unbounded"/> + <xsd:element name="edge" type="EdgeType" minOccurs="1" maxOccurs="unbounded"/> + </xsd:sequence> + <xsd:attribute name="id" type="xsd:string"/> + <xsd:attribute name="src" type="xsd:string"/> + <xsd:attribute name="maxHops" type="xsd:nonNegativeInteger"/> + <xsd:attribute name="maxSec" type="xsd:nonNegativeInteger"/> + <xsd:attribute name="teardown" type="xsd:boolean"/> + </xsd:complexType> + + <xsd:complexType name="EdgeType"> + <xsd:attribute name="id" type="xsd:string"/> + <xsd:attribute name="weight" type="xsd:positiveInteger"/> + </xsd:complexType> + + <xsd:complexType name="AliasType"> + <xsd:attribute name="name" type="xsd:string"/> + </xsd:complexType> + + <xsd:complexType name="PropertyType"> + <xsd:attribute name="key" type="xsd:string"/> + <xsd:attribute name="value" type="xsd:string"/> + </xsd:complexType> + +</xsd:schema> http://git-wip-us.apache.org/repos/asf/accumulo/blob/5da415ae/test/src/test/resources/unit/Basic.xml ---------------------------------------------------------------------- diff --git a/test/src/test/resources/unit/Basic.xml b/test/src/test/resources/unit/Basic.xml new file mode 100644 index 0000000..2dead02 --- /dev/null +++ b/test/src/test/resources/unit/Basic.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<module> + +<package prefix="test" value="org.apache.accumulo.test.randomwalk.unit"/> + +<init id="test.CreateTable"/> + +<node id="test.CreateTable"> + <edge id="unit/Simple.xml" weight="1"/> +</node> + +<node id="unit/Simple.xml"> + <edge id="unit/Simple.xml" weight="3"/> + <edge id="test.DeleteTable" weight="1"/> +</node> + +<node id="test.DeleteTable"> + <edge id="END" weight="1"/> +</node> + +</module> http://git-wip-us.apache.org/repos/asf/accumulo/blob/5da415ae/test/src/test/resources/unit/Simple.xml ---------------------------------------------------------------------- diff --git a/test/src/test/resources/unit/Simple.xml b/test/src/test/resources/unit/Simple.xml new file mode 100644 index 0000000..cad940e --- /dev/null +++ b/test/src/test/resources/unit/Simple.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<module> + +<package prefix="test" value="org.apache.accumulo.test.randomwalk.unit"/> + +<init id="dummy.all"/> + +<node id="dummy.all"> + <edge id="test.Ingest" weight="1"/> + <edge id="test.Verify" weight="1"/> + <edge id="test.Scan" weight="1"/> + <edge id="END" weight="1"/> +</node> + +<node id="test.Ingest"> + <edge id="dummy.all" weight="1"/> +</node> + +<node id="test.Verify"> + <edge id="dummy.all" weight="1"/> +</node> + +<node id="test.Scan"> + <edge id="dummy.all" weight="1"/> +</node> + +</module>