Repository: incubator-ratis Updated Branches: refs/heads/master 543ee0eb8 -> 5d4bb4235
RATIS-150. Fix hadoop tests in example. Contributed by Tsz Wo Nicholas Sze. Project: http://git-wip-us.apache.org/repos/asf/incubator-ratis/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ratis/commit/5d4bb423 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ratis/tree/5d4bb423 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ratis/diff/5d4bb423 Branch: refs/heads/master Commit: 5d4bb423581bd6858411dd4037dcadee752155cc Parents: 543ee0e Author: Márton Elek <[email protected]> Authored: Tue Nov 21 23:46:38 2017 +0100 Committer: Márton Elek <[email protected]> Committed: Tue Nov 21 23:46:38 2017 +0100 ---------------------------------------------------------------------- pom.xml | 16 +++--- ratis-examples/pom.xml | 4 ++ .../examples/arithmetic/cli/AssignTest.java | 53 ------------------ .../examples/arithmetic/cli/TestAssignCli.java | 56 ++++++++++++++++++++ 4 files changed, 69 insertions(+), 60 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/5d4bb423/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 1f8ceb7..ed0f484 100644 --- a/pom.xml +++ b/pom.xml @@ -41,17 +41,19 @@ </licenses> <modules> - <module>ratis-assembly</module> - <module>ratis-client</module> + <module>ratis-proto-shaded</module> <module>ratis-common</module> - <module>ratis-examples</module> + <module>ratis-client</module> + <module>ratis-server</module> + <module>ratis-grpc</module> - <module>ratis-hadoop</module> - <module>ratis-hadoop-shaded</module> <module>ratis-netty</module> - <module>ratis-proto-shaded</module> + <module>ratis-hadoop-shaded</module> + <module>ratis-hadoop</module> + + <module>ratis-assembly</module> + <module>ratis-examples</module> <module>ratis-replicated-map</module> - <module>ratis-server</module> </modules> <pluginRepositories> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/5d4bb423/ratis-examples/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-examples/pom.xml b/ratis-examples/pom.xml index 1fddd1f..865947b 100644 --- a/ratis-examples/pom.xml +++ b/ratis-examples/pom.xml @@ -76,6 +76,10 @@ <scope>test</scope> <type>test-jar</type> </dependency> + <dependency> + <artifactId>ratis-hadoop-shaded</artifactId> + <groupId>org.apache.ratis</groupId> + </dependency> <dependency> <artifactId>ratis-grpc</artifactId> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/5d4bb423/ratis-examples/src/test/java/org/apache/ratis/examples/arithmetic/cli/AssignTest.java ---------------------------------------------------------------------- diff --git a/ratis-examples/src/test/java/org/apache/ratis/examples/arithmetic/cli/AssignTest.java b/ratis-examples/src/test/java/org/apache/ratis/examples/arithmetic/cli/AssignTest.java deleted file mode 100644 index e8f1e66..0000000 --- a/ratis-examples/src/test/java/org/apache/ratis/examples/arithmetic/cli/AssignTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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. - */ -package org.apache.ratis.examples.arithmetic.cli; - -import org.apache.ratis.examples.arithmetic.expression.BinaryExpression; -import org.apache.ratis.examples.arithmetic.expression.DoubleValue; -import org.apache.ratis.examples.arithmetic.expression.UnaryExpression; -import org.apache.ratis.examples.arithmetic.expression.Variable; -import org.junit.Assert; -import org.junit.Test; - -public class AssignTest { - @Test - public void createExpression() throws Exception { - // Assert.assertEquals(new DoubleValue(2.0), new Assign().createExpression("2.0")); - - Assert.assertEquals( - new BinaryExpression(BinaryExpression.Op.MULT, new DoubleValue(2.0), new Variable("a")), - new Assign().createExpression("2*a")); - - Assert.assertEquals( - new BinaryExpression(BinaryExpression.Op.ADD, new DoubleValue(2.0), new DoubleValue(1.0)), - new Assign().createExpression("2+1")); - - Assert.assertEquals( - new BinaryExpression(BinaryExpression.Op.ADD, new Variable("a"), new Variable("b")), - new Assign().createExpression("a+b")); - - Assert.assertEquals( - new UnaryExpression(UnaryExpression.Op.SQRT, new Variable("a")), - new Assign().createExpression("âa")); - - Assert.assertEquals( - new UnaryExpression(UnaryExpression.Op.SQRT, new DoubleValue(2.0)), - new Assign().createExpression("â2")); - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/5d4bb423/ratis-examples/src/test/java/org/apache/ratis/examples/arithmetic/cli/TestAssignCli.java ---------------------------------------------------------------------- diff --git a/ratis-examples/src/test/java/org/apache/ratis/examples/arithmetic/cli/TestAssignCli.java b/ratis-examples/src/test/java/org/apache/ratis/examples/arithmetic/cli/TestAssignCli.java new file mode 100644 index 0000000..06a87d3 --- /dev/null +++ b/ratis-examples/src/test/java/org/apache/ratis/examples/arithmetic/cli/TestAssignCli.java @@ -0,0 +1,56 @@ +/** + * 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. + */ +package org.apache.ratis.examples.arithmetic.cli; + +import org.apache.ratis.examples.arithmetic.expression.DoubleValue; +import org.apache.ratis.examples.arithmetic.expression.Variable; +import org.junit.Assert; +import org.junit.Test; + +import static org.apache.ratis.examples.arithmetic.expression.BinaryExpression.Op.ADD; +import static org.apache.ratis.examples.arithmetic.expression.BinaryExpression.Op.MULT; +import static org.apache.ratis.examples.arithmetic.expression.UnaryExpression.Op.SQRT; + +public class TestAssignCli { + @Test + public void createExpression() throws Exception { + Assert.assertEquals( + new DoubleValue(2.0), + new Assign().createExpression("2.0")); + + Assert.assertEquals( + MULT.apply(2.0, new Variable("a")), + new Assign().createExpression("2*a")); + + Assert.assertEquals( + ADD.apply(2.0, 1.0), + new Assign().createExpression("2+1")); + + Assert.assertEquals( + ADD.apply(new Variable("a"), new Variable("b")), + new Assign().createExpression("a+b")); + + Assert.assertEquals( + SQRT.apply(new Variable("a")), + new Assign().createExpression("âa")); + + Assert.assertEquals( + SQRT.apply(2.0), + new Assign().createExpression("â2")); + } +} \ No newline at end of file
