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/09/30 18:44:44 UTC

[07/50] [abbrv] git commit: MARMOTTA-155: added unit test to reproduce the issue

MARMOTTA-155: added unit test to reproduce the issue


Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/be890b69
Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/be890b69
Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/be890b69

Branch: refs/heads/master
Commit: be890b698d8fa063b1c0ca7b06581a8e5564b233
Parents: 69cc8f3
Author: Sergio Fernández <wi...@apache.org>
Authored: Tue Sep 10 14:42:32 2013 +0200
Committer: Sergio Fernández <wi...@apache.org>
Committed: Tue Sep 10 14:42:32 2013 +0200

----------------------------------------------------------------------
 .../kiwi/test/sesame/KiWiLocaleTest.java        | 101 +++++++++++++++++++
 1 file changed, 101 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/be890b69/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiLocaleTest.java
----------------------------------------------------------------------
diff --git a/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiLocaleTest.java b/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiLocaleTest.java
new file mode 100644
index 0000000..5c97e59
--- /dev/null
+++ b/libraries/kiwi/kiwi-triplestore/src/test/java/org/apache/marmotta/kiwi/test/sesame/KiWiLocaleTest.java
@@ -0,0 +1,101 @@
+/*
+ * 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.kiwi.test.sesame;
+
+import org.apache.marmotta.kiwi.config.KiWiConfiguration;
+import org.apache.marmotta.kiwi.sail.KiWiStore;
+import org.apache.marmotta.kiwi.sail.KiWiValueFactory;
+import org.apache.marmotta.kiwi.test.junit.KiWiDatabaseRunner;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openrdf.model.Literal;
+import org.openrdf.sail.SailConnection;
+import org.openrdf.sail.SailException;
+
+/**
+ * Tests for testing locales against the KiWi Triple store 
+ * (and its implementation of the ValueFactory)
+ * 
+ * @author Sergio Fernández <wi...@apache.org>
+ */
+@RunWith(KiWiDatabaseRunner.class)
+public class KiWiLocaleTest  {
+
+    private final KiWiConfiguration kiwiConfig;
+    private KiWiStore store;
+    private KiWiValueFactory vf;
+    
+    public KiWiLocaleTest(KiWiConfiguration kiwiConfig) {
+        this.kiwiConfig = kiwiConfig;
+    }
+    
+    @Before
+    public void initialize() throws SailException {
+    	store = new KiWiStore(kiwiConfig);
+    	store.initialize();
+    	vf = new KiWiValueFactory(store, "http://example.org");
+    }
+    
+    @After
+    public void shutdown() throws SailException {
+    	store.shutDown();
+    	store = null;
+    	vf = null;
+    }
+    
+    /** 
+     * Tests creating BCP47 literals (see MARMOTTA-115 for further details)
+     */
+    @Test
+    public void createBCP47LiteralsTests() {
+    	Literal enLiteral = vf.createLiteral("Hungary", "en");
+    	Assert.assertEquals("Hungary", enLiteral.getLabel());
+    	Assert.assertEquals("en", enLiteral.getLanguage());
+    	Literal warLiteral = vf.createLiteral("Hungary", "war");
+    	Assert.assertEquals("Hungary", warLiteral.getLabel());
+    	Assert.assertEquals("war", warLiteral.getLanguage());
+    }
+
+//    /** 
+//     * Tests adding BCP47 literals (see MARMOTTA-115 for further details)
+//     */
+//    @Test
+//    public void addBCP47LiteralsTests() throws SailException {
+//    	SailConnection conn = store.getConnection();
+//        try {
+//        	conn.begin();
+//            conn.commit();
+//        } finally {
+//            conn.close();
+//        }
+//    	
+//    }
+//    
+//    /** 
+//     * Tests importing BCP47 literals (see MARMOTTA-115 for further details)
+//     */
+//    @Test
+//    public void importBCP47LiteralsTests() throws SailException {
+//    	SailConnection connection = store.getConnection();
+//    	
+//    }
+
+}