JAMES-2525 moves common test components to guice-common

Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/5dff052d
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/5dff052d
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/5dff052d

Branch: refs/heads/master
Commit: 5dff052d10b0dbaa689e60614c5d5d54259ae51f
Parents: 8ecd8bb
Author: Jean Helou <[email protected]>
Authored: Mon Sep 10 14:53:55 2018 +0200
Committer: Benoit Tellier <[email protected]>
Committed: Thu Oct 11 09:26:15 2018 +0700

----------------------------------------------------------------------
 .../james/AggregateGuiceModuleTestRule.java     | 82 --------------------
 .../org/apache/james/GuiceModuleTestRule.java   | 30 -------
 .../apache/james/TempFilesystemTestRule.java    | 54 -------------
 .../james/AggregateGuiceModuleTestRule.java     | 82 ++++++++++++++++++++
 .../org/apache/james/GuiceModuleTestRule.java   | 30 +++++++
 .../apache/james/TempFilesystemTestRule.java    | 54 +++++++++++++
 6 files changed, 166 insertions(+), 166 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/5dff052d/server/container/guice/cassandra-guice/src/test/java/org/apache/james/AggregateGuiceModuleTestRule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/AggregateGuiceModuleTestRule.java
 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/AggregateGuiceModuleTestRule.java
