deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject deltaspike git commit: DELTASPIKE-835 ServiceUtilsTest
Date Fri, 20 Feb 2015 11:56:24 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 01e15f9b2 -> 067b5bd0a


DELTASPIKE-835 ServiceUtilsTest


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/067b5bd0
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/067b5bd0
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/067b5bd0

Branch: refs/heads/master
Commit: 067b5bd0a422b9bc092277ae4077bdeadcba53f5
Parents: 01e15f9
Author: gpetracek <gpetracek@apache.org>
Authored: Fri Feb 20 12:51:07 2015 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Fri Feb 20 12:51:07 2015 +0100

----------------------------------------------------------------------
 .../test/core/impl/custom/spi/MyImpl.java       | 28 +++++++++++
 .../test/core/impl/custom/spi/MyInterface.java  | 24 ++++++++++
 .../spi/PartialBeanAsInterfaceEarFileTest.java  | 43 +++++++++++++++++
 .../core/impl/custom/spi/ServiceUtilsTest.java  | 46 ++++++++++++++++++
 .../custom/spi/ServiceUtilsWarFileTest.java     | 50 ++++++++++++++++++++
 .../test/core/api/partialbean/uc001/MyImpl.java | 28 -----------
 .../core/api/partialbean/uc001/MyInterface.java | 24 ----------
 .../uc001/PartialBeanAsInterfaceTest.java       |  9 ----
 .../PartialBeanAsInterfaceWarFileTest.java      |  1 -
 9 files changed, 191 insertions(+), 62 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/067b5bd0/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/MyImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/MyImpl.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/MyImpl.java
