Updated Branches: refs/heads/develop 2d0cb602b -> 0226c44ae
- cleaned up tests for LDCache Project: http://git-wip-us.apache.org/repos/asf/marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/marmotta/commit/0226c44a Tree: http://git-wip-us.apache.org/repos/asf/marmotta/tree/0226c44a Diff: http://git-wip-us.apache.org/repos/asf/marmotta/diff/0226c44a Branch: refs/heads/develop Commit: 0226c44ae8d291b565c77576db2e347a43aa9ef6 Parents: 2d0cb60 Author: Sebastian Schaffert <[email protected]> Authored: Thu Jan 9 21:43:08 2014 +0100 Committer: Sebastian Schaffert <[email protected]> Committed: Thu Jan 9 21:43:08 2014 +0100 ---------------------------------------------------------------------- .../services/test/dummy/DummyEndpoint.java | 29 ------- .../services/test/dummy/DummyProvider.java | 66 ---------------- .../ldcache/services/test/dummy/DummyTest.java | 82 -------------------- ...ache.marmotta.ldclient.api.endpoint.Endpoint | 1 - ....marmotta.ldclient.api.provider.DataProvider | 1 - .../ldcache/services/test/dummy/resource1.ttl | 21 ----- .../ldcache/services/test/dummy/resource2.ttl | 20 ----- .../ldcache/services/test/dummy/resource3.ttl | 20 ----- .../ldcache/services/test/dummy/DummyTest.java | 7 +- .../provider/ldap/TestLdapFoafProvider.java | 3 +- 10 files changed, 6 insertions(+), 244 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/marmotta/blob/0226c44a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyEndpoint.java ---------------------------------------------------------------------- diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyEndpoint.java b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyEndpoint.java deleted file mode 100644 index 1289776..0000000 --- a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyEndpoint.java +++ /dev/null @@ -1,29 +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.marmotta.ldcache.services.test.dummy; - -import org.apache.marmotta.ldclient.api.endpoint.Endpoint; - -public class DummyEndpoint extends Endpoint { - - public DummyEndpoint() { - super("Dummy", "Dummy", "^http://localhost", null, 86400l); - setPriority(PRIORITY_HIGH); - } - -} http://git-wip-us.apache.org/repos/asf/marmotta/blob/0226c44a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyProvider.java ---------------------------------------------------------------------- diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyProvider.java b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyProvider.java deleted file mode 100644 index 685c79a..0000000 --- a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyProvider.java +++ /dev/null @@ -1,66 +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.marmotta.ldcache.services.test.dummy; - -import org.apache.marmotta.commons.sesame.model.ModelCommons; -import org.apache.marmotta.ldclient.api.endpoint.Endpoint; -import org.apache.marmotta.ldclient.api.ldclient.LDClientService; -import org.apache.marmotta.ldclient.api.provider.DataProvider; -import org.apache.marmotta.ldclient.exception.DataRetrievalException; -import org.apache.marmotta.ldclient.model.ClientResponse; -import org.openrdf.model.Model; -import org.openrdf.model.impl.TreeModel; -import org.openrdf.rio.RDFFormat; -import org.openrdf.rio.RDFParseException; - -import java.io.IOException; - -public class DummyProvider implements DataProvider { - - @Override - public String getName() { - return "Dummy"; - } - - @Override - public String[] listMimeTypes() { - return new String[] {"application/dummy"}; - } - - @Override - public ClientResponse retrieveResource(String resource, LDClientService client, Endpoint endpoint) throws DataRetrievalException { - String filename = resource.substring("http://localhost/".length()) + ".ttl"; - - Model triples = new TreeModel(); - try { - ModelCommons.add(triples, DummyProvider.class.getResourceAsStream(filename), resource, RDFFormat.TURTLE); - - } catch (RDFParseException e) { - throw new DataRetrievalException("could not parse resource data for file "+filename); - } catch (IOException e) { - throw new DataRetrievalException("could not load resource data for file "+filename); - } - - ClientResponse response = new ClientResponse(200, triples); - - return response; - - } - - -} http://git-wip-us.apache.org/repos/asf/marmotta/blob/0226c44a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyTest.java ---------------------------------------------------------------------- diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyTest.java b/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyTest.java deleted file mode 100644 index 15a49d8..0000000 --- a/libraries/ldcache/ldcache-backend-kiwi/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyTest.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.marmotta.ldcache.services.test.dummy; - -import org.apache.marmotta.ldclient.api.ldclient.LDClientService; -import org.apache.marmotta.ldclient.model.ClientResponse; -import org.apache.marmotta.ldclient.services.ldclient.LDClient; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.openrdf.repository.RepositoryConnection; - -/** - * Test if the dummy components work. - * <p/> - * Author: Sebastian Schaffert ([email protected]) - */ -public class DummyTest { - - private LDClientService ldclient; - - - @Before - public void setupClient() { - ldclient = new LDClient(); - } - - @After - public void shutdownClient() { - ldclient.shutdown(); - } - - @Test - public void testDummyProvider() throws Exception { - ClientResponse resp1 = ldclient.retrieveResource("http://localhost/resource1"); - RepositoryConnection con1 = resp1.getTriples().getConnection(); - try { - con1.begin(); - Assert.assertEquals(3, con1.size()); - con1.commit(); - } finally { - con1.close(); - } - - ClientResponse resp2 = ldclient.retrieveResource("http://localhost/resource2"); - RepositoryConnection con2 = resp2.getTriples().getConnection(); - try { - con2.begin(); - Assert.assertEquals(2, con2.size()); - con2.commit(); - } finally { - con2.close(); - } - - ClientResponse resp3 = ldclient.retrieveResource("http://localhost/resource3"); - RepositoryConnection con3 = resp3.getTriples().getConnection(); - try { - con3.begin(); - Assert.assertEquals(2, con3.size()); - con3.commit(); - } finally { - con3.close(); - } - } - -} http://git-wip-us.apache.org/repos/asf/marmotta/blob/0226c44a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/META-INF/services/org.apache.marmotta.ldclient.api.endpoint.Endpoint ---------------------------------------------------------------------- diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/META-INF/services/org.apache.marmotta.ldclient.api.endpoint.Endpoint b/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/META-INF/services/org.apache.marmotta.ldclient.api.endpoint.Endpoint deleted file mode 100644 index f2001b2..0000000 --- a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/META-INF/services/org.apache.marmotta.ldclient.api.endpoint.Endpoint +++ /dev/null @@ -1 +0,0 @@ -org.apache.marmotta.ldcache.services.test.dummy.DummyEndpoint \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/0226c44a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/META-INF/services/org.apache.marmotta.ldclient.api.provider.DataProvider ---------------------------------------------------------------------- diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/META-INF/services/org.apache.marmotta.ldclient.api.provider.DataProvider b/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/META-INF/services/org.apache.marmotta.ldclient.api.provider.DataProvider deleted file mode 100644 index 15f3621..0000000 --- a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/META-INF/services/org.apache.marmotta.ldclient.api.provider.DataProvider +++ /dev/null @@ -1 +0,0 @@ -org.apache.marmotta.ldcache.services.test.dummy.DummyProvider \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/0226c44a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/org/apache/marmotta/ldcache/services/test/dummy/resource1.ttl ---------------------------------------------------------------------- diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/org/apache/marmotta/ldcache/services/test/dummy/resource1.ttl b/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/org/apache/marmotta/ldcache/services/test/dummy/resource1.ttl deleted file mode 100644 index 71ef413..0000000 --- a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/org/apache/marmotta/ldcache/services/test/dummy/resource1.ttl +++ /dev/null @@ -1,21 +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. -# -@prefix ex: <http://localhost/> . -ex:resource1 ex:property1 "Value 1" ; - ex:property2 ex:resource2 ; - ex:property3 "Value X" . \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/0226c44a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/org/apache/marmotta/ldcache/services/test/dummy/resource2.ttl ---------------------------------------------------------------------- diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/org/apache/marmotta/ldcache/services/test/dummy/resource2.ttl b/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/org/apache/marmotta/ldcache/services/test/dummy/resource2.ttl deleted file mode 100644 index 5a2ce88..0000000 --- a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/org/apache/marmotta/ldcache/services/test/dummy/resource2.ttl +++ /dev/null @@ -1,20 +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. -# -@prefix ex: <http://localhost/> . -ex:resource2 ex:property1 "Value 2" ; - ex:property2 ex:resource3 . \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/0226c44a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/org/apache/marmotta/ldcache/services/test/dummy/resource3.ttl ---------------------------------------------------------------------- diff --git a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/org/apache/marmotta/ldcache/services/test/dummy/resource3.ttl b/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/org/apache/marmotta/ldcache/services/test/dummy/resource3.ttl deleted file mode 100644 index ec03e8b..0000000 --- a/libraries/ldcache/ldcache-backend-kiwi/src/test/resources/org/apache/marmotta/ldcache/services/test/dummy/resource3.ttl +++ /dev/null @@ -1,20 +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. -# -@prefix ex: <http://localhost/> . -ex:resource3 ex:property1 "Value 3" ; - ex:property3 "Value 4" . \ No newline at end of file http://git-wip-us.apache.org/repos/asf/marmotta/blob/0226c44a/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyTest.java ---------------------------------------------------------------------- diff --git a/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyTest.java b/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyTest.java index 15a49d8..188c97c 100644 --- a/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyTest.java +++ b/libraries/ldcache/ldcache-core/src/test/java/org/apache/marmotta/ldcache/services/test/dummy/DummyTest.java @@ -17,6 +17,7 @@ */ package org.apache.marmotta.ldcache.services.test.dummy; +import org.apache.marmotta.commons.sesame.model.ModelCommons; import org.apache.marmotta.ldclient.api.ldclient.LDClientService; import org.apache.marmotta.ldclient.model.ClientResponse; import org.apache.marmotta.ldclient.services.ldclient.LDClient; @@ -49,7 +50,7 @@ public class DummyTest { @Test public void testDummyProvider() throws Exception { ClientResponse resp1 = ldclient.retrieveResource("http://localhost/resource1"); - RepositoryConnection con1 = resp1.getTriples().getConnection(); + RepositoryConnection con1 = ModelCommons.asRepository(resp1.getData()).getConnection(); try { con1.begin(); Assert.assertEquals(3, con1.size()); @@ -59,7 +60,7 @@ public class DummyTest { } ClientResponse resp2 = ldclient.retrieveResource("http://localhost/resource2"); - RepositoryConnection con2 = resp2.getTriples().getConnection(); + RepositoryConnection con2 = ModelCommons.asRepository(resp2.getData()).getConnection(); try { con2.begin(); Assert.assertEquals(2, con2.size()); @@ -69,7 +70,7 @@ public class DummyTest { } ClientResponse resp3 = ldclient.retrieveResource("http://localhost/resource3"); - RepositoryConnection con3 = resp3.getTriples().getConnection(); + RepositoryConnection con3 = ModelCommons.asRepository(resp3.getData()).getConnection(); try { con3.begin(); Assert.assertEquals(2, con3.size()); http://git-wip-us.apache.org/repos/asf/marmotta/blob/0226c44a/libraries/ldclient/ldclient-provider-ldap/src/test/java/org/apache/marmotta/ldclient/provider/ldap/TestLdapFoafProvider.java ---------------------------------------------------------------------- diff --git a/libraries/ldclient/ldclient-provider-ldap/src/test/java/org/apache/marmotta/ldclient/provider/ldap/TestLdapFoafProvider.java b/libraries/ldclient/ldclient-provider-ldap/src/test/java/org/apache/marmotta/ldclient/provider/ldap/TestLdapFoafProvider.java index e8436c1..72919e1 100644 --- a/libraries/ldclient/ldclient-provider-ldap/src/test/java/org/apache/marmotta/ldclient/provider/ldap/TestLdapFoafProvider.java +++ b/libraries/ldclient/ldclient-provider-ldap/src/test/java/org/apache/marmotta/ldclient/provider/ldap/TestLdapFoafProvider.java @@ -17,6 +17,7 @@ */ package org.apache.marmotta.ldclient.provider.ldap; +import org.apache.marmotta.commons.sesame.model.ModelCommons; import org.apache.marmotta.ldclient.api.endpoint.Endpoint; import org.apache.marmotta.ldclient.api.ldclient.LDClientService; import org.apache.marmotta.ldclient.model.ClientConfiguration; @@ -57,7 +58,7 @@ public class TestLdapFoafProvider { config.addEndpoint(endpoint); LDClientService ldclient = new TestLDClient(new LDClient(config)); ClientResponse response = ldclient.retrieveResource(resource); - RepositoryConnection connection = response.getTriples().getConnection(); + RepositoryConnection connection = ModelCommons.asRepository(response.getData()).getConnection(); connection.begin(); Assert.assertTrue(connection.size() > 0); connection.commit();