deleted file mode 100644
index b3c4f71..0000000
--- 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/AggregateGuiceModuleTestRule.java
+++ /dev/null
@@ -1,82 +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.james;
-
-import java.util.List;
-
-import org.junit.rules.RuleChain;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-import com.github.steveash.guavate.Guavate;
-import com.google.common.collect.ImmutableList;
-import com.google.inject.Module;
-import com.google.inject.util.Modules;
-
-
-public class AggregateGuiceModuleTestRule implements GuiceModuleTestRule {
-
-    public static AggregateGuiceModuleTestRule of(GuiceModuleTestRule... 
subrule) {
-        return new AggregateGuiceModuleTestRule(ImmutableList.copyOf(subrule));
-    }
-
-    private final List<GuiceModuleTestRule> subrule;
-    private final RuleChain chain;
-
-    private AggregateGuiceModuleTestRule(List<GuiceModuleTestRule> subrule) {
-        this.subrule = subrule;
-        this.chain = subrule
-                .stream()
-                .reduce(RuleChain.emptyRuleChain(),
-                        RuleChain::around,
-                        RuleChain::around);
-    }
-
-    public AggregateGuiceModuleTestRule aggregate(GuiceModuleTestRule... 
subrule) {
-        List<GuiceModuleTestRule> guiceModules = 
ImmutableList.<GuiceModuleTestRule>builder()
-                .addAll(this.subrule)
-                .add(subrule)
-                .build();
-
-        return new AggregateGuiceModuleTestRule(guiceModules);
-    }
-
-    @Override
-    public Module getModule() {
-        List<Module> modules = subrule
-                    .stream()
-                    .map(GuiceModuleTestRule::getModule)
-                    .collect(Guavate.toImmutableList());
-
-        return Modules.combine(modules);
-    }
-
-    @Override
-    public Statement apply(Statement base, Description description) {
-        return chain.apply(base, description);
-    }
-
-    @Override
-    public void await() {
-        subrule
-            .parallelStream()
-            .forEach(GuiceModuleTestRule::await);
-    }
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/5dff052d/server/container/guice/cassandra-guice/src/test/java/org/apache/james/GuiceModuleTestRule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/GuiceModuleTestRule.java
 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/GuiceModuleTestRule.java
deleted file mode 100644
index ca586c4..0000000
--- 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/GuiceModuleTestRule.java
+++ /dev/null
@@ -1,30 +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.james;
-
-import org.junit.rules.TestRule;
-
-import com.google.inject.Module;
-
-public interface GuiceModuleTestRule extends TestRule {
-    Module getModule();
-
-    void await();
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/5dff052d/server/container/guice/cassandra-guice/src/test/java/org/apache/james/TempFilesystemTestRule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/TempFilesystemTestRule.java
 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/TempFilesystemTestRule.java
deleted file mode 100644
index 54d5c12..0000000
--- 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/TempFilesystemTestRule.java
+++ /dev/null
@@ -1,54 +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.james;
-
-import org.junit.rules.TemporaryFolder;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-import com.google.inject.Module;
-
-public class TempFilesystemTestRule implements GuiceModuleTestRule {
-
-    private final TemporaryFolder temporaryFolder;
-
-    public TempFilesystemTestRule() {
-        this.temporaryFolder = new TemporaryFolder();
-    }
-
-    public TemporaryFolder getTemporaryFolder() {
-        return temporaryFolder;
-    }
-
-    @Override
-    public Statement apply(Statement base, Description description) {
-        return temporaryFolder.apply(base, description);
-    }
-
-    @Override
-    public Module getModule() {
-        return binder -> { };
-    }
-
-    @Override
-    public void await() {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/james-project/blob/5dff052d/server/container/guice/guice-common/src/test/java/org/apache/james/AggregateGuiceModuleTestRule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/test/java/org/apache/james/AggregateGuiceModuleTestRule.java
 
b/server/container/guice/guice-common/src/test/java/org/apache/james/AggregateGuiceModuleTestRule.java
new file mode 100644
index 0000000..b3c4f71
--- /dev/null
+++ 
b/server/container/guice/guice-common/src/test/java/org/apache/james/AggregateGuiceModuleTestRule.java
@@ -0,0 +1,82 @@
+/****************************************************************
+ * 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.james;
+
+import java.util.List;
+
+import org.junit.rules.RuleChain;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import com.github.steveash.guavate.Guavate;
+import com.google.common.collect.ImmutableList;
+import com.google.inject.Module;
+import com.google.inject.util.Modules;
+
+
+public class AggregateGuiceModuleTestRule implements GuiceModuleTestRule {
+
+    public static AggregateGuiceModuleTestRule of(GuiceModuleTestRule... 
subrule) {
+        return new AggregateGuiceModuleTestRule(ImmutableList.copyOf(subrule));
+    }
+
+    private final List<GuiceModuleTestRule> subrule;
+    private final RuleChain chain;
+
+    private AggregateGuiceModuleTestRule(List<GuiceModuleTestRule> subrule) {
+        this.subrule = subrule;
+        this.chain = subrule
+                .stream()
+                .reduce(RuleChain.emptyRuleChain(),
+                        RuleChain::around,
+                        RuleChain::around);
+    }
+
+    public AggregateGuiceModuleTestRule aggregate(GuiceModuleTestRule... 
subrule) {
+        List<GuiceModuleTestRule> guiceModules = 
ImmutableList.<GuiceModuleTestRule>builder()
+                .addAll(this.subrule)
+                .add(subrule)
+                .build();
+
+        return new AggregateGuiceModuleTestRule(guiceModules);
+    }
+
+    @Override
+    public Module getModule() {
+        List<Module> modules = subrule
+                    .stream()
+                    .map(GuiceModuleTestRule::getModule)
+                    .collect(Guavate.toImmutableList());
+
+        return Modules.combine(modules);
+    }
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return chain.apply(base, description);
+    }
+
+    @Override
+    public void await() {
+        subrule
+            .parallelStream()
+            .forEach(GuiceModuleTestRule::await);
+    }
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/5dff052d/server/container/guice/guice-common/src/test/java/org/apache/james/GuiceModuleTestRule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/test/java/org/apache/james/GuiceModuleTestRule.java
 
b/server/container/guice/guice-common/src/test/java/org/apache/james/GuiceModuleTestRule.java
new file mode 100644
index 0000000..ca586c4
--- /dev/null
+++ 
b/server/container/guice/guice-common/src/test/java/org/apache/james/GuiceModuleTestRule.java
@@ -0,0 +1,30 @@
+/****************************************************************
+ * 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.james;
+
+import org.junit.rules.TestRule;
+
+import com.google.inject.Module;
+
+public interface GuiceModuleTestRule extends TestRule {
+    Module getModule();
+
+    void await();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/5dff052d/server/container/guice/guice-common/src/test/java/org/apache/james/TempFilesystemTestRule.java
----------------------------------------------------------------------
diff --git 
a/server/container/guice/guice-common/src/test/java/org/apache/james/TempFilesystemTestRule.java
 
b/server/container/guice/guice-common/src/test/java/org/apache/james/TempFilesystemTestRule.java
new file mode 100644
index 0000000..54d5c12
--- /dev/null
+++ 
b/server/container/guice/guice-common/src/test/java/org/apache/james/TempFilesystemTestRule.java
@@ -0,0 +1,54 @@
+/****************************************************************
+ * 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.james;
+
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import com.google.inject.Module;
+
+public class TempFilesystemTestRule implements GuiceModuleTestRule {
+
+    private final TemporaryFolder temporaryFolder;
+
+    public TempFilesystemTestRule() {
+        this.temporaryFolder = new TemporaryFolder();
+    }
+
+    public TemporaryFolder getTemporaryFolder() {
+        return temporaryFolder;
+    }
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return temporaryFolder.apply(base, description);
+    }
+
+    @Override
+    public Module getModule() {
+        return binder -> { };
+    }
+
+    @Override
+    public void await() {
+    }
+
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to