new file mode 100644
index 0000000..22c5787
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/MyImpl.java
@@ -0,0 +1,28 @@
+/*
+ * 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.deltaspike.test.core.impl.custom.spi;
+
+public class MyImpl implements MyInterface
+{
+    @Override
+    public String getValue()
+    {
+        return "test";
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/067b5bd0/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/MyInterface.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/MyInterface.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/MyInterface.java
new file mode 100644
index 0000000..2499f68
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/MyInterface.java
@@ -0,0 +1,24 @@
+/*
+ * 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.deltaspike.test.core.impl.custom.spi;
+
+public interface MyInterface
+{
+    String getValue();
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/067b5bd0/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/PartialBeanAsInterfaceEarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/PartialBeanAsInterfaceEarFileTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/PartialBeanAsInterfaceEarFileTest.java
new file mode 100644
index 0000000..e904c41
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/PartialBeanAsInterfaceEarFileTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.deltaspike.test.core.impl.custom.spi;
+
+import org.apache.deltaspike.test.category.EnterpriseArchiveProfileCategory;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.spec.EnterpriseArchive;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+@Category(EnterpriseArchiveProfileCategory.class)
+public class PartialBeanAsInterfaceEarFileTest extends ServiceUtilsTest
+{
+    @Deployment
+    public static EnterpriseArchive deployEar()
+    {
+        //workaround for tomee - the ear-file needs to have the same name as the war-file
+        String simpleName = ServiceUtilsWarFileTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        return ShrinkWrap.create(EnterpriseArchive.class, archiveName + ".ear")
+                .addAsModule(ServiceUtilsWarFileTest.deploy());
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/067b5bd0/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/ServiceUtilsTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/ServiceUtilsTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/ServiceUtilsTest.java
new file mode 100644
index 0000000..c67986e
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/ServiceUtilsTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.deltaspike.test.core.impl.custom.spi;
+
+import org.apache.deltaspike.core.util.ServiceUtils;
+import org.apache.deltaspike.test.utils.CdiContainerUnderTest;
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Test;
+
+public abstract class ServiceUtilsTest
+{
+    private static final String CONTAINER_OWB_1_1_x = "owb-1\\.1\\..*";
+
+    @Test
+    public void lookupOfSpiImplementations()
+    {
+        //exclude it due to an issue with the arquillian-adapter for owb 1.1.x
+        Assume.assumeTrue(!CdiContainerUnderTest.is(CONTAINER_OWB_1_1_x));
+
+        Assert.assertTrue(ServiceUtils.loadServiceImplementations(MyInterface.class).iterator().hasNext());
+
+        Assert.assertNotNull(ServiceUtils.loadServiceImplementations(MyInterface.class));
+        Assert.assertFalse(ServiceUtils.loadServiceImplementations(MyInterface.class).isEmpty());
+        Assert.assertEquals(1, ServiceUtils.loadServiceImplementations(MyInterface.class).size());
+
+        Assert.assertEquals(
+            "test", ServiceUtils.loadServiceImplementations(MyInterface.class).iterator().next().getValue());
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/067b5bd0/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/ServiceUtilsWarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/ServiceUtilsWarFileTest.java
b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/ServiceUtilsWarFileTest.java
new file mode 100644
index 0000000..568d802
--- /dev/null
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/impl/custom/spi/ServiceUtilsWarFileTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.deltaspike.test.core.impl.custom.spi;
+
+import org.apache.deltaspike.test.util.ArchiveUtils;
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.JavaArchive;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.runner.RunWith;
+
+@RunWith(Arquillian.class)
+public class ServiceUtilsWarFileTest extends ServiceUtilsTest
+{
+    @Deployment
+    public static WebArchive deploy()
+    {
+        String simpleName = ServiceUtilsWarFileTest.class.getSimpleName();
+        String archiveName = simpleName.substring(0, 1).toLowerCase() + simpleName.substring(1);
+
+        JavaArchive testJar = ShrinkWrap.create(JavaArchive.class, archiveName + ".jar")
+                .addPackage(ServiceUtilsWarFileTest.class.getPackage())
+                .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
+
+        return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
+                .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreArchive())
+                .addAsLibraries(testJar)
+                //due to an issue with arquillian we can just add it to the web-archive (and
not the jar)
+                .addAsServiceProvider(MyInterface.class, MyImpl.class)
+                .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
+    }
+}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/067b5bd0/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/MyImpl.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/MyImpl.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/MyImpl.java
deleted file mode 100644
index c18907d..0000000
--- a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/MyImpl.java
+++ /dev/null
@@ -1,28 +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.deltaspike.test.core.api.partialbean.uc001;
-
-public class MyImpl implements MyInterface
-{
-    @Override
-    public String getValue()
-    {
-        return "test";
-    }
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/067b5bd0/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/MyInterface.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/MyInterface.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/MyInterface.java
deleted file mode 100644
index b0f4fc9..0000000
--- a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/MyInterface.java
+++ /dev/null
@@ -1,24 +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.deltaspike.test.core.api.partialbean.uc001;
-
-public interface MyInterface
-{
-    String getValue();
-}

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/067b5bd0/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceTest.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceTest.java
index 7fb832c..8e92182 100644
--- a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceTest.java
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceTest.java
@@ -18,7 +18,6 @@
  */
 package org.apache.deltaspike.test.core.api.partialbean.uc001;
 
-import org.apache.deltaspike.core.util.ServiceUtils;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -38,12 +37,4 @@ public abstract class PartialBeanAsInterfaceTest
 
         //TODO test pre-destroy callback
     }
-
-    @Test
-    public void spi() {
-        Assert.assertTrue(ServiceUtils.loadServiceImplementations(MyInterface.class).iterator().hasNext());
-
-        Assert.assertEquals("test",
-            ServiceUtils.loadServiceImplementations(MyInterface.class).iterator().next().getValue());
-    }
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/067b5bd0/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceWarFileTest.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceWarFileTest.java
b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceWarFileTest.java
index 40d7fc9..7fa2b0b 100644
--- a/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceWarFileTest.java
+++ b/deltaspike/modules/partial-bean/impl/src/test/java/org/apache/deltaspike/test/core/api/partialbean/uc001/PartialBeanAsInterfaceWarFileTest.java
@@ -45,7 +45,6 @@ public class PartialBeanAsInterfaceWarFileTest extends PartialBeanAsInterfaceTes
         return ShrinkWrap.create(WebArchive.class, archiveName + ".war")
                 .addAsLibraries(ArchiveUtils.getDeltaSpikeCoreAndPartialBeanArchive())
                 .addAsLibraries(testJar)
-                .addAsServiceProvider(MyInterface.class, MyImpl.class)
                 .addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
     }
 }


Mime
View raw message