You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2017/01/13 00:07:06 UTC
geode git commit: Remove unused files
Repository: geode
Updated Branches:
refs/heads/feature/GEODE-1930-2 c206d5b78 -> 0373d1a0a
Remove unused files
Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/0373d1a0
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/0373d1a0
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/0373d1a0
Branch: refs/heads/feature/GEODE-1930-2
Commit: 0373d1a0aaa827386395c6047db38470cb5e2950
Parents: c206d5b
Author: Kirk Lund <kl...@apache.org>
Authored: Thu Jan 12 16:06:51 2017 -0800
Committer: Kirk Lund <kl...@apache.org>
Committed: Thu Jan 12 16:06:51 2017 -0800
----------------------------------------------------------------------
.../test/dunit/rules/DistributedRunRules.java | 76 -------
.../test/dunit/rules/DistributedStatement.java | 75 -------
.../test/dunit/rules/DistributedTestRule.java | 200 -------------------
.../dunit/rules/DistributedWrapperRule.java | 51 -----
.../apache/geode/test/dunit/rules/WhichVMs.java | 59 ------
5 files changed, 461 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/geode/blob/0373d1a0/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRunRules.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRunRules.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRunRules.java
deleted file mode 100644
index 7a86613..0000000
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedRunRules.java
+++ /dev/null
@@ -1,76 +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.geode.test.dunit.rules;
-
-import java.io.Serializable;
-
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.SerializableRunnable;
-
-/**
- * Runs Rules in specified DUnit VMs.
- */
-public class DistributedRunRules extends Statement implements Serializable {
- private final Statement statement;
- private final WhichVMs whichVMs;
-
- public DistributedRunRules(final Statement base, final Iterable<TestRule> rules,
- final Description description, final WhichVMs whichVMs) {
- this.statement = applyAll(base, rules, description);
- this.whichVMs = whichVMs;
- }
-
- @Override
- public void evaluate() throws Throwable {
- if (this.whichVMs.controllerVM()) {
- this.statement.evaluate();
- }
- if (this.whichVMs.everyVM()) {
- for (int i = 0; i < Host.getHost(0).getVMCount(); i++) {
- Host.getHost(0).getVM(i).invoke(runnable());
- }
- }
- if (this.whichVMs.locatorVM()) {
- Host.getHost(0).getLocator().invoke(runnable());
- }
- }
-
- private Statement applyAll(Statement result, final Iterable<TestRule> rules,
- final Description description) {
- for (TestRule each : rules) {
- result = each.apply(result, description);
- }
- return result;
- }
-
- private SerializableRunnable runnable() {
- return new SerializableRunnable() {
- @Override
- public void run() {
- try {
- DistributedRunRules.this.statement.evaluate();
- } catch (Error | RuntimeException e) {
- throw e;
- } catch (Throwable t) {
- throw new RuntimeException(t);
- }
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/geode/blob/0373d1a0/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedStatement.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedStatement.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedStatement.java
deleted file mode 100644
index cdc8dda..0000000
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedStatement.java
+++ /dev/null
@@ -1,75 +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.geode.test.dunit.rules;
-
-import java.io.Serializable;
-
-import org.junit.runners.model.Statement;
-
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.SerializableRunnable;
-import org.apache.geode.test.junit.rules.serializable.SerializableStatement;
-
-/**
- * Invokes Statement in specified DUnit VMs.
- */
-public class DistributedStatement extends SerializableStatement {
- private final SerializableStatement next;
- private final WhichVMs whichVMs;
-
- /**
- * Construct a new {@code DistributedStatement} statement.
- *
- * @param next the next {@code Statement} in the execution chain
- * @param whichVMs specifies which VMs should invoke the statement
- */
- public DistributedStatement(final SerializableStatement next, final WhichVMs whichVMs) {
- this.next = next;
- this.whichVMs = whichVMs;
- }
-
- /**
- * Invoke the {@link Statement} in the specified VMs.
- */
- @Override
- public void evaluate() throws Throwable {
- if (this.whichVMs.controllerVM()) {
- this.next.evaluate();
- }
- if (this.whichVMs.everyVM()) {
- for (int i = 0; i < Host.getHost(0).getVMCount(); i++) {
- Host.getHost(0).getVM(i).invoke(runnable());
- }
- }
- if (this.whichVMs.locatorVM()) {
- Host.getHost(0).getLocator().invoke(runnable());
- }
- }
-
- private SerializableRunnable runnable() {
- return new SerializableRunnable() {
- @Override
- public void run() {
- try {
- next.evaluate();
- } catch (Error | RuntimeException e) {
- throw e;
- } catch (Throwable t) {
- throw new RuntimeException(t);
- }
- }
- };
- }
-}
http://git-wip-us.apache.org/repos/asf/geode/blob/0373d1a0/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedTestRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedTestRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedTestRule.java
deleted file mode 100644
index 31fba3d..0000000
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedTestRule.java
+++ /dev/null
@@ -1,200 +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.geode.test.dunit.rules;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.rules.MethodRule;
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.Statement;
-import org.junit.runners.model.TestClass;
-
-import org.apache.geode.test.dunit.standalone.DUnitLauncher;
-
-/**
- * Launches the DUnit framework for a {@code DistributedTest}.
- *
- * <p>
- * Enables use of {@link DistributedRule} annotations on any Rules.
- *
- * <pre>
- * {@literal @}Category(DistributedTest.class)
- * public class QueryDataDUnitTest {
- *
- * {@literal @}DistributedRule
- * public UseJacksonForJsonPathRule useJacksonForJsonPathRule = new UseJacksonForJsonPathRule();
- *
- * {@literal @}Rule
- * public DistributedTestRule distributedTestRule = DistributedTestRule.builder().build();
- *
- * ...
- * }
- * </pre>
- * <p>
- * Use the {@code Builder} to specify which {@code VM}s should invoke any {@code Rule} annotated
- * with {@literal @}DistributedRule. By default, {@code controllerVM} is {@code true},
- * {@code everyVM} is {@code true} and {@code locatorVM} is {@code false}.
- */
-public class DistributedTestRule implements MethodRule, Serializable {
-
- public static Builder builder() {
- return new Builder();
- }
-
- private TestClass testClass;
-
- private final List<?> rules = new ArrayList<>(); // types are TestRule or MethodRule
-
- private final RemoteInvoker invoker;
-
- private final WhichVMs whichVMs;
-
- // TODO: add ability to specify ordering of DistributedRules
-
- protected DistributedTestRule(final Builder builder) {
- this(new RemoteInvoker(), builder);
- }
-
- protected DistributedTestRule(final RemoteInvoker invoker, final Builder builder) {
- this.invoker = invoker;
-
- this.whichVMs = new WhichVMs();
- if (builder.controllerVM) {
- this.whichVMs.addControllerVM();
- }
- if (builder.everyVM) {
- this.whichVMs.addEveryVM();
- }
- if (builder.locatorVM) {
- this.whichVMs.addLocatorVM();
- }
- }
-
- @Override
- public Statement apply(final Statement base, final FrameworkMethod method, final Object target) {
- this.testClass = new TestClass(target.getClass());
- Statement statement = base;
- statement = withRules(method, target, statement);
- statement = withDUnit(method, target, statement);
- return statement;
- }
-
- protected Statement withDUnit(final FrameworkMethod method, final Object target,
- final Statement statement) {
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
- setUpDUnit();
- try {
- statement.evaluate();
- } finally {
- tearDownDUnit();
- }
- }
- };
- }
-
- protected void setUpDUnit() throws Exception {
- DUnitLauncher.launchIfNeeded();
- // TODO: customize based on fields
- }
-
- protected void tearDownDUnit() throws Exception {}
-
- protected Statement withRules(final FrameworkMethod method, final Object target,
- final Statement statement) {
- List<TestRule> testRules = this.testRules(target);
- Statement result = statement;
- // result = withMethodRules(method, testRules, target, result);
- result = withTestRules(method, testRules, result);
-
- return result;
- }
-
- // protected Statement withMethodRules(final FrameworkMethod method, final List<TestRule>
- // testRules, final Object target, final Statement result) {
- // Statement statement = result;
- // for (MethodRule rule : methodRules(target)) {
- // if (!testRules.contains(rule)) {
- // statement = new DistributedStatement(rule.apply((result, method, target), this.whichVMs);
- // }
- // }
- // return statement;
- // }
-
- protected Statement withTestRules(final FrameworkMethod method, final List<TestRule> testRules,
- final Statement statement) {
- Description description = Description.createTestDescription(this.testClass.getJavaClass(),
- method.getName(), method.getAnnotations());
- return testRules.isEmpty() ? statement
- : new DistributedRunRules(statement, testRules, description, this.whichVMs);
- }
-
- protected List<MethodRule> methodRules(final Object target) {
- List<MethodRule> rules =
- this.testClass.getAnnotatedMethodValues(target, DistributedRule.class, MethodRule.class);
- rules.addAll(
- this.testClass.getAnnotatedFieldValues(target, DistributedRule.class, MethodRule.class));
- return rules;
- }
-
- protected List<TestRule> testRules(final Object target) {
- List<TestRule> result =
- this.testClass.getAnnotatedMethodValues(target, DistributedRule.class, TestRule.class);
- result.addAll(
- this.testClass.getAnnotatedFieldValues(target, DistributedRule.class, TestRule.class));
- return result;
- }
-
- /**
- * Builds an instance of {@link DistributedTestRule}.
- *
- * <p>
- * By default, {@code controllerVM} is {@code true}, {@code everyVM} is {@code true} and
- * {@code locatorVM} is {@code false}.
- */
- public static class Builder {
-
- private boolean everyVM = true;
- private boolean locatorVM = false;
- private boolean controllerVM = true;
-
- protected Builder() {}
-
- public Builder everyVM(final boolean everyVM) {
- this.everyVM = everyVM;
- return this;
- }
-
- public Builder locatorVM(final boolean locatorVM) {
- this.locatorVM = locatorVM;
- return this;
- }
-
- public Builder controllerVM(final boolean locatorVM) {
- this.locatorVM = locatorVM;
- return this;
- }
-
- public DistributedTestRule build() {
- return new DistributedTestRule(this);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/geode/blob/0373d1a0/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedWrapperRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedWrapperRule.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedWrapperRule.java
deleted file mode 100644
index 6b1f8f1..0000000
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/DistributedWrapperRule.java
+++ /dev/null
@@ -1,51 +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.geode.test.dunit.rules;
-
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-import org.apache.geode.test.junit.rules.UseJacksonForJsonPathRule;
-import org.apache.geode.test.junit.rules.serializable.SerializableExternalResource;
-import org.apache.geode.test.junit.rules.serializable.SerializableStatement;
-import org.apache.geode.test.junit.rules.serializable.SerializableTestRule;
-
-public class DistributedWrapperRule implements SerializableTestRule {
-
- private static SerializableTestRule instance;
-
- private final RemoteInvoker invoker;
- private final WhichVMs whichVMs;
-
- public DistributedWrapperRule(final SerializableTestRule testRule) {
- this(testRule, new WhichVMs().addControllerVM().addEveryVM());
- }
-
- public DistributedWrapperRule(final SerializableTestRule testRule, final WhichVMs whichVMs) {
- this(new RemoteInvoker(), testRule, whichVMs);
- }
-
- public DistributedWrapperRule(final RemoteInvoker invoker, final SerializableTestRule testRule,
- final WhichVMs whichVMs) {
- this.invoker = invoker;
- instance = testRule;
- this.whichVMs = whichVMs;
- }
-
- @Override
- public Statement apply(Statement base, Description description) {
- return new DistributedStatement((SerializableStatement) base, whichVMs);
- }
-}
http://git-wip-us.apache.org/repos/asf/geode/blob/0373d1a0/geode-core/src/test/java/org/apache/geode/test/dunit/rules/WhichVMs.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/WhichVMs.java b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/WhichVMs.java
deleted file mode 100644
index 1048f2e..0000000
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/WhichVMs.java
+++ /dev/null
@@ -1,59 +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.geode.test.dunit.rules;
-
-import java.io.Serializable;
-
-/**
- * Specifies which DUnit VMs will invoke a Rule.
- *
- * TODO: add ability to specify specific VMs
- *
- * TODO: add ability to specify order
- */
-public class WhichVMs implements Serializable {
- private boolean controllerVM;
- private boolean everyVM;
- private boolean locatorVM;
-
- public WhichVMs() {}
-
- public WhichVMs addControllerVM() {
- this.controllerVM = true;
- return this;
- }
-
- public WhichVMs addEveryVM() {
- this.everyVM = true;
- return this;
- }
-
- public WhichVMs addLocatorVM() {
- this.locatorVM = true;
- return this;
- }
-
- public boolean controllerVM() {
- return this.controllerVM;
- }
-
- public boolean everyVM() {
- return this.everyVM;
- }
-
- public boolean locatorVM() {
- return this.locatorVM;
- }
-}