You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2013/02/22 16:21:37 UTC
[2/37] MARMOTTA-105: renamed packages in marmotta-core
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/kiwi/core/test/base/EmbeddedLMF.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/kiwi/core/test/base/EmbeddedLMF.java b/platform/marmotta-core/src/test/java/kiwi/core/test/base/EmbeddedLMF.java
deleted file mode 100644
index 5f3576c..0000000
--- a/platform/marmotta-core/src/test/java/kiwi/core/test/base/EmbeddedLMF.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package kiwi.core.test.base;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * An embedded version of the LMF. Provides support to startup and shutdown the CDI container and the LMF for test cases.
- * After the embedded LMF has been used, it should always be shutdown before being reused.
- * <p/>
- * Author: Sebastian Schaffert
- */
-public class EmbeddedLMF extends AbstractLMF {
-
- private static Logger log = LoggerFactory.getLogger(EmbeddedLMF.class);
-
- public EmbeddedLMF() {
- super();
-
- // initiate the first startup phase without a servlet context and with the override definition of the parent
- startupService.startupConfiguration(lmfHome.getAbsolutePath(),override,null);
-
- // initiate the second startup phase and pretend we are running at localhost
- startupService.startupHost("http://localhost/","http://localhost/");
-
- log.info("EmbeddedLMF created");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/kiwi/core/test/base/JettyLMF.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/kiwi/core/test/base/JettyLMF.java b/platform/marmotta-core/src/test/java/kiwi/core/test/base/JettyLMF.java
deleted file mode 100644
index 51db164..0000000
--- a/platform/marmotta-core/src/test/java/kiwi/core/test/base/JettyLMF.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2013 Salzburg Research.
- *
- * Licensed 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 kiwi.core.test.base;
-
-import kiwi.core.servlet.KiWiResourceFilter;
-import kiwi.core.test.base.jetty.TestApplication;
-import kiwi.core.test.base.jetty.TestInjectorFactory;
-import kiwi.core.util.KiWiContext;
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.nio.SelectChannelConnector;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.FilterHolder;
-import org.mortbay.jetty.servlet.ServletHolder;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * An extended version of the EmbeddedLMF which also starts a jetty webcontainer. The context name and port
- * are passed in the constructor. The JettyLMF can optionally take a set of web service classes as argument.
- * If this argument is present, only the given web services will be instantiated; otherwise, all configured
- * web services will be instantiated (as in a normal LMF webapp installation).
- * <p/>
- * Author: Sebastian Schaffert
- */
-public class JettyLMF extends AbstractLMF {
-
- private Server jetty;
-
- public JettyLMF(String context, int port) {
- this(context, port, (Set<Class<?>>) null);
- }
-
- public JettyLMF(String context, int port, Class<?> webservice) {
- this(context,port, Collections.<Class<?>>singleton(webservice));
- }
-
- public JettyLMF(String context, int port, Class<?>... webservices) {
- this(context,port, new HashSet<Class<?>>(Arrays.asList(webservices)));
- }
-
-
- public JettyLMF(String context, int port, Set<Class<?>> webservice) {
- super();
-
- // create a new jetty
- jetty = new Server();
-
- // run it on port 8080
- Connector connector=new SelectChannelConnector();
- connector.setPort(port);
- jetty.setConnectors(new Connector[]{connector});
-
-
- TestInjectorFactory.setManager(container.getBeanManager());
-
- Context ctx = new Context(jetty,context != null ? context : "/");
-
- // now we have a context, start up the first phase of the LMF initialisation
- startupService.startupConfiguration(lmfHome.getAbsolutePath(),override,ctx.getServletContext());
-
- // register the RestEasy CDI injector factory
- ctx.setAttribute("resteasy.injector.factory","kiwi.core.test.base.jetty.TestInjectorFactory");
-
-
- // register the LMF filters
- FilterHolder resourceFilter = new FilterHolder(KiWiContext.getInstance(KiWiResourceFilter.class));
- resourceFilter.setInitParameter("kiwi.resourceCaching", "true");
- ctx.addFilter(resourceFilter,"/*", Handler.DEFAULT);
-
- // register RestEasy so we can run web services
-
- // if a single web service is given, only register that webservice, otherwise startup the default configuration
- //FilterHolder restEasyFilter = new FilterHolder(org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.class);
- ServletHolder restEasyFilter = new ServletHolder(org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.class);
- restEasyFilter.setInitParameter("resteasy.injector.factory", "kiwi.core.test.base.jetty.TestInjectorFactory");
-
-
- if(webservice != null) {
- TestApplication.setTestedWebServices(webservice);
-
- //restEasyFilter.setInitParameter("resteasy.resources", webservice.getName());
- restEasyFilter.setInitParameter("javax.ws.rs.Application","kiwi.core.test.base.jetty.TestApplication");
- } else {
- restEasyFilter.setInitParameter("javax.ws.rs.Application","kiwi.core.webservices.CoreApplication");
- }
-
- //ctx.addFilter(restEasyFilter,"/*", Handler.ALL);
- ctx.addServlet(restEasyFilter, "/*");
-
- try {
- jetty.start();
-
- String url = "http://localhost:"+port+ (context != null ? context + "/" : "/");
-
- startupService.startupHost(url,url);
- } catch (Exception e) {
- log.error("could not start up embedded jetty server",e);
- }
- }
-
- @Override
- public void shutdown() {
- try {
- jetty.stop();
- } catch (Exception e) {
- log.error("could not shutdown embedded jetty server",e);
- }
- super.shutdown();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/kiwi/core/test/base/jetty/TestApplication.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/kiwi/core/test/base/jetty/TestApplication.java b/platform/marmotta-core/src/test/java/kiwi/core/test/base/jetty/TestApplication.java
deleted file mode 100644
index 107ce99..0000000
--- a/platform/marmotta-core/src/test/java/kiwi/core/test/base/jetty/TestApplication.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package kiwi.core.test.base.jetty;
-
-import javax.ws.rs.core.Application;
-import java.util.Set;
-
-/**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert
- */
-public class TestApplication extends Application {
-
- // this is a hack, since there is no other way to inject a service class into a JAX-RS application
- private static Set<Class<?>> testedWebService;
-
-
- @Override
- public Set<Class<?>> getClasses() {
- return testedWebService;
- }
-
-
- public static void setTestedWebServices(Set<Class<?>> testedWebService) {
- TestApplication.testedWebService = testedWebService;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/kiwi/core/test/base/jetty/TestInjectorFactory.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/kiwi/core/test/base/jetty/TestInjectorFactory.java b/platform/marmotta-core/src/test/java/kiwi/core/test/base/jetty/TestInjectorFactory.java
deleted file mode 100644
index 0997117..0000000
--- a/platform/marmotta-core/src/test/java/kiwi/core/test/base/jetty/TestInjectorFactory.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package kiwi.core.test.base.jetty;
-
-import org.jboss.resteasy.cdi.CdiConstructorInjector;
-import org.jboss.resteasy.cdi.CdiPropertyInjector;
-import org.jboss.resteasy.cdi.ResteasyCdiExtension;
-import org.jboss.resteasy.core.ValueInjector;
-import org.jboss.resteasy.logging.Logger;
-import org.jboss.resteasy.spi.ConstructorInjector;
-import org.jboss.resteasy.spi.InjectorFactory;
-import org.jboss.resteasy.spi.MethodInjector;
-import org.jboss.resteasy.spi.PropertyInjector;
-import org.jboss.resteasy.spi.ResteasyProviderFactory;
-
-import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.inject.spi.Bean;
-import javax.enterprise.inject.spi.BeanManager;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.Collections;
-import java.util.Set;
-
-/**
- * Custom injector component for the test environment
- * <p/>
- * Author: Sebastian Schaffert
- */
-@SuppressWarnings("rawtypes")
-public class TestInjectorFactory implements InjectorFactory {
-
- private static final Logger log = Logger.getLogger(TestInjectorFactory.class);
-
- private InjectorFactory delegate;
- private static BeanManager manager;
- private ResteasyCdiExtension extension;
-
- public TestInjectorFactory() {
- this.delegate = ResteasyProviderFactory.getInstance().getInjectorFactory();
- this.extension = lookupResteasyCdiExtension();
-
- log.info("creating new RestEasy Injector Factory for LMF Test Environment");
- }
-
- public static void setManager(BeanManager manager) {
- TestInjectorFactory.manager = manager;
- }
-
- @Override
- public ConstructorInjector createConstructor(Constructor constructor) {
- Class<?> clazz = constructor.getDeclaringClass();
-
- if (!manager.getBeans(clazz).isEmpty())
- {
- log.debug("Using CdiConstructorInjector for class {0}.", clazz);
- return new CdiConstructorInjector(clazz, manager);
- }
-
- log.debug("No CDI beans found for {0}. Using default ConstructorInjector.", clazz);
- return delegate.createConstructor(constructor);
-
- }
-
- @Override
- public PropertyInjector createPropertyInjector(Class resourceClass) {
- return new CdiPropertyInjector(delegate.createPropertyInjector(resourceClass), resourceClass, Collections.<Class<?>, Type>emptyMap(), manager);
- }
-
- @Override
- public MethodInjector createMethodInjector(Class root, Method method) {
- return delegate.createMethodInjector(root, method);
- }
-
- @Override
- public ValueInjector createParameterExtractor(Class injectTargetClass, AccessibleObject injectTarget, Class type, Type genericType, Annotation[] annotations) {
- return delegate.createParameterExtractor(injectTargetClass, injectTarget, type, genericType, annotations);
- }
-
- @Override
- public ValueInjector createParameterExtractor(Class injectTargetClass, AccessibleObject injectTarget, Class type, Type genericType, Annotation[] annotations, boolean useDefault) {
- return delegate.createParameterExtractor(injectTargetClass, injectTarget, type, genericType, annotations, useDefault);
- }
-
-
- /**
- * Lookup ResteasyCdiExtension instance that was instantiated during CDI bootstrap
- *
- * @return ResteasyCdiExtension instance
- */
- private ResteasyCdiExtension lookupResteasyCdiExtension()
- {
- Set<Bean<?>> beans = manager.getBeans(ResteasyCdiExtension.class);
- Bean<?> bean = manager.resolve(beans);
- if (bean == null) throw new IllegalStateException("Unable to obtain ResteasyCdiExtension instance.");
- CreationalContext<?> context = manager.createCreationalContext(bean);
- return (ResteasyCdiExtension) manager.getReference(bean, ResteasyCdiExtension.class, context);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/kiwi/core/test/config/ConfigurationServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/kiwi/core/test/config/ConfigurationServiceTest.java b/platform/marmotta-core/src/test/java/kiwi/core/test/config/ConfigurationServiceTest.java
deleted file mode 100644
index a720bf9..0000000
--- a/platform/marmotta-core/src/test/java/kiwi/core/test/config/ConfigurationServiceTest.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package kiwi.core.test.config;
-
-import junit.framework.Assert;
-import kiwi.core.api.config.ConfigurationService;
-import kiwi.core.test.base.EmbeddedLMF;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-/**
- * Test the functionality of the configuration service
- * <p/>
- * Author: Sebastian Schaffert
- */
-public class ConfigurationServiceTest {
-
- private static EmbeddedLMF lmf;
- private static ConfigurationService configurationService;
-
- @BeforeClass
- public static void setUp() {
- lmf = new EmbeddedLMF();
- configurationService = lmf.getService(ConfigurationService.class);
- }
-
- @Test
- public void testSetString() {
- String key = "foo.key";
- String value = "Foo Value";
-
- // test without / with default value
- Assert.assertNull(configurationService.getStringConfiguration(key));
- Assert.assertEquals("default",configurationService.getStringConfiguration(key,"default"));
-
-
- // set value to a new value
- configurationService.setConfiguration(key, value);
- Assert.assertEquals(value,configurationService.getConfiguration(key));
-
- // remove value and check it is unset afterwards
- configurationService.removeConfiguration(key);
- Assert.assertNull(configurationService.getStringConfiguration(key));
-
- }
-
- @Test
- public void testSetList() {
- String key = "foo.listkey";
- List<String> values = new ArrayList<String>();
- values.add("foo");
- values.add("bar");
-
- // test without / with default value
- Assert.assertNull(configurationService.getStringConfiguration(key));
- Assert.assertTrue(configurationService.getListConfiguration(key).size() == 0);
- Assert.assertEquals(values,configurationService.getListConfiguration(key, values));
-
-
- // set value to a new value
- configurationService.setConfiguration(key, values);
- Assert.assertEquals(values,configurationService.getListConfiguration(key));
-
- // remove value and check it is unset afterwards
- configurationService.removeConfiguration(key);
- Assert.assertTrue(configurationService.getListConfiguration(key).size() == 0);
- }
-
- @Test
- public void testSetBoolean() {
- String key = "foo.booleankey";
- boolean value = true;
-
-
- // test without / with default value
- Assert.assertNull(configurationService.getStringConfiguration(key));
- Assert.assertFalse(configurationService.getBooleanConfiguration(key));
- Assert.assertTrue(configurationService.getBooleanConfiguration(key, true));
-
-
- // set value to a new value
- configurationService.setBooleanConfiguration(key, value);
- Assert.assertTrue(configurationService.getBooleanConfiguration(key));
-
- // remove value and check it is unset afterwards
- configurationService.removeConfiguration(key);
- Assert.assertFalse(configurationService.getBooleanConfiguration(key));
-
- }
-
-
- @Test
- public void testSetDouble() {
- String key = "foo.dblkey";
- double value = new Random().nextDouble();
-
- // test without / with default value
- Assert.assertNull(configurationService.getStringConfiguration(key));
- Assert.assertEquals(value,configurationService.getDoubleConfiguration(key,value),0.1);
-
-
- // set value to a new value
- configurationService.setDoubleConfiguration(key, value);
- Assert.assertEquals(value,configurationService.getDoubleConfiguration(key),0.1);
-
- // remove value and check it is unset afterwards
- configurationService.removeConfiguration(key);
- Assert.assertNull(configurationService.getStringConfiguration(key));
-
- }
-
- @Test
- public void testSetInt() {
- String key = "foo.intkey";
- int value = new Random().nextInt();
-
- // test without / with default value
- Assert.assertNull(configurationService.getStringConfiguration(key));
- Assert.assertEquals(value, configurationService.getIntConfiguration(key, value));
- Assert.assertEquals((double)value,configurationService.getDoubleConfiguration(key, value));
-
-
- // set value to a new value
- configurationService.setIntConfiguration(key, value);
- Assert.assertEquals(value,configurationService.getIntConfiguration(key));
-
- // remove value and check it is unset afterwards
- configurationService.removeConfiguration(key);
- Assert.assertNull(configurationService.getStringConfiguration(key));
-
- }
-
-
- @AfterClass
- public static void tearDown() {
- lmf.shutdown();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/kiwi/core/test/config/ConfigurationWebServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/kiwi/core/test/config/ConfigurationWebServiceTest.java b/platform/marmotta-core/src/test/java/kiwi/core/test/config/ConfigurationWebServiceTest.java
deleted file mode 100644
index a6a3091..0000000
--- a/platform/marmotta-core/src/test/java/kiwi/core/test/config/ConfigurationWebServiceTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package kiwi.core.test.config;
-
-import com.google.common.collect.Lists;
-import com.jayway.restassured.RestAssured;
-import kiwi.core.api.config.ConfigurationService;
-import kiwi.core.test.base.JettyLMF;
-import kiwi.core.webservices.config.ConfigurationWebService;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import java.io.IOException;
-
-import static com.jayway.restassured.RestAssured.expect;
-import static com.jayway.restassured.RestAssured.given;
-import static org.hamcrest.Matchers.hasItem;
-import static org.hamcrest.Matchers.hasItems;
-
-/**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert
- */
-public class ConfigurationWebServiceTest {
-
- private static JettyLMF lmf;
- private static ConfigurationService configurationService;
-
- private static ObjectMapper mapper = new ObjectMapper();
-
-
- @BeforeClass
- public static void setUp() {
- lmf = new JettyLMF("/LMF",8080, ConfigurationWebService.class);
- configurationService = lmf.getService(ConfigurationService.class);
-
- RestAssured.baseURI = "http://localhost";
- RestAssured.port = 8080;
- RestAssured.basePath = "/LMF";
-
- }
-
- @AfterClass
- public static void tearDown() {
- lmf.shutdown();
- }
-
- @Test
- public void testSetConfiguration() throws IOException {
- // set my.key to the values "value1" and "value2"
- given().
- header("Content-Type","application/json").
- content(mapper.writeValueAsString(Lists.newArrayList("value1", "value2"))).
- expect().
- statusCode(200).
- when().
- post("/config/data/mykey");
-
-
- // test whether configuration service has the key
- Assert.assertThat(configurationService.getListConfiguration("mykey"), hasItem("value1"));
-
- // test whether values appear when retrieving the key
- expect().
- statusCode(200).
- body("mykey",hasItems("value1","value2")).
- when().
- get("/config/data/mykey");
-
- // test whether values appear in full list
- expect().
- statusCode(200).
- body("mykey.value",hasItems("value1","value2")).
- when().
- get("/config/list");
-
-
- // test whether deleting returns OK
- expect().
- statusCode(200).
- when().
- delete("/config/data/mykey");
-
-
- // test whether values appear when retrieving the key
- expect().
- statusCode(404).
- when().
- get("/config/data/mykey");
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/kiwi/core/test/embedded/EmbeddedLMFTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/kiwi/core/test/embedded/EmbeddedLMFTest.java b/platform/marmotta-core/src/test/java/kiwi/core/test/embedded/EmbeddedLMFTest.java
deleted file mode 100644
index aa6d118..0000000
--- a/platform/marmotta-core/src/test/java/kiwi/core/test/embedded/EmbeddedLMFTest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package kiwi.core.test.embedded;
-
-import kiwi.core.api.config.ConfigurationService;
-import kiwi.core.test.base.EmbeddedLMF;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert
- */
-public class EmbeddedLMFTest {
-
- @Test
- public void testLMFStartup() {
- EmbeddedLMF lmf = new EmbeddedLMF();
-
- ConfigurationService cs = lmf.getService(ConfigurationService.class);
-
- Assert.assertNotNull(cs);
-
- lmf.shutdown();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/kiwi/core/test/user/UserServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/kiwi/core/test/user/UserServiceTest.java b/platform/marmotta-core/src/test/java/kiwi/core/test/user/UserServiceTest.java
deleted file mode 100644
index 695a940..0000000
--- a/platform/marmotta-core/src/test/java/kiwi/core/test/user/UserServiceTest.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2012 Salzburg Research.
- *
- * Licensed 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 kiwi.core.test.user;
-
-import kiwi.core.api.user.UserService;
-import kiwi.core.exception.UserExistsException;
-import kiwi.core.test.base.EmbeddedLMF;
-import org.apache.commons.lang.RandomStringUtils;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.openrdf.model.URI;
-
-/**
- * Add file description here!
- * <p/>
- * Author: Sebastian Schaffert
- */
-public class UserServiceTest {
-
- private static EmbeddedLMF lmf;
- private static UserService userService;
-
- @BeforeClass
- public static void setUp() {
- lmf = new EmbeddedLMF();
- userService = lmf.getService(UserService.class);
- }
-
- @AfterClass
- public static void tearDown() {
- lmf.shutdown();
- }
-
- @Test
- public void testAnonymousUser() {
- Assert.assertNotNull(userService.getAnonymousUser());
- Assert.assertTrue(userService.isAnonymous(userService.getAnonymousUser()));
- Assert.assertTrue(userService.getAnonymousUser().stringValue().endsWith("anonymous"));
- }
-
- @Test
- public void testAdminUser() {
- Assert.assertNotNull(userService.getAdminUser());
- Assert.assertFalse(userService.isAnonymous(userService.getAdminUser()));
- Assert.assertTrue(userService.getAdminUser().stringValue().endsWith("admin"));
- }
-
- @Test
- public void testUserExists() {
- String login = RandomStringUtils.randomAlphabetic(8);
-
- Assert.assertFalse(userService.userExists(login));
- Assert.assertNull(userService.getUser(login));
- }
-
- @Test
- public void testCreateUser() {
- String login = RandomStringUtils.randomAlphabetic(8);
-
- try {
- URI user = userService.createUser(login);
- Assert.assertNotNull(user);
- Assert.assertFalse(userService.isAnonymous(user));
- Assert.assertTrue(user.stringValue().endsWith(login));
- Assert.assertTrue(userService.userExists(login));
- Assert.assertNotNull(userService.getUser(login));
- } catch (UserExistsException ex) {
- Assert.fail(ex.getMessage());
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/kiwi/core/util/http/UriUtilTests.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/kiwi/core/util/http/UriUtilTests.java b/platform/marmotta-core/src/test/java/kiwi/core/util/http/UriUtilTests.java
deleted file mode 100644
index f2ecc68..0000000
--- a/platform/marmotta-core/src/test/java/kiwi/core/util/http/UriUtilTests.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Copyright (c) 2013 Salzburg Research.
- *
- * Licensed 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 kiwi.core.util.http;
-
-import org.apache.marmotta.commons.http.UriUtil;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.util.UUID;
-
-import static org.junit.Assert.*;
-
-/**
- * URI utilities tests
- *
- * @author Sergio Fernández
- *
- */
-public class UriUtilTests {
-
- private final String base = "http://localhost:8080/LMF/resource/";
-
- @Before
- public void setup() {
-
- }
-
- private String buildUri(String part) {
- return buildUri(base, part);
- }
-
- private String buildUri(String base, String part) {
- return base + part;
- }
-
- @Test
- public void validate() {
- assertTrue(UriUtil.validate(buildRightUri()));
- }
-
- @Test
- public void validateFtp() {
- assertTrue(UriUtil.validate(buildFtpUri()));
- }
-
- @Test
- public void validateUrn() {
- assertTrue(UriUtil.validate(buildUrnUri()));
- }
-
- @Test
- public void validateHashl() {
- assertTrue(UriUtil.validate(buildUriHash()));
- }
-
- @Test
- public void validateQuery() {
- assertTrue(UriUtil.validate(buildUriQuery()));
- }
-
- @Test
- public void validateEmptyQuery() {
- assertTrue(UriUtil.validate(buildUriEmtpyQuery()));
- }
-
- @Test
- public void validateQueryUnicode() {
- assertTrue(UriUtil.validate(buildUriQueryUnicode()));
- }
-
- @Test
- public void validateQueryUnicodeParam() {
- assertTrue(UriUtil.validate(buildUriQueryUnicodeParam()));
- }
-
- @Test
- public void validateWrong() {
- assertFalse(UriUtil.validate(buildInvalid()));
- }
-
- @Test
- public void evaluateValidationPerformace() {
- assertTrue(evaluateValidationPerformace(buildRightUri()) >= 0.0);
- assertTrue(evaluateValidationPerformace(buildFtpUri()) >= 0.0);
- assertTrue(evaluateValidationPerformace(buildUrnUri()) >= 0.0);
- assertTrue(evaluateValidationPerformace(buildUriHash()) >= 0.0);
- assertTrue(evaluateValidationPerformace(buildUriQuery()) >= 0.0);
- assertTrue(evaluateValidationPerformace(buildUriEmtpyQuery()) >= 0.0);
- assertTrue(evaluateValidationPerformace(buildInvalid()) >= 0.0);
-
- // both implementations are very similar about performance
- // since the result could be unpredictable, not assert added
- evaluateValidationPerformace(buildUriQueryUnicode()); //
- evaluateValidationPerformace(buildUriQueryUnicodeParam());
- }
-
- private long evaluateValidationPerformace(String uri) {
- long start = System.nanoTime();
- UriUtil.validateApache(uri);
- long apache = System.nanoTime() - start;
- start = System.nanoTime();
- UriUtil.validateJavaNet(uri);
- long javanet = System.nanoTime() - start;
- System.out.println("apache " + apache + " ns, " + "java.net " + javanet + " ns (" + uri + ")");
- return apache - javanet;
- }
-
- private String buildRightUri() {
- return buildUri(UUID.randomUUID().toString());
- }
-
- private String buildFtpUri() {
- return buildUri(UUID.randomUUID().toString());
- }
-
- private String buildUrnUri() {
- return buildUri("urn:issn", UUID.randomUUID().toString());
- }
-
- private String buildUriHash() {
- return buildUri(UUID.randomUUID().toString() + "#");
- }
-
- private String buildUriQuery() {
- return buildUri(UUID.randomUUID().toString() + "?foo=bar");
- }
-
- private String buildUriEmtpyQuery() {
- return buildUri(UUID.randomUUID().toString() + "?");
- }
-
- private String buildUriQueryUnicode() {
- return buildUri(UUID.randomUUID().toString() + "?foo=bár");
- }
-
- private String buildUriQueryUnicodeParam() {
- return buildUri(UUID.randomUUID().toString() + "?úri=foo");
- }
-
- private String buildInvalid() {
- return buildUri(UUID.randomUUID().toString()).substring(4);
- }
-
- @Test
- public void validateCurie() {
- String[] uris = { base + "foo", base + "foo#bar" };
- for (String uri : uris) {
- String ns = UriUtil.getNamespace(uri);
- String ref = UriUtil.getReference(uri);
- assertTrue(uri.startsWith(ns));
- assertTrue(uri.endsWith(ref));
- assertEquals(uri, ns + ref);
- }
- }
-
- @Test
- public void validateText() {
- assertFalse(UriUtil.validate("131185"));
- assertFalse(UriUtil.validate("foo"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/AbstractLMF.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/AbstractLMF.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/AbstractLMF.java
new file mode 100644
index 0000000..f8acb57
--- /dev/null
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/AbstractLMF.java
@@ -0,0 +1,109 @@
+package org.apache.marmotta.platform.core.test.base;
+
+import com.google.common.io.Files;
+import org.apache.marmotta.platform.core.jndi.LMFInitialContextFactoryBuilder;
+import org.apache.marmotta.platform.core.startup.LMFStartupService;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.MapConfiguration;
+import org.apache.commons.io.FileUtils;
+import org.jboss.weld.environment.se.Weld;
+import org.jboss.weld.environment.se.WeldContainer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.naming.spi.NamingManager;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public abstract class AbstractLMF {
+
+ protected static Logger log = LoggerFactory.getLogger(EmbeddedLMF.class);
+
+ protected Weld weld;
+ protected WeldContainer container;
+ protected LMFStartupService startupService;
+ protected Configuration override;
+
+ protected File lmfHome;
+
+ protected AbstractLMF() {
+ // initialise JNDI environment
+ try {
+ NamingManager.setInitialContextFactoryBuilder(new LMFInitialContextFactoryBuilder());
+ } catch (NamingException e) {
+
+ } catch (IllegalStateException e) {
+ }
+
+ // initialise CDI environment
+ weld = new Weld();
+ container = weld.initialize();
+
+ cleanJNDI();
+
+
+ // put bean manager into JNDI
+ try {
+ new InitialContext().bind("java:comp/BeanManager",container.getBeanManager());
+ } catch (NamingException e) {
+ log.error("error adding bean manager to JNDI",e);
+ }
+
+
+ // create temporary LMF home directory
+ lmfHome = Files.createTempDir();
+
+ // create a temporary configuration with an in-memory database URL for h2
+ override = new MapConfiguration(new HashMap<String,Object>());
+ override.setProperty("database.h2.url","jdbc:h2:mem;MVCC=true;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=10");
+ override.setProperty("logging.template", "/logback-testing.xml");
+
+ // initialise LMF using a temporary directory
+ startupService = getService(LMFStartupService.class);
+ }
+
+
+ public <T> T getService(Class<T> serviceClass) {
+ return container.instance().select(serviceClass).get();
+ }
+
+
+ public void shutdown() {
+ // remove bean manager from JNDI
+ cleanJNDI();
+
+ startupService.shutdown();
+ weld.shutdown();
+
+ try {
+ FileUtils.deleteDirectory(lmfHome);
+ } catch (IOException e) {
+ log.error("error while deleting temporary LMF home directory");
+ }
+ }
+
+
+ private void cleanJNDI() {
+ try {
+ new InitialContext().unbind("java:comp/env/BeanManager");
+ } catch (NamingException e) {
+ }
+ try {
+ new InitialContext().unbind("java:comp/BeanManager");
+ } catch (NamingException e) {
+ }
+ try {
+ new InitialContext().unbind("java:app/BeanManager");
+ } catch (NamingException e) {
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/EmbeddedLMF.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/EmbeddedLMF.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/EmbeddedLMF.java
new file mode 100644
index 0000000..2180696
--- /dev/null
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/EmbeddedLMF.java
@@ -0,0 +1,28 @@
+package org.apache.marmotta.platform.core.test.base;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An embedded version of the LMF. Provides support to startup and shutdown the CDI container and the LMF for test cases.
+ * After the embedded LMF has been used, it should always be shutdown before being reused.
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class EmbeddedLMF extends AbstractLMF {
+
+ private static Logger log = LoggerFactory.getLogger(EmbeddedLMF.class);
+
+ public EmbeddedLMF() {
+ super();
+
+ // initiate the first startup phase without a servlet context and with the override definition of the parent
+ startupService.startupConfiguration(lmfHome.getAbsolutePath(),override,null);
+
+ // initiate the second startup phase and pretend we are running at localhost
+ startupService.startupHost("http://localhost/","http://localhost/");
+
+ log.info("EmbeddedLMF created");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/JettyLMF.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/JettyLMF.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/JettyLMF.java
new file mode 100644
index 0000000..9205ef0
--- /dev/null
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/JettyLMF.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2013 Salzburg Research.
+ *
+ * Licensed 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.platform.core.test.base;
+
+import org.apache.marmotta.platform.core.servlet.KiWiResourceFilter;
+import org.apache.marmotta.platform.core.test.base.jetty.TestApplication;
+import org.apache.marmotta.platform.core.test.base.jetty.TestInjectorFactory;
+import org.apache.marmotta.platform.core.util.KiWiContext;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.servlet.FilterHolder;
+import org.mortbay.jetty.servlet.ServletHolder;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * An extended version of the EmbeddedLMF which also starts a jetty webcontainer. The context name and port
+ * are passed in the constructor. The JettyLMF can optionally take a set of web service classes as argument.
+ * If this argument is present, only the given web services will be instantiated; otherwise, all configured
+ * web services will be instantiated (as in a normal LMF webapp installation).
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class JettyLMF extends AbstractLMF {
+
+ private Server jetty;
+
+ public JettyLMF(String context, int port) {
+ this(context, port, (Set<Class<?>>) null);
+ }
+
+ public JettyLMF(String context, int port, Class<?> webservice) {
+ this(context,port, Collections.<Class<?>>singleton(webservice));
+ }
+
+ public JettyLMF(String context, int port, Class<?>... webservices) {
+ this(context,port, new HashSet<Class<?>>(Arrays.asList(webservices)));
+ }
+
+
+ public JettyLMF(String context, int port, Set<Class<?>> webservice) {
+ super();
+
+ // create a new jetty
+ jetty = new Server();
+
+ // run it on port 8080
+ Connector connector=new SelectChannelConnector();
+ connector.setPort(port);
+ jetty.setConnectors(new Connector[]{connector});
+
+
+ TestInjectorFactory.setManager(container.getBeanManager());
+
+ Context ctx = new Context(jetty,context != null ? context : "/");
+
+ // now we have a context, start up the first phase of the LMF initialisation
+ startupService.startupConfiguration(lmfHome.getAbsolutePath(),override,ctx.getServletContext());
+
+ // register the RestEasy CDI injector factory
+ ctx.setAttribute("resteasy.injector.factory","kiwi.core.test.base.jetty.TestInjectorFactory");
+
+
+ // register the LMF filters
+ FilterHolder resourceFilter = new FilterHolder(KiWiContext.getInstance(KiWiResourceFilter.class));
+ resourceFilter.setInitParameter("kiwi.resourceCaching", "true");
+ ctx.addFilter(resourceFilter,"/*", Handler.DEFAULT);
+
+ // register RestEasy so we can run web services
+
+ // if a single web service is given, only register that webservice, otherwise startup the default configuration
+ //FilterHolder restEasyFilter = new FilterHolder(org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.class);
+ ServletHolder restEasyFilter = new ServletHolder(org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.class);
+ restEasyFilter.setInitParameter("resteasy.injector.factory", "kiwi.core.test.base.jetty.TestInjectorFactory");
+
+
+ if(webservice != null) {
+ TestApplication.setTestedWebServices(webservice);
+
+ //restEasyFilter.setInitParameter("resteasy.resources", webservice.getName());
+ restEasyFilter.setInitParameter("javax.ws.rs.Application","kiwi.core.test.base.jetty.TestApplication");
+ } else {
+ restEasyFilter.setInitParameter("javax.ws.rs.Application","kiwi.core.webservices.CoreApplication");
+ }
+
+ //ctx.addFilter(restEasyFilter,"/*", Handler.ALL);
+ ctx.addServlet(restEasyFilter, "/*");
+
+ try {
+ jetty.start();
+
+ String url = "http://localhost:"+port+ (context != null ? context + "/" : "/");
+
+ startupService.startupHost(url,url);
+ } catch (Exception e) {
+ log.error("could not start up embedded jetty server",e);
+ }
+ }
+
+ @Override
+ public void shutdown() {
+ try {
+ jetty.stop();
+ } catch (Exception e) {
+ log.error("could not shutdown embedded jetty server",e);
+ }
+ super.shutdown();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestApplication.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestApplication.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestApplication.java
new file mode 100644
index 0000000..6804f52
--- /dev/null
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestApplication.java
@@ -0,0 +1,26 @@
+package org.apache.marmotta.platform.core.test.base.jetty;
+
+import javax.ws.rs.core.Application;
+import java.util.Set;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class TestApplication extends Application {
+
+ // this is a hack, since there is no other way to inject a service class into a JAX-RS application
+ private static Set<Class<?>> testedWebService;
+
+
+ @Override
+ public Set<Class<?>> getClasses() {
+ return testedWebService;
+ }
+
+
+ public static void setTestedWebServices(Set<Class<?>> testedWebService) {
+ TestApplication.testedWebService = testedWebService;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestInjectorFactory.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestInjectorFactory.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestInjectorFactory.java
new file mode 100644
index 0000000..79013b7
--- /dev/null
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/base/jetty/TestInjectorFactory.java
@@ -0,0 +1,100 @@
+package org.apache.marmotta.platform.core.test.base.jetty;
+
+import org.jboss.resteasy.cdi.CdiConstructorInjector;
+import org.jboss.resteasy.cdi.CdiPropertyInjector;
+import org.jboss.resteasy.cdi.ResteasyCdiExtension;
+import org.jboss.resteasy.core.ValueInjector;
+import org.jboss.resteasy.logging.Logger;
+import org.jboss.resteasy.spi.ConstructorInjector;
+import org.jboss.resteasy.spi.InjectorFactory;
+import org.jboss.resteasy.spi.MethodInjector;
+import org.jboss.resteasy.spi.PropertyInjector;
+import org.jboss.resteasy.spi.ResteasyProviderFactory;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * Custom injector component for the test environment
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+@SuppressWarnings("rawtypes")
+public class TestInjectorFactory implements InjectorFactory {
+
+ private static final Logger log = Logger.getLogger(TestInjectorFactory.class);
+
+ private InjectorFactory delegate;
+ private static BeanManager manager;
+ private ResteasyCdiExtension extension;
+
+ public TestInjectorFactory() {
+ this.delegate = ResteasyProviderFactory.getInstance().getInjectorFactory();
+ this.extension = lookupResteasyCdiExtension();
+
+ log.info("creating new RestEasy Injector Factory for LMF Test Environment");
+ }
+
+ public static void setManager(BeanManager manager) {
+ TestInjectorFactory.manager = manager;
+ }
+
+ @Override
+ public ConstructorInjector createConstructor(Constructor constructor) {
+ Class<?> clazz = constructor.getDeclaringClass();
+
+ if (!manager.getBeans(clazz).isEmpty())
+ {
+ log.debug("Using CdiConstructorInjector for class {0}.", clazz);
+ return new CdiConstructorInjector(clazz, manager);
+ }
+
+ log.debug("No CDI beans found for {0}. Using default ConstructorInjector.", clazz);
+ return delegate.createConstructor(constructor);
+
+ }
+
+ @Override
+ public PropertyInjector createPropertyInjector(Class resourceClass) {
+ return new CdiPropertyInjector(delegate.createPropertyInjector(resourceClass), resourceClass, Collections.<Class<?>, Type>emptyMap(), manager);
+ }
+
+ @Override
+ public MethodInjector createMethodInjector(Class root, Method method) {
+ return delegate.createMethodInjector(root, method);
+ }
+
+ @Override
+ public ValueInjector createParameterExtractor(Class injectTargetClass, AccessibleObject injectTarget, Class type, Type genericType, Annotation[] annotations) {
+ return delegate.createParameterExtractor(injectTargetClass, injectTarget, type, genericType, annotations);
+ }
+
+ @Override
+ public ValueInjector createParameterExtractor(Class injectTargetClass, AccessibleObject injectTarget, Class type, Type genericType, Annotation[] annotations, boolean useDefault) {
+ return delegate.createParameterExtractor(injectTargetClass, injectTarget, type, genericType, annotations, useDefault);
+ }
+
+
+ /**
+ * Lookup ResteasyCdiExtension instance that was instantiated during CDI bootstrap
+ *
+ * @return ResteasyCdiExtension instance
+ */
+ private ResteasyCdiExtension lookupResteasyCdiExtension()
+ {
+ Set<Bean<?>> beans = manager.getBeans(ResteasyCdiExtension.class);
+ Bean<?> bean = manager.resolve(beans);
+ if (bean == null) throw new IllegalStateException("Unable to obtain ResteasyCdiExtension instance.");
+ CreationalContext<?> context = manager.createCreationalContext(bean);
+ return (ResteasyCdiExtension) manager.getReference(bean, ResteasyCdiExtension.class, context);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/config/ConfigurationServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/config/ConfigurationServiceTest.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/config/ConfigurationServiceTest.java
new file mode 100644
index 0000000..2c04e1c
--- /dev/null
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/config/ConfigurationServiceTest.java
@@ -0,0 +1,142 @@
+package org.apache.marmotta.platform.core.test.config;
+
+import junit.framework.Assert;
+import org.apache.marmotta.platform.core.api.config.ConfigurationService;
+import org.apache.marmotta.platform.core.test.base.EmbeddedLMF;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+/**
+ * Test the functionality of the configuration service
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class ConfigurationServiceTest {
+
+ private static EmbeddedLMF lmf;
+ private static ConfigurationService configurationService;
+
+ @BeforeClass
+ public static void setUp() {
+ lmf = new EmbeddedLMF();
+ configurationService = lmf.getService(ConfigurationService.class);
+ }
+
+ @Test
+ public void testSetString() {
+ String key = "foo.key";
+ String value = "Foo Value";
+
+ // test without / with default value
+ Assert.assertNull(configurationService.getStringConfiguration(key));
+ Assert.assertEquals("default",configurationService.getStringConfiguration(key,"default"));
+
+
+ // set value to a new value
+ configurationService.setConfiguration(key, value);
+ Assert.assertEquals(value,configurationService.getConfiguration(key));
+
+ // remove value and check it is unset afterwards
+ configurationService.removeConfiguration(key);
+ Assert.assertNull(configurationService.getStringConfiguration(key));
+
+ }
+
+ @Test
+ public void testSetList() {
+ String key = "foo.listkey";
+ List<String> values = new ArrayList<String>();
+ values.add("foo");
+ values.add("bar");
+
+ // test without / with default value
+ Assert.assertNull(configurationService.getStringConfiguration(key));
+ Assert.assertTrue(configurationService.getListConfiguration(key).size() == 0);
+ Assert.assertEquals(values,configurationService.getListConfiguration(key, values));
+
+
+ // set value to a new value
+ configurationService.setConfiguration(key, values);
+ Assert.assertEquals(values,configurationService.getListConfiguration(key));
+
+ // remove value and check it is unset afterwards
+ configurationService.removeConfiguration(key);
+ Assert.assertTrue(configurationService.getListConfiguration(key).size() == 0);
+ }
+
+ @Test
+ public void testSetBoolean() {
+ String key = "foo.booleankey";
+ boolean value = true;
+
+
+ // test without / with default value
+ Assert.assertNull(configurationService.getStringConfiguration(key));
+ Assert.assertFalse(configurationService.getBooleanConfiguration(key));
+ Assert.assertTrue(configurationService.getBooleanConfiguration(key, true));
+
+
+ // set value to a new value
+ configurationService.setBooleanConfiguration(key, value);
+ Assert.assertTrue(configurationService.getBooleanConfiguration(key));
+
+ // remove value and check it is unset afterwards
+ configurationService.removeConfiguration(key);
+ Assert.assertFalse(configurationService.getBooleanConfiguration(key));
+
+ }
+
+
+ @Test
+ public void testSetDouble() {
+ String key = "foo.dblkey";
+ double value = new Random().nextDouble();
+
+ // test without / with default value
+ Assert.assertNull(configurationService.getStringConfiguration(key));
+ Assert.assertEquals(value,configurationService.getDoubleConfiguration(key,value),0.1);
+
+
+ // set value to a new value
+ configurationService.setDoubleConfiguration(key, value);
+ Assert.assertEquals(value,configurationService.getDoubleConfiguration(key),0.1);
+
+ // remove value and check it is unset afterwards
+ configurationService.removeConfiguration(key);
+ Assert.assertNull(configurationService.getStringConfiguration(key));
+
+ }
+
+ @Test
+ public void testSetInt() {
+ String key = "foo.intkey";
+ int value = new Random().nextInt();
+
+ // test without / with default value
+ Assert.assertNull(configurationService.getStringConfiguration(key));
+ Assert.assertEquals(value, configurationService.getIntConfiguration(key, value));
+ Assert.assertEquals((double)value,configurationService.getDoubleConfiguration(key, value));
+
+
+ // set value to a new value
+ configurationService.setIntConfiguration(key, value);
+ Assert.assertEquals(value,configurationService.getIntConfiguration(key));
+
+ // remove value and check it is unset afterwards
+ configurationService.removeConfiguration(key);
+ Assert.assertNull(configurationService.getStringConfiguration(key));
+
+ }
+
+
+ @AfterClass
+ public static void tearDown() {
+ lmf.shutdown();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/config/ConfigurationWebServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/config/ConfigurationWebServiceTest.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/config/ConfigurationWebServiceTest.java
new file mode 100644
index 0000000..accd6ee
--- /dev/null
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/config/ConfigurationWebServiceTest.java
@@ -0,0 +1,94 @@
+package org.apache.marmotta.platform.core.test.config;
+
+import com.google.common.collect.Lists;
+import com.jayway.restassured.RestAssured;
+import org.apache.marmotta.platform.core.api.config.ConfigurationService;
+import org.apache.marmotta.platform.core.test.base.JettyLMF;
+import org.apache.marmotta.platform.core.webservices.config.ConfigurationWebService;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static com.jayway.restassured.RestAssured.expect;
+import static com.jayway.restassured.RestAssured.given;
+import static org.hamcrest.Matchers.hasItem;
+import static org.hamcrest.Matchers.hasItems;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class ConfigurationWebServiceTest {
+
+ private static JettyLMF lmf;
+ private static ConfigurationService configurationService;
+
+ private static ObjectMapper mapper = new ObjectMapper();
+
+
+ @BeforeClass
+ public static void setUp() {
+ lmf = new JettyLMF("/LMF",8080, ConfigurationWebService.class);
+ configurationService = lmf.getService(ConfigurationService.class);
+
+ RestAssured.baseURI = "http://localhost";
+ RestAssured.port = 8080;
+ RestAssured.basePath = "/LMF";
+
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ lmf.shutdown();
+ }
+
+ @Test
+ public void testSetConfiguration() throws IOException {
+ // set my.key to the values "value1" and "value2"
+ given().
+ header("Content-Type","application/json").
+ content(mapper.writeValueAsString(Lists.newArrayList("value1", "value2"))).
+ expect().
+ statusCode(200).
+ when().
+ post("/config/data/mykey");
+
+
+ // test whether configuration service has the key
+ Assert.assertThat(configurationService.getListConfiguration("mykey"), hasItem("value1"));
+
+ // test whether values appear when retrieving the key
+ expect().
+ statusCode(200).
+ body("mykey",hasItems("value1","value2")).
+ when().
+ get("/config/data/mykey");
+
+ // test whether values appear in full list
+ expect().
+ statusCode(200).
+ body("mykey.value",hasItems("value1","value2")).
+ when().
+ get("/config/list");
+
+
+ // test whether deleting returns OK
+ expect().
+ statusCode(200).
+ when().
+ delete("/config/data/mykey");
+
+
+ // test whether values appear when retrieving the key
+ expect().
+ statusCode(404).
+ when().
+ get("/config/data/mykey");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/embedded/EmbeddedLMFTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/embedded/EmbeddedLMFTest.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/embedded/EmbeddedLMFTest.java
new file mode 100644
index 0000000..4813e66
--- /dev/null
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/embedded/EmbeddedLMFTest.java
@@ -0,0 +1,25 @@
+package org.apache.marmotta.platform.core.test.embedded;
+
+import org.apache.marmotta.platform.core.api.config.ConfigurationService;
+import org.apache.marmotta.platform.core.test.base.EmbeddedLMF;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class EmbeddedLMFTest {
+
+ @Test
+ public void testLMFStartup() {
+ EmbeddedLMF lmf = new EmbeddedLMF();
+
+ ConfigurationService cs = lmf.getService(ConfigurationService.class);
+
+ Assert.assertNotNull(cs);
+
+ lmf.shutdown();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/user/UserServiceTest.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/user/UserServiceTest.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/user/UserServiceTest.java
new file mode 100644
index 0000000..5094b97
--- /dev/null
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/test/user/UserServiceTest.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2012 Salzburg Research.
+ *
+ * Licensed 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.platform.core.test.user;
+
+import org.apache.marmotta.platform.core.api.user.UserService;
+import org.apache.marmotta.platform.core.exception.UserExistsException;
+import org.apache.marmotta.platform.core.test.base.EmbeddedLMF;
+import org.apache.commons.lang.RandomStringUtils;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openrdf.model.URI;
+
+/**
+ * Add file description here!
+ * <p/>
+ * Author: Sebastian Schaffert
+ */
+public class UserServiceTest {
+
+ private static EmbeddedLMF lmf;
+ private static UserService userService;
+
+ @BeforeClass
+ public static void setUp() {
+ lmf = new EmbeddedLMF();
+ userService = lmf.getService(UserService.class);
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ lmf.shutdown();
+ }
+
+ @Test
+ public void testAnonymousUser() {
+ Assert.assertNotNull(userService.getAnonymousUser());
+ Assert.assertTrue(userService.isAnonymous(userService.getAnonymousUser()));
+ Assert.assertTrue(userService.getAnonymousUser().stringValue().endsWith("anonymous"));
+ }
+
+ @Test
+ public void testAdminUser() {
+ Assert.assertNotNull(userService.getAdminUser());
+ Assert.assertFalse(userService.isAnonymous(userService.getAdminUser()));
+ Assert.assertTrue(userService.getAdminUser().stringValue().endsWith("admin"));
+ }
+
+ @Test
+ public void testUserExists() {
+ String login = RandomStringUtils.randomAlphabetic(8);
+
+ Assert.assertFalse(userService.userExists(login));
+ Assert.assertNull(userService.getUser(login));
+ }
+
+ @Test
+ public void testCreateUser() {
+ String login = RandomStringUtils.randomAlphabetic(8);
+
+ try {
+ URI user = userService.createUser(login);
+ Assert.assertNotNull(user);
+ Assert.assertFalse(userService.isAnonymous(user));
+ Assert.assertTrue(user.stringValue().endsWith(login));
+ Assert.assertTrue(userService.userExists(login));
+ Assert.assertNotNull(userService.getUser(login));
+ } catch (UserExistsException ex) {
+ Assert.fail(ex.getMessage());
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/util/http/UriUtilTests.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/util/http/UriUtilTests.java b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/util/http/UriUtilTests.java
new file mode 100644
index 0000000..1c80d15
--- /dev/null
+++ b/platform/marmotta-core/src/test/java/org/apache/marmotta/platform/core/util/http/UriUtilTests.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2013 Salzburg Research.
+ *
+ * Licensed 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.platform.core.util.http;
+
+import org.apache.marmotta.commons.http.UriUtil;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.util.UUID;
+
+import static org.junit.Assert.*;
+
+/**
+ * URI utilities tests
+ *
+ * @author Sergio Fernández
+ *
+ */
+public class UriUtilTests {
+
+ private final String base = "http://localhost:8080/LMF/resource/";
+
+ @Before
+ public void setup() {
+
+ }
+
+ private String buildUri(String part) {
+ return buildUri(base, part);
+ }
+
+ private String buildUri(String base, String part) {
+ return base + part;
+ }
+
+ @Test
+ public void validate() {
+ assertTrue(UriUtil.validate(buildRightUri()));
+ }
+
+ @Test
+ public void validateFtp() {
+ assertTrue(UriUtil.validate(buildFtpUri()));
+ }
+
+ @Test
+ public void validateUrn() {
+ assertTrue(UriUtil.validate(buildUrnUri()));
+ }
+
+ @Test
+ public void validateHashl() {
+ assertTrue(UriUtil.validate(buildUriHash()));
+ }
+
+ @Test
+ public void validateQuery() {
+ assertTrue(UriUtil.validate(buildUriQuery()));
+ }
+
+ @Test
+ public void validateEmptyQuery() {
+ assertTrue(UriUtil.validate(buildUriEmtpyQuery()));
+ }
+
+ @Test
+ public void validateQueryUnicode() {
+ assertTrue(UriUtil.validate(buildUriQueryUnicode()));
+ }
+
+ @Test
+ public void validateQueryUnicodeParam() {
+ assertTrue(UriUtil.validate(buildUriQueryUnicodeParam()));
+ }
+
+ @Test
+ public void validateWrong() {
+ assertFalse(UriUtil.validate(buildInvalid()));
+ }
+
+ @Test
+ public void evaluateValidationPerformace() {
+ assertTrue(evaluateValidationPerformace(buildRightUri()) >= 0.0);
+ assertTrue(evaluateValidationPerformace(buildFtpUri()) >= 0.0);
+ assertTrue(evaluateValidationPerformace(buildUrnUri()) >= 0.0);
+ assertTrue(evaluateValidationPerformace(buildUriHash()) >= 0.0);
+ assertTrue(evaluateValidationPerformace(buildUriQuery()) >= 0.0);
+ assertTrue(evaluateValidationPerformace(buildUriEmtpyQuery()) >= 0.0);
+ assertTrue(evaluateValidationPerformace(buildInvalid()) >= 0.0);
+
+ // both implementations are very similar about performance
+ // since the result could be unpredictable, not assert added
+ evaluateValidationPerformace(buildUriQueryUnicode()); //
+ evaluateValidationPerformace(buildUriQueryUnicodeParam());
+ }
+
+ private long evaluateValidationPerformace(String uri) {
+ long start = System.nanoTime();
+ UriUtil.validateApache(uri);
+ long apache = System.nanoTime() - start;
+ start = System.nanoTime();
+ UriUtil.validateJavaNet(uri);
+ long javanet = System.nanoTime() - start;
+ System.out.println("apache " + apache + " ns, " + "java.net " + javanet + " ns (" + uri + ")");
+ return apache - javanet;
+ }
+
+ private String buildRightUri() {
+ return buildUri(UUID.randomUUID().toString());
+ }
+
+ private String buildFtpUri() {
+ return buildUri(UUID.randomUUID().toString());
+ }
+
+ private String buildUrnUri() {
+ return buildUri("urn:issn", UUID.randomUUID().toString());
+ }
+
+ private String buildUriHash() {
+ return buildUri(UUID.randomUUID().toString() + "#");
+ }
+
+ private String buildUriQuery() {
+ return buildUri(UUID.randomUUID().toString() + "?foo=bar");
+ }
+
+ private String buildUriEmtpyQuery() {
+ return buildUri(UUID.randomUUID().toString() + "?");
+ }
+
+ private String buildUriQueryUnicode() {
+ return buildUri(UUID.randomUUID().toString() + "?foo=bár");
+ }
+
+ private String buildUriQueryUnicodeParam() {
+ return buildUri(UUID.randomUUID().toString() + "?úri=foo");
+ }
+
+ private String buildInvalid() {
+ return buildUri(UUID.randomUUID().toString()).substring(4);
+ }
+
+ @Test
+ public void validateCurie() {
+ String[] uris = { base + "foo", base + "foo#bar" };
+ for (String uri : uris) {
+ String ns = UriUtil.getNamespace(uri);
+ String ref = UriUtil.getReference(uri);
+ assertTrue(uri.startsWith(ns));
+ assertTrue(uri.endsWith(ref));
+ assertEquals(uri, ns + ref);
+ }
+ }
+
+ @Test
+ public void validateText() {
+ assertFalse(UriUtil.validate("131185"));
+ assertFalse(UriUtil.validate("foo"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/resources/ehcache-db.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/resources/ehcache-db.xml b/platform/marmotta-core/src/test/resources/ehcache-db.xml
index c1e8f44..53534fd 100644
--- a/platform/marmotta-core/src/test/resources/ehcache-db.xml
+++ b/platform/marmotta-core/src/test/resources/ehcache-db.xml
@@ -348,7 +348,7 @@ are "on" and "off". The default is "autodetect".
memoryStoreEvictionPolicy="LRU"
/>
- <cache name="kiwi.core.model.rdf.KiWiNode"
+ <cache name="org.apache.marmotta.platform.core.model.rdf.KiWiNode"
statistics="true"
maxElementsInMemory="100000"
eternal="false"
@@ -363,14 +363,14 @@ are "on" and "off". The default is "autodetect".
memoryStoreEvictionPolicy="LRU"/>
- <cache name="kiwi.core.model.rdf.KiWiNamespace"
+ <cache name="org.apache.marmotta.platform.core.model.rdf.KiWiNamespace"
statistics="true"
maxElementsInMemory="100"
eternal="false"
overflowToDisk="false"
memoryStoreEvictionPolicy="LRU"/>
- <cache name="kiwi.core.model.user.KiWiGroup"
+ <cache name="org.apache.marmotta.platform.core.model.user.KiWiGroup"
statistics="true"
maxElementsInMemory="100"
eternal="false"
@@ -385,7 +385,7 @@ are "on" and "off". The default is "autodetect".
memoryStoreEvictionPolicy="LRU"/>
- <cache name="kiwi.core.model.rdf.KiWiTriple"
+ <cache name="org.apache.marmotta.platform.core.model.rdf.KiWiTriple"
statistics="true"
maxElementsInMemory="200000"
eternal="false"
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/resources/kiwi/core/test/literal/lmf2.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/resources/kiwi/core/test/literal/lmf2.png b/platform/marmotta-core/src/test/resources/kiwi/core/test/literal/lmf2.png
deleted file mode 100644
index 96ad967..0000000
Binary files a/platform/marmotta-core/src/test/resources/kiwi/core/test/literal/lmf2.png and /dev/null differ
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/resources/kiwi/core/test/sesame/demo-data.foaf
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/resources/kiwi/core/test/sesame/demo-data.foaf b/platform/marmotta-core/src/test/resources/kiwi/core/test/sesame/demo-data.foaf
deleted file mode 100644
index e6b3ee7..0000000
--- a/platform/marmotta-core/src/test/resources/kiwi/core/test/sesame/demo-data.foaf
+++ /dev/null
@@ -1,62 +0,0 @@
-<!--
- ~ Copyright (c) 2012 Salzburg Research.
- ~
- ~ Licensed 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.
- -->
-
-<rdf:RDF
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:foaf="http://xmlns.com/foaf/0.1/"
- xmlns:dc="http://purl.org/dc/elements/1.1/">
-
- <foaf:Person rdf:about="http://localhost:8080/LMF/resource/hans_meier" xmlns:foaf="http://xmlns.com/foaf/0.1/">
- <foaf:name>Hans Meier</foaf:name>
- <dc:description>Hans Meier is a software engineer living in Salzburg</dc:description>
- <foaf:interest rdf:resource="http://rdf.freebase.com/ns/en.software_engineering"/>
- <foaf:interest rdf:resource="http://rdf.freebase.com/ns/en.linux"/>
- <foaf:interest rdf:resource="http://dbpedia.org/resource/Java" />
- <foaf:interest rdf:resource="http://dbpedia.org/resource/Climbing"/>
- <foaf:based_near rdf:resource="http://sws.geonames.org/2766824/"/>
- <foaf:depiction rdf:resource="http://localhost:8080/LMF/resource/hans_meier.jpg"/>
-
- <foaf:knows rdf:resource="http://bblfish.net/people/henry/card#me" />
- <foaf:knows rdf:resource="http://dbpedia.org/resource/James_Gosling"/>
- </foaf:Person>
-
- <foaf:Person rdf:about="http://localhost:8080/LMF/resource/sepp_huber" xmlns:foaf="http://xmlns.com/foaf/0.1/">
- <foaf:name>Sepp Huber</foaf:name>
- <dc:description>Sepp Huber is an alpinist living in Traunstein. He is a good climber, but not as famous as his cousin Alexander Huber.</dc:description>
- <foaf:interest rdf:resource="http://dbpedia.org/resource/Mountaineering"/>
- <foaf:interest rdf:resource="http://dbpedia.org/resource/Climbing"/>
- <foaf:interest rdf:resource="http://localhost:8080/LMF/resource/Chess" />
- <foaf:based_near rdf:resource="http://dbpedia.org/resource/Traunstein"/>
-
- <foaf:knows rdf:resource="http://dbpedia.org/resource/Alexander_Huber" />
- <foaf:knows rdf:resource="http://localhost:8080/LMF/resource/hans_meier" />
- </foaf:Person>
-
- <foaf:Person rdf:about="http://localhost:8080/LMF/resource/anna_schmidt" xmlns:foaf="http://xmlns.com/foaf/0.1/">
- <foaf:name>Anna Schmidt</foaf:name>
- <dc:description>Anna Schmidt is working as PR manager for mountaineers coming from Garmisch-Partenkirchen. She likes mountaineering and is also a Linux enthusiast.</dc:description>
- <foaf:interest rdf:resource="http://dbpedia.org/resource/Mountaineering"/>
- <foaf:interest rdf:resource="http://dbpedia.org/resource/Linux"/>
- <foaf:interest rdf:resource="http://localhost:8080/LMF/resource/Chess" />
- <foaf:based_near rdf:resource="http://dbpedia.org/resource/Garmisch-Partenkirchen"/>
- <foaf:depiction rdf:resource="http://localhost:8080/LMF/resource/anna_schmidt.jpg"/>
-
- <foaf:knows rdf:resource="http://dbpedia.org/resource/Alexander_Huber" />
- <foaf:knows rdf:resource="http://localhost:8080/LMF/resource/sepp_huber" />
- </foaf:Person>
-
-
-</rdf:RDF>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/resources/logback.xml
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/resources/logback.xml b/platform/marmotta-core/src/test/resources/logback.xml
index 97882bb..7dee862 100644
--- a/platform/marmotta-core/src/test/resources/logback.xml
+++ b/platform/marmotta-core/src/test/resources/logback.xml
@@ -26,7 +26,7 @@
</encoder>
</appender>
- <logger name="kiwi.core" level="INFO" />
+ <logger name="org.apache.marmotta.platform.core" level="INFO" />
<logger name="kiwi.reasoner" level="INFO" />
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/resources/org/apache/marmotta/platform/core/test/literal/lmf2.png
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/resources/org/apache/marmotta/platform/core/test/literal/lmf2.png b/platform/marmotta-core/src/test/resources/org/apache/marmotta/platform/core/test/literal/lmf2.png
new file mode 100644
index 0000000..96ad967
Binary files /dev/null and b/platform/marmotta-core/src/test/resources/org/apache/marmotta/platform/core/test/literal/lmf2.png differ
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-core/src/test/resources/org/apache/marmotta/platform/core/test/sesame/demo-data.foaf
----------------------------------------------------------------------
diff --git a/platform/marmotta-core/src/test/resources/org/apache/marmotta/platform/core/test/sesame/demo-data.foaf b/platform/marmotta-core/src/test/resources/org/apache/marmotta/platform/core/test/sesame/demo-data.foaf
new file mode 100644
index 0000000..e6b3ee7
--- /dev/null
+++ b/platform/marmotta-core/src/test/resources/org/apache/marmotta/platform/core/test/sesame/demo-data.foaf
@@ -0,0 +1,62 @@
+<!--
+ ~ Copyright (c) 2012 Salzburg Research.
+ ~
+ ~ Licensed 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.
+ -->
+
+<rdf:RDF
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ xmlns:dc="http://purl.org/dc/elements/1.1/">
+
+ <foaf:Person rdf:about="http://localhost:8080/LMF/resource/hans_meier" xmlns:foaf="http://xmlns.com/foaf/0.1/">
+ <foaf:name>Hans Meier</foaf:name>
+ <dc:description>Hans Meier is a software engineer living in Salzburg</dc:description>
+ <foaf:interest rdf:resource="http://rdf.freebase.com/ns/en.software_engineering"/>
+ <foaf:interest rdf:resource="http://rdf.freebase.com/ns/en.linux"/>
+ <foaf:interest rdf:resource="http://dbpedia.org/resource/Java" />
+ <foaf:interest rdf:resource="http://dbpedia.org/resource/Climbing"/>
+ <foaf:based_near rdf:resource="http://sws.geonames.org/2766824/"/>
+ <foaf:depiction rdf:resource="http://localhost:8080/LMF/resource/hans_meier.jpg"/>
+
+ <foaf:knows rdf:resource="http://bblfish.net/people/henry/card#me" />
+ <foaf:knows rdf:resource="http://dbpedia.org/resource/James_Gosling"/>
+ </foaf:Person>
+
+ <foaf:Person rdf:about="http://localhost:8080/LMF/resource/sepp_huber" xmlns:foaf="http://xmlns.com/foaf/0.1/">
+ <foaf:name>Sepp Huber</foaf:name>
+ <dc:description>Sepp Huber is an alpinist living in Traunstein. He is a good climber, but not as famous as his cousin Alexander Huber.</dc:description>
+ <foaf:interest rdf:resource="http://dbpedia.org/resource/Mountaineering"/>
+ <foaf:interest rdf:resource="http://dbpedia.org/resource/Climbing"/>
+ <foaf:interest rdf:resource="http://localhost:8080/LMF/resource/Chess" />
+ <foaf:based_near rdf:resource="http://dbpedia.org/resource/Traunstein"/>
+
+ <foaf:knows rdf:resource="http://dbpedia.org/resource/Alexander_Huber" />
+ <foaf:knows rdf:resource="http://localhost:8080/LMF/resource/hans_meier" />
+ </foaf:Person>
+
+ <foaf:Person rdf:about="http://localhost:8080/LMF/resource/anna_schmidt" xmlns:foaf="http://xmlns.com/foaf/0.1/">
+ <foaf:name>Anna Schmidt</foaf:name>
+ <dc:description>Anna Schmidt is working as PR manager for mountaineers coming from Garmisch-Partenkirchen. She likes mountaineering and is also a Linux enthusiast.</dc:description>
+ <foaf:interest rdf:resource="http://dbpedia.org/resource/Mountaineering"/>
+ <foaf:interest rdf:resource="http://dbpedia.org/resource/Linux"/>
+ <foaf:interest rdf:resource="http://localhost:8080/LMF/resource/Chess" />
+ <foaf:based_near rdf:resource="http://dbpedia.org/resource/Garmisch-Partenkirchen"/>
+ <foaf:depiction rdf:resource="http://localhost:8080/LMF/resource/anna_schmidt.jpg"/>
+
+ <foaf:knows rdf:resource="http://dbpedia.org/resource/Alexander_Huber" />
+ <foaf:knows rdf:resource="http://localhost:8080/LMF/resource/sepp_huber" />
+ </foaf:Person>
+
+
+</rdf:RDF>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java b/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java
index fb586ad..36b2c31 100644
--- a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java
+++ b/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/endpoint/LinkedDataEndpointServiceImpl.java
@@ -17,7 +17,7 @@ package at.newmedialab.lmf.ldcache.services.endpoint;
import at.newmedialab.lmf.ldcache.api.endpoint.LinkedDataEndpointService;
import com.google.common.base.Joiner;
-import kiwi.core.api.config.ConfigurationService;
+import org.apache.marmotta.platform.core.api.config.ConfigurationService;
import org.apache.marmotta.commons.http.ContentType;
import org.apache.marmotta.commons.http.LMFHttpUtils;
import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/ldcache/LDCacheSailProvider.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/ldcache/LDCacheSailProvider.java b/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/ldcache/LDCacheSailProvider.java
index ab06f1e..587eefc 100644
--- a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/ldcache/LDCacheSailProvider.java
+++ b/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/services/ldcache/LDCacheSailProvider.java
@@ -16,12 +16,12 @@
package at.newmedialab.lmf.ldcache.services.ldcache;
import at.newmedialab.lmf.ldcache.api.endpoint.LinkedDataEndpointService;
-import kiwi.core.api.config.ConfigurationService;
-import kiwi.core.api.http.HttpClientService;
-import kiwi.core.api.triplestore.NotifyingSailProvider;
-import kiwi.core.api.triplestore.SesameService;
-import kiwi.core.events.ConfigurationChangedEvent;
-import kiwi.core.model.filter.LMFLocalFilter;
+import org.apache.marmotta.platform.core.api.config.ConfigurationService;
+import org.apache.marmotta.platform.core.api.http.HttpClientService;
+import org.apache.marmotta.platform.core.api.triplestore.NotifyingSailProvider;
+import org.apache.marmotta.platform.core.api.triplestore.SesameService;
+import org.apache.marmotta.platform.core.events.ConfigurationChangedEvent;
+import org.apache.marmotta.platform.core.model.filter.LMFLocalFilter;
import org.apache.marmotta.commons.sesame.filter.NotFilter;
import org.apache.marmotta.ldcache.sail.KiWiLinkedDataSail;
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/webservices/LinkedDataCachingWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/webservices/LinkedDataCachingWebService.java b/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/webservices/LinkedDataCachingWebService.java
index e0ef7e1..fc86471 100644
--- a/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/webservices/LinkedDataCachingWebService.java
+++ b/platform/marmotta-ldcache/src/main/java/at/newmedialab/lmf/ldcache/webservices/LinkedDataCachingWebService.java
@@ -18,7 +18,7 @@ package at.newmedialab.lmf.ldcache.webservices;
import at.newmedialab.lmf.ldcache.api.endpoint.LinkedDataEndpointService;
import at.newmedialab.lmf.ldcache.services.ldcache.LDCacheSailProvider;
import org.apache.marmotta.commons.sesame.model.Namespaces;
-import kiwi.core.api.triplestore.SesameService;
+import org.apache.marmotta.platform.core.api.triplestore.SesameService;
import org.apache.marmotta.ldclient.api.endpoint.Endpoint;
import org.apache.marmotta.ldclient.api.provider.DataProvider;
import org.apache.marmotta.ldclient.model.ClientResponse;
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/backend/LMFBackend.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/backend/LMFBackend.java b/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/backend/LMFBackend.java
index 6a71b72..53f49a1 100644
--- a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/backend/LMFBackend.java
+++ b/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/backend/LMFBackend.java
@@ -15,7 +15,7 @@
*/
package at.newmedialab.lmf.ldpath.backend;
-import kiwi.core.api.triplestore.SesameService;
+import org.apache.marmotta.platform.core.api.triplestore.SesameService;
import org.apache.marmotta.ldpath.backend.sesame.SesameRepositoryBackend;
import org.slf4j.Logger;
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/ContentFunction.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/ContentFunction.java b/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/ContentFunction.java
index 9844de3..99a4227 100644
--- a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/ContentFunction.java
+++ b/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/model/functions/ContentFunction.java
@@ -16,7 +16,7 @@
package at.newmedialab.lmf.ldpath.model.functions;
import at.newmedialab.lmf.ldpath.api.LMFLDPathFunction;
-import kiwi.core.api.content.ContentService;
+import org.apache.marmotta.platform.core.api.content.ContentService;
import org.apache.marmotta.kiwi.model.rdf.KiWiResource;
import org.apache.marmotta.kiwi.model.rdf.KiWiStringLiteral;
import org.apache.marmotta.ldpath.api.backend.RDFBackend;
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/4d3eebdd/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/services/LDPathServiceImpl.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/services/LDPathServiceImpl.java b/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/services/LDPathServiceImpl.java
index 3d7273f..2185f8b 100644
--- a/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/services/LDPathServiceImpl.java
+++ b/platform/marmotta-ldpath/src/main/java/at/newmedialab/lmf/ldpath/services/LDPathServiceImpl.java
@@ -17,7 +17,7 @@ package at.newmedialab.lmf.ldpath.services;
import at.newmedialab.lmf.ldpath.api.LDPathService;
import at.newmedialab.lmf.ldpath.api.LMFLDPathFunction;
-import kiwi.core.api.triplestore.SesameService;
+import org.apache.marmotta.platform.core.api.triplestore.SesameService;
import org.apache.marmotta.ldpath.LDPath;
import org.apache.marmotta.ldpath.api.functions.SelectorFunction;