You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rya.apache.org by mi...@apache.org on 2016/10/15 20:07:00 UTC
[40/69] [abbrv] [partial] incubator-rya git commit: RYA-198 Renaming
Files
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/persist/query/RyaQueryTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/persist/query/RyaQueryTest.java b/common/rya.api/src/test/java/mvm/rya/api/persist/query/RyaQueryTest.java
deleted file mode 100644
index 40a9c68..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/persist/query/RyaQueryTest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package mvm.rya.api.persist.query;
-
-/*
- * 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.
- */
-
-
-
-import mvm.rya.api.domain.RyaStatement;
-import mvm.rya.api.domain.RyaURI;
-import org.junit.Test;
-
-import java.util.Arrays;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-/**
- */
-public class RyaQueryTest {
-
- @Test
- public void testBuildQueryWithOptions() {
- RyaURI subj = new RyaURI("urn:test#1234");
- RyaURI pred = new RyaURI("urn:test#pred");
- RyaURI obj = new RyaURI("urn:test#obj");
- RyaStatement ryaStatement = new RyaStatement(subj, pred, obj);
- String[] auths = {"U,FOUO"};
- long currentTime = System.currentTimeMillis();
- RyaQuery ryaQuery = RyaQuery.builder(ryaStatement).setAuths(auths).setNumQueryThreads(4).setRegexObject("regexObj")
- .setRegexPredicate("regexPred").setRegexSubject("regexSubj").setTtl(100l).setBatchSize(10).
- setCurrentTime(currentTime).setMaxResults(1000l)
- .build();
-
- assertNotNull(ryaQuery);
- assertEquals(ryaStatement, ryaQuery.getQuery());
- assertEquals(4, (int) ryaQuery.getNumQueryThreads());
- assertEquals("regexObj", ryaQuery.getRegexObject());
- assertEquals("regexPred", ryaQuery.getRegexPredicate());
- assertEquals("regexSubj", ryaQuery.getRegexSubject());
- assertEquals(100l, (long) ryaQuery.getTtl());
- assertEquals(10, (int) ryaQuery.getBatchSize());
- assertEquals(currentTime, (long) ryaQuery.getCurrentTime());
- assertEquals(1000l, (long) ryaQuery.getMaxResults());
- assertTrue(Arrays.equals(auths, ryaQuery.getAuths()));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/query/strategy/AbstractTriplePatternStrategyTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/AbstractTriplePatternStrategyTest.java b/common/rya.api/src/test/java/mvm/rya/api/query/strategy/AbstractTriplePatternStrategyTest.java
deleted file mode 100644
index 919e4cc..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/AbstractTriplePatternStrategyTest.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package mvm.rya.api.query.strategy;
-
-/*
- * 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.
- */
-
-
-
-import static mvm.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT.OSP;
-import static mvm.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO;
-import static mvm.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO;
-
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import junit.framework.TestCase;
-import mvm.rya.api.RdfCloudTripleStoreConfiguration;
-import mvm.rya.api.RdfCloudTripleStoreConstants;
-import mvm.rya.api.domain.RyaStatement;
-import mvm.rya.api.domain.RyaType;
-import mvm.rya.api.domain.RyaURI;
-import mvm.rya.api.query.strategy.wholerow.OspWholeRowTriplePatternStrategy;
-import mvm.rya.api.query.strategy.wholerow.PoWholeRowTriplePatternStrategy;
-import mvm.rya.api.query.strategy.wholerow.SpoWholeRowTriplePatternStrategy;
-import mvm.rya.api.resolver.RyaContext;
-import mvm.rya.api.resolver.RyaTripleContext;
-import mvm.rya.api.resolver.triple.TripleRow;
-import mvm.rya.api.resolver.triple.TripleRowRegex;
-import mvm.rya.api.resolver.triple.impl.WholeRowTripleResolver;
-
-import org.openrdf.model.vocabulary.XMLSchema;
-
-/**
- * Date: 7/25/12
- * Time: 11:41 AM
- */
-public class AbstractTriplePatternStrategyTest extends TestCase {
- public class MockRdfConfiguration extends RdfCloudTripleStoreConfiguration {
-
- @Override
- public RdfCloudTripleStoreConfiguration clone() {
- return new MockRdfConfiguration();
- }
-
- }
-
- public void testRegex() throws Exception {
- RyaURI subj = new RyaURI("urn:test#1234");
- RyaURI pred = new RyaURI("urn:test#pred");
- RyaURI obj = new RyaURI("urn:test#obj");
- RyaStatement ryaStatement = new RyaStatement(subj, pred, obj);
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = new WholeRowTripleResolver().serialize(ryaStatement);
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-
- String row = new String(tripleRow.getRow());
- TriplePatternStrategy spoStrategy = new SpoWholeRowTriplePatternStrategy();
- TriplePatternStrategy poStrategy = new PoWholeRowTriplePatternStrategy();
- TriplePatternStrategy ospStrategy = new OspWholeRowTriplePatternStrategy();
- //pred
- TripleRowRegex tripleRowRegex = spoStrategy.buildRegex(null, pred.getData(), null, null, null);
- Pattern p = Pattern.compile(tripleRowRegex.getRow());
- Matcher matcher = p.matcher(row);
- assertTrue(matcher.matches());
- //subj
- tripleRowRegex = spoStrategy.buildRegex(subj.getData(), null, null, null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertTrue(matcher.matches());
- //obj
- tripleRowRegex = spoStrategy.buildRegex(null, null, obj.getData(), null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertTrue(matcher.matches());
-
- //po table
- row = new String(serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO).getRow());
- tripleRowRegex = poStrategy.buildRegex(null, pred.getData(), null, null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertTrue(matcher.matches());
-
- tripleRowRegex = poStrategy.buildRegex(null, pred.getData(), obj.getData(), null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertTrue(matcher.matches());
-
- tripleRowRegex = poStrategy.buildRegex(subj.getData(), pred.getData(), obj.getData(), null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertTrue(matcher.matches());
-
- //various regex
- tripleRowRegex = poStrategy.buildRegex(null, "urn:test#pr[e|d]{2}", null, null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertTrue(matcher.matches());
-
- //does not match
- tripleRowRegex = poStrategy.buildRegex(null, "hello", null, null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertFalse(matcher.matches());
- }
-
- public void testObjectTypeInfo() throws Exception {
- RyaURI subj = new RyaURI("urn:test#1234");
- RyaURI pred = new RyaURI("urn:test#pred");
- RyaType obj = new RyaType(XMLSchema.LONG, "10");
- RyaStatement ryaStatement = new RyaStatement(subj, pred, obj);
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = RyaTripleContext.getInstance(new MockRdfConfiguration()).serializeTriple(ryaStatement);
- TripleRow tripleRow = serialize.get(SPO);
-
- String row = new String(tripleRow.getRow());
- TriplePatternStrategy spoStrategy = new SpoWholeRowTriplePatternStrategy();
- //obj
- byte[][] bytes = RyaContext.getInstance().serializeType(obj);
- String objStr = new String(bytes[0]);
- byte[] objectTypeInfo = bytes[1];
- TripleRowRegex tripleRowRegex = spoStrategy.buildRegex(null, null,
- objStr
- , null, objectTypeInfo);
- Pattern p = Pattern.compile(tripleRowRegex.getRow());
- Matcher matcher = p.matcher(row);
- assertTrue(matcher.matches());
-
- //build row with same object str data
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> dupTriple_str = RyaTripleContext.getInstance(new MockRdfConfiguration()).serializeTriple(
- new RyaStatement(subj, pred, new RyaType(XMLSchema.STRING, objStr))
- );
- TripleRow tripleRow_dup_str = dupTriple_str.get(SPO);
-
- row = new String(tripleRow_dup_str.getRow());
- spoStrategy = new SpoWholeRowTriplePatternStrategy();
-
- tripleRowRegex = spoStrategy.buildRegex(null, null,
- objStr
- , null, objectTypeInfo);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertFalse(matcher.matches());
-
- //po table
- TriplePatternStrategy poStrategy = new PoWholeRowTriplePatternStrategy();
- tripleRowRegex = poStrategy.buildRegex(null, null,
- objStr
- , null, objectTypeInfo);
- p = Pattern.compile(tripleRowRegex.getRow());
- String po_row = new String(serialize.get(PO).getRow());
- matcher = p.matcher(po_row);
- assertTrue(matcher.matches());
-
- tripleRowRegex = poStrategy.buildRegex(null, null,
- objStr
- , null, objectTypeInfo);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(new String(dupTriple_str.get(PO).getRow()));
- assertFalse(matcher.matches());
-
- //osp table
- TriplePatternStrategy ospStrategy = new OspWholeRowTriplePatternStrategy();
- tripleRowRegex = ospStrategy.buildRegex(null, null,
- objStr
- , null, objectTypeInfo);
- p = Pattern.compile(tripleRowRegex.getRow());
- String osp_row = new String(serialize.get(OSP).getRow());
- matcher = p.matcher(osp_row);
- assertTrue(matcher.matches());
-
- tripleRowRegex = ospStrategy.buildRegex(null, null,
- objStr
- , null, objectTypeInfo);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(new String(dupTriple_str.get(OSP).getRow()));
- assertFalse(matcher.matches());
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategyTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategyTest.java b/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategyTest.java
deleted file mode 100644
index 25fae9b..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedPoWholeRowTriplePatternStrategyTest.java
+++ /dev/null
@@ -1,244 +0,0 @@
-package mvm.rya.api.query.strategy.wholerow;
-
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.openrdf.model.impl.URIImpl;
-
-/*
- * 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.
- */
-
-
-
-import junit.framework.TestCase;
-import mvm.rya.api.RdfCloudTripleStoreConstants;
-import mvm.rya.api.domain.RyaStatement;
-import mvm.rya.api.domain.RyaType;
-import mvm.rya.api.domain.RyaTypeRange;
-import mvm.rya.api.domain.RyaURI;
-import mvm.rya.api.domain.RyaURIRange;
-import mvm.rya.api.query.strategy.ByteRange;
-import mvm.rya.api.query.strategy.TriplePatternStrategy;
-import mvm.rya.api.resolver.RyaContext;
-import mvm.rya.api.resolver.RyaTripleContext;
-import mvm.rya.api.resolver.triple.TripleRow;
-import mvm.rya.api.resolver.triple.TripleRowRegex;
-import mvm.rya.api.resolver.triple.impl.WholeRowHashedTripleResolver;
-
-/**
- * Date: 7/14/12
- * Time: 11:46 AM
- */
-public class HashedPoWholeRowTriplePatternStrategyTest extends TestCase {
-
- RyaURI uri = new RyaURI("urn:test#1234");
- RyaURI uri2 = new RyaURI("urn:test#1235");
- RyaURIRange rangeURI = new RyaURIRange(uri, uri2);
- RyaURIRange rangeURI2 = new RyaURIRange(new RyaURI("urn:test#1235"), new RyaURI("urn:test#1236"));
- HashedPoWholeRowTriplePatternStrategy strategy = new HashedPoWholeRowTriplePatternStrategy();
- RyaContext ryaContext = RyaContext.getInstance();
- RyaTripleContext ryaTripleContext;
-
- RyaType customType1 = new RyaType(new URIImpl("urn:custom#type"), "1234");
- RyaType customType2 = new RyaType(new URIImpl("urn:custom#type"), "1235");
- RyaType customType3 = new RyaType(new URIImpl("urn:custom#type"), "1236");
- RyaTypeRange customTypeRange1 = new RyaTypeRange(customType1, customType2);
- RyaTypeRange customTypeRange2 = new RyaTypeRange(customType2, customType3);
-
- @Before
- public void setUp() {
- MockRdfCloudConfiguration config = new MockRdfCloudConfiguration();
- config.set(MockRdfCloudConfiguration.CONF_PREFIX_ROW_WITH_HASH, Boolean.TRUE.toString());
- ryaTripleContext = RyaTripleContext.getInstance(config);
- }
-
-
- public void testRegex() throws Exception {
- RyaURI subj = new RyaURI("urn:test#1234");
- RyaURI pred = new RyaURI("urn:test#pred");
- RyaURI obj = new RyaURI("urn:test#obj");
- RyaStatement ryaStatement = new RyaStatement(subj, pred, obj);
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = new WholeRowHashedTripleResolver().serialize(ryaStatement);
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-
- String row = new String(tripleRow.getRow());
- TriplePatternStrategy spoStrategy = new HashedSpoWholeRowTriplePatternStrategy();
- TriplePatternStrategy poStrategy = new HashedPoWholeRowTriplePatternStrategy();
- TriplePatternStrategy ospStrategy = new OspWholeRowTriplePatternStrategy();
- //pred
- TripleRowRegex tripleRowRegex = spoStrategy.buildRegex(null, pred.getData(), null, null, null);
- Pattern p = Pattern.compile(tripleRowRegex.getRow());
- Matcher matcher = p.matcher(row);
- assertTrue(matcher.matches());
- //subj
- tripleRowRegex = spoStrategy.buildRegex(subj.getData(), null, null, null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertTrue(matcher.matches());
- //obj
- tripleRowRegex = spoStrategy.buildRegex(null, null, obj.getData(), null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertTrue(matcher.matches());
-
- //po table
- row = new String(serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO).getRow());
- tripleRowRegex = poStrategy.buildRegex(null, pred.getData(), null, null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertTrue(matcher.matches());
-
- tripleRowRegex = poStrategy.buildRegex(null, pred.getData(), obj.getData(), null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertTrue(matcher.matches());
-
- tripleRowRegex = poStrategy.buildRegex(subj.getData(), pred.getData(), obj.getData(), null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertTrue(matcher.matches());
-
- //various regex
- tripleRowRegex = poStrategy.buildRegex(null, "urn:test#pr[e|d]{2}", null, null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertTrue(matcher.matches());
-
- //does not match
- tripleRowRegex = poStrategy.buildRegex(null, "hello", null, null, null);
- p = Pattern.compile(tripleRowRegex.getRow());
- matcher = p.matcher(row);
- assertFalse(matcher.matches());
- }
-
-
- public void testPoRange() throws Exception {
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, uri, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(null, uri, rangeURI, null, null);
- assertContains(entry.getValue(), tripleRow.getRow());
-
- entry = strategy.defineRange(null, uri, rangeURI2, null, null);
- assertContainsFalse(entry.getValue(), tripleRow.getRow());
- }
-
- private void assertContains(ByteRange value, byte[] row) {
- Text rowText = new Text(row);
- Text startText = new Text(value.getStart());
- Text endText = new Text(value.getEnd());
- assertTrue((startText.compareTo(rowText) <= 0) &&(endText.compareTo(rowText) >= 0)) ;
- }
-
- private void assertContainsFalse(ByteRange value, byte[] row) {
- Text rowText = new Text(row);
- Text startText = new Text(value.getStart());
- Text endText = new Text(value.getEnd());
- assertFalse((startText.compareTo(rowText) <= 0) &&(endText.compareTo(rowText) >= 0)) ;
- }
-
- public void testPoRangeCustomType() throws Exception {
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, customType1, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(null, uri, customTypeRange1, null, null);
- assertContains(entry.getValue(), tripleRow.getRow());
-
- entry = strategy.defineRange(null, uri, customTypeRange2, null, null);
- assertContainsFalse(entry.getValue(), tripleRow.getRow());
- }
-
- public void testPo() throws Exception {
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, uri, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(null, uri, uri, null, null);
- assertContains(entry.getValue(), tripleRow.getRow());
-
- entry = strategy.defineRange(null, uri, uri2, null, null);
- assertContainsFalse(entry.getValue(), tripleRow.getRow());
- }
-
- public void testPoCustomType() throws Exception {
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, customType1, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(null, uri, customType1, null, null);
- assertContains(entry.getValue(), tripleRow.getRow());
-
- entry = strategy.defineRange(null, uri, customType2, null, null);
- assertContainsFalse(entry.getValue(), tripleRow.getRow());
- }
-
- public void testPosRange() throws Exception {
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, uri, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(rangeURI, uri, uri, null, null);
- assertContains(entry.getValue(), tripleRow.getRow());
-
- entry = strategy.defineRange(rangeURI2, uri, uri, null, null);
- assertContainsFalse(entry.getValue(), tripleRow.getRow());
- }
-
- public void testPRange() throws Exception {
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(null, rangeURI, null, null, null);
- assertNull(entry);
- }
-
- public void testP() throws Exception {
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(null, uri, null, null, null);
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, uri, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
- assertContains(entry.getValue(), tripleRow.getRow());
- }
-
- public void testHandles() throws Exception {
- //po(ng)
- assertTrue(strategy.handles(null, uri, uri, null));
- assertTrue(strategy.handles(null, uri, uri, uri));
- //po_r(s)(ng)
- assertTrue(strategy.handles(rangeURI, uri, uri, null));
- assertTrue(strategy.handles(rangeURI, uri, uri, uri));
- //p(ng)
- assertTrue(strategy.handles(null, uri, null, null));
- assertTrue(strategy.handles(null, uri, null, uri));
- //p_r(o)(ng)
- assertTrue(strategy.handles(null, uri, rangeURI, null));
- assertTrue(strategy.handles(null, uri, rangeURI, uri));
- //r(p)(ng)
- assertFalse(strategy.handles(null, rangeURI, null, null));
- assertFalse(strategy.handles(null, rangeURI, null, uri));
-
- //false cases
- //sp..
- assertFalse(strategy.handles(uri, uri, null, null));
- //r(s)_p
- assertFalse(strategy.handles(rangeURI, uri, null, null));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedSpoWholeRowTriplePatternStrategyTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedSpoWholeRowTriplePatternStrategyTest.java b/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedSpoWholeRowTriplePatternStrategyTest.java
deleted file mode 100644
index f751866..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/HashedSpoWholeRowTriplePatternStrategyTest.java
+++ /dev/null
@@ -1,199 +0,0 @@
-package mvm.rya.api.query.strategy.wholerow;
-
-/*
- * 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.
- */
-
-
-//
-import java.util.Map;
-
-import junit.framework.TestCase;
-import mvm.rya.api.RdfCloudTripleStoreConstants;
-import mvm.rya.api.domain.RyaStatement;
-import mvm.rya.api.domain.RyaType;
-import mvm.rya.api.domain.RyaTypeRange;
-import mvm.rya.api.domain.RyaURI;
-import mvm.rya.api.domain.RyaURIRange;
-import mvm.rya.api.query.strategy.ByteRange;
-import mvm.rya.api.resolver.RyaContext;
-import mvm.rya.api.resolver.RyaTripleContext;
-import mvm.rya.api.resolver.triple.TripleRow;
-
-import org.apache.hadoop.io.Text;
-import org.junit.Before;
-import org.openrdf.model.impl.URIImpl;
-
-/**
- * Date: 7/14/12
- * Time: 7:47 AM
- */
-public class HashedSpoWholeRowTriplePatternStrategyTest extends TestCase {
-
- RyaURI uri = new RyaURI("urn:test#1234");
- RyaURI uri2 = new RyaURI("urn:test#1235");
- RyaURIRange rangeURI = new RyaURIRange(uri, uri2);
- RyaURIRange rangeURI2 = new RyaURIRange(new RyaURI("urn:test#1235"), new RyaURI("urn:test#1236"));
- HashedSpoWholeRowTriplePatternStrategy strategy = new HashedSpoWholeRowTriplePatternStrategy();
- RyaContext ryaContext = RyaContext.getInstance();
- RyaTripleContext ryaTripleContext;
-
- RyaType customType1 = new RyaType(new URIImpl("urn:custom#type"), "1234");
- RyaType customType2 = new RyaType(new URIImpl("urn:custom#type"), "1235");
- RyaType customType3 = new RyaType(new URIImpl("urn:custom#type"), "1236");
- RyaTypeRange customTypeRange1 = new RyaTypeRange(customType1, customType2);
- RyaTypeRange customTypeRange2 = new RyaTypeRange(customType2, customType3);
-
- @Before
- public void setUp() {
- MockRdfCloudConfiguration config = new MockRdfCloudConfiguration();
- config.set(MockRdfCloudConfiguration.CONF_PREFIX_ROW_WITH_HASH, Boolean.TRUE.toString());
- ryaTripleContext = RyaTripleContext.getInstance(config);
- }
-
- public void testSpo() throws Exception {
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, uri, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(uri, uri, uri, null, null);
- assertContains(entry.getValue(), tripleRow.getRow());
-
-
- entry = strategy.defineRange(uri, uri, uri2, null, null);
- assertContainsFalse(entry.getValue(), tripleRow.getRow());
- }
-
- private void assertContains(ByteRange value, byte[] row) {
- Text rowText = new Text(row);
- Text startText = new Text(value.getStart());
- Text endText = new Text(value.getEnd());
- assertTrue((startText.compareTo(rowText) <= 0) &&(endText.compareTo(rowText) >= 0)) ;
- }
-
- private void assertContainsFalse(ByteRange value, byte[] row) {
- Text rowText = new Text(row);
- Text startText = new Text(value.getStart());
- Text endText = new Text(value.getEnd());
- assertFalse((startText.compareTo(rowText) <= 0) &&(endText.compareTo(rowText) >= 0)) ;
- }
-
- public void testSpoCustomType() throws Exception {
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, customType1, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(uri, uri, customType1, null, null);
- assertContains(entry.getValue(), tripleRow.getRow());
-
- entry = strategy.defineRange(uri, uri, customType2, null, null);
- assertContainsFalse(entry.getValue(), tripleRow.getRow());
- }
-
- public void testSpoRange() throws Exception {
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, uri, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(uri, uri, rangeURI, null, null);
- assertContains(entry.getValue(), tripleRow.getRow());
-
- entry = strategy.defineRange(uri, uri, rangeURI2, null, null);
- assertContainsFalse(entry.getValue(), tripleRow.getRow());
- }
-
- public void testSpoRangeCustomType() throws Exception {
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, customType1, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(uri, uri, customTypeRange1, null, null);
- assertContains(entry.getValue(), tripleRow.getRow());
-
- entry = strategy.defineRange(uri, uri, customTypeRange2, null, null);
- assertContainsFalse(entry.getValue(), tripleRow.getRow());
- }
-
- public void testSp() throws Exception {
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, uri, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(uri, uri, null, null, null);
- assertContains(entry.getValue(), tripleRow.getRow());
- entry = strategy.defineRange(uri, uri2, null, null, null);
- assertContainsFalse(entry.getValue(), tripleRow.getRow());
- }
-
- public void testSpRange() throws Exception {
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, uri, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(uri, rangeURI, null, null, null);
- assertContains(entry.getValue(), tripleRow.getRow());
- entry = strategy.defineRange(uri, rangeURI2, null, null, null);
- assertContainsFalse(entry.getValue(), tripleRow.getRow());
- }
-
- public void testS() throws Exception {
- Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaTripleContext.serializeTriple(
- new RyaStatement(uri, uri, uri, null));
- TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(uri, null, null, null, null);
- assertContains(entry.getValue(), tripleRow.getRow());
-
- entry = strategy.defineRange(uri2, null, null, null, null);
- assertContainsFalse(entry.getValue(), tripleRow.getRow());
- }
-
- public void testSRange() throws Exception {
-
- Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, ByteRange> entry = strategy.defineRange(rangeURI, null, null, null, null);
- assertNull(entry);
- }
-
- public void testHandles() throws Exception {
- //spo(ng)
- assertTrue(strategy.handles(uri, uri, uri, null));
- assertTrue(strategy.handles(uri, uri, uri, uri));
- //sp(ng)
- assertTrue(strategy.handles(uri, uri, null, null));
- assertTrue(strategy.handles(uri, uri, null, uri));
- //s(ng)
- assertTrue(strategy.handles(uri, null, null, null));
- assertTrue(strategy.handles(uri, null, null, uri));
- //sp_r(o)(ng)
- assertTrue(strategy.handles(uri, uri, rangeURI, null));
- assertTrue(strategy.handles(uri, uri, rangeURI, uri));
- //s_r(p)(ng)
- assertTrue(strategy.handles(uri, rangeURI, null, null));
- assertTrue(strategy.handles(uri, rangeURI, null, uri));
-
- //fail
- //s_r(p)_r(o)
- assertFalse(strategy.handles(uri, rangeURI, rangeURI, null));
-
- //s==null
- assertFalse(strategy.handles(null, uri, uri, null));
-
- //s_r(o)
- assertFalse(strategy.handles(uri, null, rangeURI, null));
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/MockRdfCloudConfiguration.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/MockRdfCloudConfiguration.java b/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/MockRdfCloudConfiguration.java
deleted file mode 100644
index ddb7fa8..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/MockRdfCloudConfiguration.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package mvm.rya.api.query.strategy.wholerow;
-
-/*
- * 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.
- */
-
-
-import mvm.rya.api.RdfCloudTripleStoreConfiguration;
-
-public class MockRdfCloudConfiguration extends RdfCloudTripleStoreConfiguration {
-
- @Override
- public RdfCloudTripleStoreConfiguration clone() {
- return this;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/OspWholeRowTriplePatternStrategyTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/OspWholeRowTriplePatternStrategyTest.java b/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/OspWholeRowTriplePatternStrategyTest.java
deleted file mode 100644
index 57b27be..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/OspWholeRowTriplePatternStrategyTest.java
+++ /dev/null
@@ -1,135 +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 mvm.rya.api.query.strategy.wholerow;
-
-//
-//import junit.framework.TestCase;
-//import mvm.rya.api.RdfCloudTripleStoreConstants;
-//import mvm.rya.api.domain.*;
-//import mvm.rya.api.resolver.RyaContext;
-//import mvm.rya.api.resolver.triple.TripleRow;
-//import org.apache.accumulo.core.data.Key;
-//import org.apache.accumulo.core.data.Range;
-//import org.apache.hadoop.io.Text;
-//import org.openrdf.model.impl.URIImpl;
-//
-//import java.util.Map;
-//
-///**
-// * Date: 7/14/12
-// * Time: 11:46 AM
-// */
-//public class OspWholeRowTriplePatternStrategyTest extends TestCase {
-// RyaURI uri = new RyaURI("urn:test#1234");
-// RyaURI uri2 = new RyaURI("urn:test#1235");
-// RyaURIRange rangeURI = new RyaURIRange(uri, uri2);
-// RyaURIRange rangeURI2 = new RyaURIRange(new RyaURI("urn:test#1235"), new RyaURI("urn:test#1236"));
-//
-// RyaType customType1 = new RyaType(new URIImpl("urn:custom#type"), "1234");
-// RyaType customType2 = new RyaType(new URIImpl("urn:custom#type"), "1235");
-// RyaType customType3 = new RyaType(new URIImpl("urn:custom#type"), "1236");
-// RyaTypeRange customTypeRange1 = new RyaTypeRange(customType1, customType2);
-// RyaTypeRange customTypeRange2 = new RyaTypeRange(customType2, customType3);
-//
-// OspWholeRowTriplePatternStrategy strategy = new OspWholeRowTriplePatternStrategy();
-// RyaContext ryaContext = RyaContext.getInstance();
-//
-// public void testO() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.OSP);
-// Key key = new Key(new Text(tripleRow.getRow()));
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(null, null, uri, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(null, null, uri2, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testORange() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.OSP);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(null, null, rangeURI, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(null, null, rangeURI2, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testOs() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.OSP);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(uri, null, uri, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(uri2, null, uri, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testOsRange() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.OSP);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(rangeURI, null, uri, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(rangeURI2, null, uri, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testOsRangeCustomType() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, customType1, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.OSP);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(rangeURI, null, customType1, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(rangeURI2, null, customType2, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testHandles() throws Exception {
-// //os(ng)
-// assertTrue(strategy.handles(uri, null, uri, null));
-// assertTrue(strategy.handles(uri, null, uri, uri));
-// //o_r(s)(ng)
-// assertTrue(strategy.handles(rangeURI, null, uri, null));
-// assertTrue(strategy.handles(rangeURI, null, uri, uri));
-// //o(ng)
-// assertTrue(strategy.handles(null, null, uri, null));
-// assertTrue(strategy.handles(null, null, uri, uri));
-// //r(o)
-// assertTrue(strategy.handles(null, null, rangeURI, null));
-// assertTrue(strategy.handles(null, null, rangeURI, uri));
-//
-// //false
-// assertFalse(strategy.handles(uri, null, rangeURI, null));
-// }
-//}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/PoWholeRowTriplePatternStrategyTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/PoWholeRowTriplePatternStrategyTest.java b/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/PoWholeRowTriplePatternStrategyTest.java
deleted file mode 100644
index 1079bf8..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/PoWholeRowTriplePatternStrategyTest.java
+++ /dev/null
@@ -1,159 +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 mvm.rya.api.query.strategy.wholerow;
-
-//
-//import junit.framework.TestCase;
-//import mvm.rya.api.RdfCloudTripleStoreConstants;
-//import mvm.rya.api.domain.*;
-//import mvm.rya.api.resolver.RyaContext;
-//import mvm.rya.api.resolver.triple.TripleRow;
-//import org.apache.accumulo.core.data.Key;
-//import org.apache.accumulo.core.data.Range;
-//import org.apache.hadoop.io.Text;
-//import org.openrdf.model.impl.URIImpl;
-//
-//import java.util.Map;
-//
-///**
-// * Date: 7/14/12
-// * Time: 11:46 AM
-// */
-//public class PoWholeRowTriplePatternStrategyTest extends TestCase {
-//
-// RyaURI uri = new RyaURI("urn:test#1234");
-// RyaURI uri2 = new RyaURI("urn:test#1235");
-// RyaURIRange rangeURI = new RyaURIRange(uri, uri2);
-// RyaURIRange rangeURI2 = new RyaURIRange(new RyaURI("urn:test#1235"), new RyaURI("urn:test#1236"));
-// PoWholeRowTriplePatternStrategy strategy = new PoWholeRowTriplePatternStrategy();
-// RyaContext ryaContext = RyaContext.getInstance();
-//
-// RyaType customType1 = new RyaType(new URIImpl("urn:custom#type"), "1234");
-// RyaType customType2 = new RyaType(new URIImpl("urn:custom#type"), "1235");
-// RyaType customType3 = new RyaType(new URIImpl("urn:custom#type"), "1236");
-// RyaTypeRange customTypeRange1 = new RyaTypeRange(customType1, customType2);
-// RyaTypeRange customTypeRange2 = new RyaTypeRange(customType2, customType3);
-//
-// public void testPoRange() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(null, uri, rangeURI, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(null, uri, rangeURI2, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testPoRangeCustomType() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, customType1, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(null, uri, customTypeRange1, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(null, uri, customTypeRange2, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testPo() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(null, uri, uri, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(null, uri, uri2, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testPoCustomType() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, customType1, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(null, uri, customType1, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(null, uri, customType2, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testPosRange() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(rangeURI, uri, uri, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(rangeURI2, uri, uri, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testPRange() throws Exception {
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(null, rangeURI, null, null, null);
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-// assertTrue(entry.getValue().contains(key));
-// }
-//
-// public void testP() throws Exception {
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(null, uri, null, null, null);
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.PO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-// assertTrue(entry.getValue().contains(key));
-// }
-//
-// public void testHandles() throws Exception {
-// //po(ng)
-// assertTrue(strategy.handles(null, uri, uri, null));
-// assertTrue(strategy.handles(null, uri, uri, uri));
-// //po_r(s)(ng)
-// assertTrue(strategy.handles(rangeURI, uri, uri, null));
-// assertTrue(strategy.handles(rangeURI, uri, uri, uri));
-// //p(ng)
-// assertTrue(strategy.handles(null, uri, null, null));
-// assertTrue(strategy.handles(null, uri, null, uri));
-// //p_r(o)(ng)
-// assertTrue(strategy.handles(null, uri, rangeURI, null));
-// assertTrue(strategy.handles(null, uri, rangeURI, uri));
-// //r(p)(ng)
-// assertTrue(strategy.handles(null, rangeURI, null, null));
-// assertTrue(strategy.handles(null, rangeURI, null, uri));
-//
-// //false cases
-// //sp..
-// assertFalse(strategy.handles(uri, uri, null, null));
-// //r(s)_p
-// assertFalse(strategy.handles(rangeURI, uri, null, null));
-// }
-//}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/SpoWholeRowTriplePatternStrategyTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/SpoWholeRowTriplePatternStrategyTest.java b/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/SpoWholeRowTriplePatternStrategyTest.java
deleted file mode 100644
index 019a3aa..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/query/strategy/wholerow/SpoWholeRowTriplePatternStrategyTest.java
+++ /dev/null
@@ -1,185 +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 mvm.rya.api.query.strategy.wholerow;
-
-//
-//import junit.framework.TestCase;
-//import mvm.rya.api.RdfCloudTripleStoreConstants;
-//import mvm.rya.api.domain.*;
-//import mvm.rya.api.resolver.RyaContext;
-//import mvm.rya.api.resolver.triple.TripleRow;
-//import org.apache.accumulo.core.data.Key;
-//import org.apache.accumulo.core.data.Range;
-//import org.apache.hadoop.io.Text;
-//import org.openrdf.model.impl.URIImpl;
-//
-//import java.util.Map;
-//
-///**
-// * Date: 7/14/12
-// * Time: 7:47 AM
-// */
-//public class SpoWholeRowTriplePatternStrategyTest extends TestCase {
-//
-// RyaURI uri = new RyaURI("urn:test#1234");
-// RyaURI uri2 = new RyaURI("urn:test#1235");
-// RyaURIRange rangeURI = new RyaURIRange(uri, uri2);
-// RyaURIRange rangeURI2 = new RyaURIRange(new RyaURI("urn:test#1235"), new RyaURI("urn:test#1236"));
-// SpoWholeRowTriplePatternStrategy strategy = new SpoWholeRowTriplePatternStrategy();
-// RyaContext ryaContext = RyaContext.getInstance();
-//
-// RyaType customType1 = new RyaType(new URIImpl("urn:custom#type"), "1234");
-// RyaType customType2 = new RyaType(new URIImpl("urn:custom#type"), "1235");
-// RyaType customType3 = new RyaType(new URIImpl("urn:custom#type"), "1236");
-// RyaTypeRange customTypeRange1 = new RyaTypeRange(customType1, customType2);
-// RyaTypeRange customTypeRange2 = new RyaTypeRange(customType2, customType3);
-//
-// public void testSpo() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(uri, uri, uri, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(uri, uri, uri2, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testSpoCustomType() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, customType1, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(uri, uri, customType1, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(uri, uri, customType2, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testSpoRange() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(uri, uri, rangeURI, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(uri, uri, rangeURI2, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testSpoRangeCustomType() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, customType1, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(uri, uri, customTypeRange1, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(uri, uri, customTypeRange2, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testSp() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(uri, uri, null, null, null);
-// assertTrue(entry.getValue().contains(key));
-// entry = strategy.defineRange(uri, uri2, null, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testSpRange() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(uri, rangeURI, null, null, null);
-// assertTrue(entry.getValue().contains(key));
-// entry = strategy.defineRange(uri, rangeURI2, null, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testS() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(uri, null, null, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(uri2, null, null, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testSRange() throws Exception {
-// Map<RdfCloudTripleStoreConstants.TABLE_LAYOUT, TripleRow> serialize = ryaContext.serializeTriple(
-// new RyaStatement(uri, uri, uri, null));
-// TripleRow tripleRow = serialize.get(RdfCloudTripleStoreConstants.TABLE_LAYOUT.SPO);
-// Key key = new Key(new Text(tripleRow.getRow()));
-//
-// Map.Entry<RdfCloudTripleStoreConstants.TABLE_LAYOUT, Range> entry = strategy.defineRange(rangeURI, null, null, null, null);
-// assertTrue(entry.getValue().contains(key));
-//
-// entry = strategy.defineRange(rangeURI2, null, null, null, null);
-// assertFalse(entry.getValue().contains(key));
-// }
-//
-// public void testHandles() throws Exception {
-// //spo(ng)
-// assertTrue(strategy.handles(uri, uri, uri, null));
-// assertTrue(strategy.handles(uri, uri, uri, uri));
-// //sp(ng)
-// assertTrue(strategy.handles(uri, uri, null, null));
-// assertTrue(strategy.handles(uri, uri, null, uri));
-// //s(ng)
-// assertTrue(strategy.handles(uri, null, null, null));
-// assertTrue(strategy.handles(uri, null, null, uri));
-// //sp_r(o)(ng)
-// assertTrue(strategy.handles(uri, uri, rangeURI, null));
-// assertTrue(strategy.handles(uri, uri, rangeURI, uri));
-// //s_r(p)(ng)
-// assertTrue(strategy.handles(uri, rangeURI, null, null));
-// assertTrue(strategy.handles(uri, rangeURI, null, uri));
-// //r(s)
-// assertTrue(strategy.handles(rangeURI, null, null, null));
-//
-// //fail
-// //s_r(p)_r(o)
-// assertFalse(strategy.handles(uri, rangeURI, rangeURI, null));
-//
-// //s==null
-// assertFalse(strategy.handles(null, uri, uri, null));
-//
-// //s_r(o)
-// assertFalse(strategy.handles(uri, null, rangeURI, null));
-// }
-//}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/resolver/RyaContextTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/resolver/RyaContextTest.java b/common/rya.api/src/test/java/mvm/rya/api/resolver/RyaContextTest.java
deleted file mode 100644
index 4363fd3..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/resolver/RyaContextTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package mvm.rya.api.resolver;
-
-/*
- * 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.
- */
-
-
-
-import java.util.Map;
-
-import junit.framework.TestCase;
-import mvm.rya.api.RdfCloudTripleStoreConstants.TABLE_LAYOUT;
-import mvm.rya.api.domain.RyaStatement;
-import mvm.rya.api.domain.RyaType;
-import mvm.rya.api.domain.RyaURI;
-import mvm.rya.api.query.strategy.AbstractTriplePatternStrategyTest.MockRdfConfiguration;
-import mvm.rya.api.query.strategy.wholerow.MockRdfCloudConfiguration;
-import mvm.rya.api.resolver.triple.TripleRow;
-
-import org.openrdf.model.impl.URIImpl;
-
-/**
- */
-public class RyaContextTest extends TestCase {
-
- public void testDefaultSerialization() throws Exception {
- RyaContext instance = RyaContext.getInstance();
- //plain string
- RyaType ryaType = new RyaType("mydata");
- byte[] serialize = instance.serialize(ryaType);
- assertEquals(ryaType, instance.deserialize(serialize));
-
- //uri
- RyaURI ryaURI = new RyaURI("urn:test#1234");
- serialize = instance.serialize(ryaURI);
- RyaType deserialize = instance.deserialize(serialize);
- assertEquals(ryaURI, deserialize);
-
- //custom type
- ryaType = new RyaType(new URIImpl("urn:test#customDataType"), "mydata");
- serialize = instance.serialize(ryaType);
- assertEquals(ryaType, instance.deserialize(serialize));
- }
-
- public void testTripleRowSerialization() throws Exception {
- RyaURI subj = new RyaURI("urn:test#subj");
- RyaURI pred = new RyaURI("urn:test#pred");
- RyaType obj = new RyaType("mydata");
- RyaStatement statement = new RyaStatement(subj, pred, obj);
- RyaTripleContext instance = RyaTripleContext.getInstance(new MockRdfCloudConfiguration());
-
- Map<TABLE_LAYOUT, TripleRow> map = instance.serializeTriple(statement);
- TripleRow tripleRow = map.get(TABLE_LAYOUT.SPO);
- assertEquals(statement, instance.deserializeTriple(TABLE_LAYOUT.SPO, tripleRow));
- }
-
- public void testHashedTripleRowSerialization() throws Exception {
- RyaURI subj = new RyaURI("urn:test#subj");
- RyaURI pred = new RyaURI("urn:test#pred");
- RyaType obj = new RyaType("mydata");
- RyaStatement statement = new RyaStatement(subj, pred, obj);
- MockRdfCloudConfiguration config = new MockRdfCloudConfiguration();
- config.set(MockRdfCloudConfiguration.CONF_PREFIX_ROW_WITH_HASH, Boolean.TRUE.toString());
- RyaTripleContext instance = RyaTripleContext.getInstance(config);
-
- Map<TABLE_LAYOUT, TripleRow> map = instance.serializeTriple(statement);
- TripleRow tripleRow = map.get(TABLE_LAYOUT.SPO);
- assertEquals(statement, instance.deserializeTriple(TABLE_LAYOUT.SPO, tripleRow));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/CustomDatatypeResolverTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/CustomDatatypeResolverTest.java b/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/CustomDatatypeResolverTest.java
deleted file mode 100644
index 0126414..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/CustomDatatypeResolverTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package mvm.rya.api.resolver.impl;
-
-/*
- * 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.
- */
-
-
-
-import junit.framework.TestCase;
-import mvm.rya.api.domain.RyaType;
-import org.openrdf.model.impl.URIImpl;
-
-/**
- * Date: 7/16/12
- * Time: 2:47 PM
- */
-public class CustomDatatypeResolverTest extends TestCase {
-
- public void testCustomDataTypeSerialization() throws Exception {
- RyaType ryaType = new RyaType(new URIImpl("urn:test#datatype"), "testdata");
- byte[] serialize = new CustomDatatypeResolver().serialize(ryaType);
- RyaType deserialize = new CustomDatatypeResolver().deserialize(serialize);
- assertEquals(ryaType, deserialize);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/DateTimeRyaTypeResolverTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/DateTimeRyaTypeResolverTest.java b/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/DateTimeRyaTypeResolverTest.java
deleted file mode 100644
index 899bbcf..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/DateTimeRyaTypeResolverTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package mvm.rya.api.resolver.impl;
-
-/*
- * 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.
- */
-
-
-
-import static org.junit.Assert.*;
-
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-import javax.xml.datatype.DatatypeFactory;
-import javax.xml.datatype.XMLGregorianCalendar;
-
-import mvm.rya.api.domain.RyaType;
-import mvm.rya.api.resolver.RdfToRyaConversions;
-import mvm.rya.api.resolver.RyaTypeResolverException;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.openrdf.model.impl.CalendarLiteralImpl;
-import org.openrdf.model.vocabulary.XMLSchema;
-
-/**
- * Test serializing and deserializing.
- * Notes:
- * The serialization, deserialization fills in some information:
- * If preserving uncertainty, or preserving the source timezone, then don't use XML type tag.
- * - uncertainty: missing time hh:mm:ss becomes 00:00:00
- * - uncertainty: missing milliseconds (.123) become .000.
- * - uncertainty: missing timezone becomes the system local timezone.
- * - timezone: converted to the equivalent Z timezone.
- * - a type XMLSchema.DATE become XMLSchema.DATETIME after deserialized
- *
- * ex: run in timezone eastern time (GMT-5:00):
- * before= 2000-02-02 type = XMLSchema.DATE
- * deserialized= 2000-02-02T05:00:00.000Z type = XMLSchema.DATETIME
- */
-public class DateTimeRyaTypeResolverTest {
- @Test
- public void testDateTime() throws Exception {
- long currentTime = 1342182689285l;
- Date date = new Date(currentTime);
- GregorianCalendar gc = new GregorianCalendar();
- gc.setTimeInMillis(date.getTime());
- XMLGregorianCalendar xmlGregorianCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(gc);
- CalendarLiteralImpl literal = new CalendarLiteralImpl(xmlGregorianCalendar);
- byte[] serialize = new DateTimeRyaTypeResolver().serialize(RdfToRyaConversions.convertLiteral(literal));
- RyaType deserialize = new DateTimeRyaTypeResolver().deserialize(serialize);
- assertEquals("2012-07-13T12:31:29.285Z", deserialize.getData());
- assertEquals(XMLSchema.DATETIME, deserialize.getDataType());
- }
- @Test
- public void testFull() throws Exception {
- String currentTime = "2000-01-01T00:00:01.111Z";
- assertSerializeAndDesDateTime("2000-01-01T00:00:01.111Z");
-
- }
- @Test
- public void testNoMilliSeconds() throws Exception {
- assertSerializeAndDesDateTime("2000-01-01T00:00:01Z","2000-01-01T00:00:01.000Z");
-
- }
- @Test
- public void testDateNoTimeNoZone() throws Exception {
- String beforeDate = "2000-02-02";
- String afterDate="2000-02-0(1|2|3)T\\d\\d:\\d\\d:00\\.000Z";
- RyaType deserialize = serializeAndDeserialize(beforeDate, XMLSchema.DATE);
- final String afterActual = deserialize.getData();
- assertTrue("Before='"+beforeDate+"'; Expected should match actual regex after='"+afterDate+"' deserialized:"+afterActual, afterActual.matches(afterDate));
- assertEquals(XMLSchema.DATETIME, deserialize.getDataType());
- }
- @Test
- public void testDateZoneNoTime() throws Exception {
- // if you see this:
- //java.lang.IllegalArgumentException: Invalid format: "2000-02-02Z" is malformed at "Z"
- // use this: "2000-02-02TZ";
- String currentTime = "2000-02-02TZ";
- RyaType deserialize = serializeAndDeserialize(currentTime, XMLSchema.DATE);
- assertEquals("Before expected should match after actual deserialized:","2000-02-02T00:00:00.000Z", deserialize.getData());
- assertEquals(XMLSchema.DATETIME, deserialize.getDataType());
- }
- @Test
- public void testNoZone() throws Exception {
- String beforeDate = "2000-01-02T00:00:01";
- String afterDate="2000-01-0(1|2|3)T\\d\\d:\\d\\d:01\\.000Z";
- RyaType deserialize = serializeAndDeserialize(beforeDate, XMLSchema.DATE);
- final String afterActual = deserialize.getData();
- assertTrue("Before='"+beforeDate+"'; Expected should match actual regex after='"+afterDate+"' deserialized:"+afterActual, afterActual.matches(afterDate));
- assertEquals(XMLSchema.DATETIME, deserialize.getDataType());
-
- }
- @Test
- public void testMilliSecondsNoZone() throws Exception {
- String beforeDate="2002-02-02T02:02:02.222";
- String afterDate="2002-02-0(1|2|3)T\\d\\d:\\d\\d:02\\.222.*";
- RyaType deserialize = serializeAndDeserialize(beforeDate, XMLSchema.DATETIME);
- final String afterActual = deserialize.getData();
- assertTrue("Before='"+beforeDate+"'; Expected should match actual regex after='"+afterDate+"' deserialized:"+afterActual, afterActual.matches(afterDate));
- assertEquals(XMLSchema.DATETIME, deserialize.getDataType());
-
- }
- @Test
- public void testHistoryAndFuture() throws Exception {
- assertSerializeAndDesDateTime("-2000-01-01T00:00:01Z","-2000-01-01T00:00:01.000Z");
- assertSerializeAndDesDateTime("111-01-01T00:00:01Z","0111-01-01T00:00:01.000Z");
- assertSerializeAndDesDateTime("12345-01-01T00:00:01Z","12345-01-01T00:00:01.000Z");
- }
-
- @Test
- public void testTimeZone() throws Exception {
- assertSerializeAndDesDateTime( "2000-01-01T00:00:01+01:00", "1999-12-31T23:00:01.000Z");
- assertSerializeAndDesDateTime( "2000-01-01T00:00:01+02:30", "1999-12-31T21:30:01.000Z");
- assertSerializeAndDesDateTime("2000-01-01T00:00:01.123-02:00", "2000-01-01T02:00:01.123Z");
- assertSerializeAndDesDateTime( "111-01-01T00:00:01+14:00", "0110-12-31T10:00:01.000Z" );
- assertSerializeAndDesDateTime( "12345-01-01T00:00:01-14:00","12345-01-01T14:00:01.000Z");
- assertSerializeAndDesDateTime( "1-01-01T00:00:01+14:00", "0000-12-31T10:00:01.000Z" );
- }
-
- @Test
- public void testGarbageIn() throws Exception {
- String currentTime = "Blablabla";
- RyaType ryaType = new RyaType(XMLSchema.DATETIME, currentTime );
- Throwable threw=null;
- try {
- new DateTimeRyaTypeResolver().serialize(ryaType);
- } catch (java.lang.IllegalArgumentException exception) {
- threw = exception;
- }
- assertNotNull("Expected to catch bad format message.",threw);
- assertEquals("Caught bad format message.","Invalid format: \"Blablabla\"", threw.getMessage());
- }
- /**
- * Do the test on the DateTime
- * @param dateTimeString
- * @throws RyaTypeResolverException
- */
- private void assertSerializeAndDesDateTime(String dateTimeString) throws RyaTypeResolverException {
- assertSerializeAndDesDateTime(dateTimeString, dateTimeString);
- }
- private void assertSerializeAndDesDateTime(String beforeDate, String afterDate ) throws RyaTypeResolverException {
- RyaType deserialize = serializeAndDeserialize(beforeDate, XMLSchema.DATETIME);
- assertEquals("Before='"+beforeDate+"'; Expected should match actual after deserialized:",afterDate, deserialize.getData());
- assertEquals(XMLSchema.DATETIME, deserialize.getDataType());
- }
- /**
- * Serialize a datetime string, then deserialize as a ryaType.
- * @param dateTimeString
- * @param type if null , use default: XMLSchema.DATETIME
- * @return
- * @throws RyaTypeResolverException
- */
- private RyaType serializeAndDeserialize(String dateTimeString, org.openrdf.model.URI type ) throws RyaTypeResolverException {
- if (type == null)
- type = XMLSchema.DATETIME;
- RyaType ryaType = new RyaType(type, dateTimeString );
- byte[] serialize = new DateTimeRyaTypeResolver().serialize(ryaType);
- return new DateTimeRyaTypeResolver().deserialize(serialize);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/DoubleRyaTypeResolverTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/DoubleRyaTypeResolverTest.java b/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/DoubleRyaTypeResolverTest.java
deleted file mode 100644
index 2c5f43d..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/DoubleRyaTypeResolverTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package mvm.rya.api.resolver.impl;
-
-/*
- * 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.
- */
-
-
-
-import junit.framework.TestCase;
-import mvm.rya.api.domain.RyaType;
-import org.openrdf.model.vocabulary.XMLSchema;
-
-import java.util.Random;
-
-/**
- * Date: 7/20/12
- * Time: 9:43 AM
- */
-public class DoubleRyaTypeResolverTest extends TestCase {
-
- public void testDoubleSerialization() throws Exception {
- Double d = randomDouble();
- RyaType ryaType = new RyaType(XMLSchema.DOUBLE, d.toString());
- byte[] serialize = new DoubleRyaTypeResolver().serialize(ryaType);
- assertEquals(d, Double.parseDouble(new DoubleRyaTypeResolver().deserialize(serialize).getData()));
- }
-
- private double randomDouble() {
- return new Random(System.currentTimeMillis()).nextDouble();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/IntegerRyaTypeResolverTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/IntegerRyaTypeResolverTest.java b/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/IntegerRyaTypeResolverTest.java
deleted file mode 100644
index 60cded0..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/IntegerRyaTypeResolverTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package mvm.rya.api.resolver.impl;
-
-/*
- * 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.
- */
-
-
-
-import junit.framework.TestCase;
-import mvm.rya.api.domain.RyaType;
-import org.openrdf.model.vocabulary.XMLSchema;
-
-import java.util.Random;
-
-/**
- * Date: 7/20/12
- * Time: 10:17 AM
- */
-public class IntegerRyaTypeResolverTest extends TestCase {
- public void testIntegerSerialization() throws Exception {
- Integer i = randomInt();
- byte[] serialize = new IntegerRyaTypeResolver().serialize(new RyaType(XMLSchema.INTEGER, i.toString()));
- assertEquals(i, new Integer(new IntegerRyaTypeResolver().deserialize(serialize).getData()));
- }
-
- private int randomInt() {
- return new Random(System.currentTimeMillis()).nextInt(Integer.MAX_VALUE);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/LongRyaTypeResolverTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/LongRyaTypeResolverTest.java b/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/LongRyaTypeResolverTest.java
deleted file mode 100644
index 3dfb9c4..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/LongRyaTypeResolverTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package mvm.rya.api.resolver.impl;
-
-/*
- * 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.
- */
-
-
-
-import mvm.rya.api.domain.RyaType;
-import org.junit.Test;
-import org.openrdf.model.vocabulary.XMLSchema;
-
-import java.util.Random;
-
-import static junit.framework.Assert.assertEquals;
-
-/**
- * Date: 9/7/12
- * Time: 2:53 PM
- */
-public class LongRyaTypeResolverTest {
-
- @Test
- public void testSerialization() throws Exception {
- Long i = randomLong();
- byte[] serialize = new LongRyaTypeResolver().serialize(new RyaType(XMLSchema.LONG, i.toString()));
- assertEquals(i, new Long(new LongRyaTypeResolver().deserialize(serialize).getData()));
- }
-
- private long randomLong() {
- return new Random(System.currentTimeMillis()).nextLong();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/44a2dcf0/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/RyaURIResolverTest.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/RyaURIResolverTest.java b/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/RyaURIResolverTest.java
deleted file mode 100644
index f962b88..0000000
--- a/common/rya.api/src/test/java/mvm/rya/api/resolver/impl/RyaURIResolverTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package mvm.rya.api.resolver.impl;
-
-/*
- * 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.
- */
-
-
-
-import junit.framework.TestCase;
-import mvm.rya.api.domain.RyaType;
-import mvm.rya.api.domain.RyaURI;
-
-/**
- * Date: 7/16/12
- * Time: 2:51 PM
- */
-public class RyaURIResolverTest extends TestCase {
-
- public void testSerialization() throws Exception {
- RyaURI ryaURI = new RyaURI("urn:testdata#data");
- byte[] serialize = new RyaURIResolver().serialize(ryaURI);
- RyaType deserialize = new RyaURIResolver().deserialize(serialize);
- assertEquals(ryaURI, deserialize);
- }
-}