You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commonsrdf.apache.org by st...@apache.org on 2016/10/23 00:59:52 UTC
[09/22] incubator-commonsrdf git commit: tests for ServiceLoader
tests for ServiceLoader
Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/102a9fce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/102a9fce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/102a9fce
Branch: refs/heads/COMMONSRDF-46
Commit: 102a9fcebe32a384139ec2267fa332a3da8129a3
Parents: 2c62ada
Author: Stian Soiland-Reyes <st...@apache.org>
Authored: Wed Oct 19 18:02:16 2016 +0100
Committer: Stian Soiland-Reyes <st...@apache.org>
Committed: Wed Oct 19 18:02:53 2016 +0100
----------------------------------------------------------------------
.../commons/rdf/jena/JenaServiceLoaderTest.java | 40 +++++++++++++++++++
.../rdf/jsonldjava/JsonLdServiceLoaderTest.java | 40 +++++++++++++++++++
.../rdf/rdf4j/RDF4JServiceLoaderTest.java | 40 +++++++++++++++++++
.../simple/SimpleRDFTermFactoryLookupTest.java | 42 --------------------
.../rdf/simple/SimpleServiceLoaderTest.java | 40 +++++++++++++++++++
5 files changed, 160 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/102a9fce/jena/src/test/java/org/apache/commons/rdf/jena/JenaServiceLoaderTest.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/JenaServiceLoaderTest.java b/jena/src/test/java/org/apache/commons/rdf/jena/JenaServiceLoaderTest.java
new file mode 100644
index 0000000..1793c3e
--- /dev/null
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/JenaServiceLoaderTest.java
@@ -0,0 +1,40 @@
+/**
+ * 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.commons.rdf.jena;
+
+import static org.junit.Assert.fail;
+
+import java.util.ServiceLoader;
+
+import org.apache.commons.rdf.api.RDFFactory;
+import org.junit.Test;
+
+public class JenaServiceLoaderTest {
+
+ @Test
+ public void testServiceLoaderLookup() {
+ ServiceLoader<RDFFactory> loader = ServiceLoader.load(RDFFactory.class);
+ for (RDFFactory impl : loader) {
+ if (impl instanceof JenaFactory) {
+ return; // yay
+ }
+ }
+ fail("JenaFactory not found in ServiceLoader");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/102a9fce/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdServiceLoaderTest.java
----------------------------------------------------------------------
diff --git a/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdServiceLoaderTest.java b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdServiceLoaderTest.java
new file mode 100644
index 0000000..ce07a37
--- /dev/null
+++ b/jsonld-java/src/test/java/org/apache/commons/rdf/jsonldjava/JsonLdServiceLoaderTest.java
@@ -0,0 +1,40 @@
+/**
+ * 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.commons.rdf.jsonldjava;
+
+import static org.junit.Assert.fail;
+
+import java.util.ServiceLoader;
+
+import org.apache.commons.rdf.api.RDFFactory;
+import org.junit.Test;
+
+public class JsonLdServiceLoaderTest {
+
+ @Test
+ public void testServiceLoaderLookup() {
+ ServiceLoader<RDFFactory> loader = ServiceLoader.load(RDFFactory.class);
+ for (RDFFactory impl : loader) {
+ if (impl instanceof JsonLdFactory) {
+ return; // yay
+ }
+ }
+ fail("JsonLdFactory not found in ServiceLoader");
+ }
+ }
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/102a9fce/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/RDF4JServiceLoaderTest.java
----------------------------------------------------------------------
diff --git a/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/RDF4JServiceLoaderTest.java b/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/RDF4JServiceLoaderTest.java
new file mode 100644
index 0000000..77c396c
--- /dev/null
+++ b/rdf4j/src/test/java/org/apache/commons/rdf/rdf4j/RDF4JServiceLoaderTest.java
@@ -0,0 +1,40 @@
+/**
+ * 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.commons.rdf.rdf4j;
+
+import static org.junit.Assert.fail;
+
+import java.util.ServiceLoader;
+
+import org.apache.commons.rdf.api.RDFFactory;
+import org.junit.Test;
+
+public class RDF4JServiceLoaderTest {
+
+ @Test
+ public void testServiceLoaderLookup() {
+ ServiceLoader<RDFFactory> loader = ServiceLoader.load(RDFFactory.class);
+ for (RDFFactory impl : loader) {
+ if (impl instanceof RDF4JFactory) {
+ return; // yay
+ }
+ }
+ fail("RDF4JFactory not found in ServiceLoader");
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/102a9fce/simple/src/test/java/org/apache/commons/rdf/simple/SimpleRDFTermFactoryLookupTest.java
----------------------------------------------------------------------
diff --git a/simple/src/test/java/org/apache/commons/rdf/simple/SimpleRDFTermFactoryLookupTest.java b/simple/src/test/java/org/apache/commons/rdf/simple/SimpleRDFTermFactoryLookupTest.java
deleted file mode 100644
index 179b7ef..0000000
--- a/simple/src/test/java/org/apache/commons/rdf/simple/SimpleRDFTermFactoryLookupTest.java
+++ /dev/null
@@ -1,42 +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.commons.rdf.simple;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Iterator;
-import java.util.ServiceLoader;
-
-import org.apache.commons.rdf.api.RDFFactory;
-import org.junit.Test;
-
-public class SimpleRDFTermFactoryLookupTest {
-
- @Test
- public void testServiceLoaderLookup() {
- ServiceLoader<RDFFactory> loader = ServiceLoader.load(RDFFactory.class);
-
- Iterator<RDFFactory> iterator = loader.iterator();
- RDFFactory factory = iterator.next();
-
- assertTrue(factory instanceof SimpleRDFFactory);
- assertFalse(iterator.hasNext());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/102a9fce/simple/src/test/java/org/apache/commons/rdf/simple/SimpleServiceLoaderTest.java
----------------------------------------------------------------------
diff --git a/simple/src/test/java/org/apache/commons/rdf/simple/SimpleServiceLoaderTest.java b/simple/src/test/java/org/apache/commons/rdf/simple/SimpleServiceLoaderTest.java
new file mode 100644
index 0000000..00e33d3
--- /dev/null
+++ b/simple/src/test/java/org/apache/commons/rdf/simple/SimpleServiceLoaderTest.java
@@ -0,0 +1,40 @@
+/**
+ * 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.commons.rdf.simple;
+
+import static org.junit.Assert.fail;
+
+import java.util.ServiceLoader;
+
+import org.apache.commons.rdf.api.RDFFactory;
+import org.junit.Test;
+
+public class SimpleServiceLoaderTest {
+
+ @Test
+ public void testServiceLoaderLookup() {
+ ServiceLoader<RDFFactory> loader = ServiceLoader.load(RDFFactory.class);
+ for (RDFFactory impl : loader) {
+ if (impl instanceof SimpleRDFFactory) {
+ return; // yay
+ }
+ }
+ fail("SimpleRDFFactory not found in ServiceLoader");
+ }
+}