Tests for StoreParams. Project: http://git-wip-us.apache.org/repos/asf/jena/repo Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/75087f52 Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/75087f52 Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/75087f52
Branch: refs/heads/hadoop-rdf Commit: 75087f52ed72cdea89d74c6af8d9ba24764962dd Parents: be8f0ae Author: Andy Seaborne <a...@apache.org> Authored: Mon Nov 3 20:33:37 2014 +0000 Committer: Andy Seaborne <a...@apache.org> Committed: Mon Nov 3 20:33:37 2014 +0000 ---------------------------------------------------------------------- .../test/java/com/hp/hpl/jena/tdb/TC_TDB.java | 2 + .../com/hp/hpl/jena/tdb/setup/TS_TDBSetup.java | 31 +++++++++++ .../hp/hpl/jena/tdb/setup/TestStoreParams.java | 58 ++++++++++++++++++++ 3 files changed, 91 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/jena/blob/75087f52/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/TC_TDB.java ---------------------------------------------------------------------- diff --git a/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/TC_TDB.java b/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/TC_TDB.java index fe9d58d..554287c 100644 --- a/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/TC_TDB.java +++ b/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/TC_TDB.java @@ -34,6 +34,7 @@ import com.hp.hpl.jena.tdb.base.objectfile.TS_ObjectFile ; import com.hp.hpl.jena.tdb.graph.TS_Graph ; import com.hp.hpl.jena.tdb.index.TS_Index ; import com.hp.hpl.jena.tdb.lib.TS_LibTDB ; +import com.hp.hpl.jena.tdb.setup.TS_TDBSetup ; import com.hp.hpl.jena.tdb.solver.TS_SolverTDB ; import com.hp.hpl.jena.tdb.store.TS_Store ; import com.hp.hpl.jena.tdb.store.nodetable.TS_NodeTable ; @@ -54,6 +55,7 @@ import com.hp.hpl.jena.tdb.transaction.TS_TransactionTDB ; , TS_NodeTable.class , TS_Index.class , TS_TupleTable.class + , TS_TDBSetup.class , TS_Store.class // The main storage implementation. Slow tests. , TS_SolverTDB.class , TS_Sys.class http://git-wip-us.apache.org/repos/asf/jena/blob/75087f52/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/setup/TS_TDBSetup.java ---------------------------------------------------------------------- diff --git a/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/setup/TS_TDBSetup.java b/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/setup/TS_TDBSetup.java new file mode 100644 index 0000000..2a2e58f --- /dev/null +++ b/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/setup/TS_TDBSetup.java @@ -0,0 +1,31 @@ +/** + * 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 com.hp.hpl.jena.tdb.setup; + +import org.junit.runner.RunWith ; +import org.junit.runners.Suite ; + +@RunWith(Suite.class) +@Suite.SuiteClasses( { + TestStoreParams.class +}) +public class TS_TDBSetup { + +} + http://git-wip-us.apache.org/repos/asf/jena/blob/75087f52/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/setup/TestStoreParams.java ---------------------------------------------------------------------- diff --git a/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/setup/TestStoreParams.java b/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/setup/TestStoreParams.java new file mode 100644 index 0000000..25b4d57 --- /dev/null +++ b/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/setup/TestStoreParams.java @@ -0,0 +1,58 @@ +/* + * 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 com.hp.hpl.jena.tdb.setup; + +import java.util.Objects ; + +import org.apache.jena.atlas.junit.BaseTest ; +import org.apache.jena.atlas.lib.InternalErrorException ; +import org.junit.Test ; + +public class TestStoreParams extends BaseTest { + + @Test public void store_params_01() { + assertEqualsStoreParams(StoreParams.getDftStoreParams(), StoreParams.getDftStoreParams()) ; + } + + @Test public void store_params_02() { + StoreParams sp = StoreParamsBuilder.create().build() ; + assertEqualsStoreParams(StoreParams.getDftStoreParams(), sp) ; + } + + private static void assertEqualsStoreParams(StoreParams params1, StoreParams params2) { + assertTrue(same(params1, params2)) ; + } + + private static boolean same(StoreParams params1, StoreParams params2) { + boolean b0 = same0(params1, params2) ; + boolean b1 = same1(params1, params2) ; + if ( b0 != b1 ) + throw new InternalErrorException() ; + return b0 ; + } + + private static boolean same0(StoreParams params1, StoreParams params2) { + return params1.toString().equals(params2.toString()) ; + } + + private static boolean same1(StoreParams params1, StoreParams params2) { + return Objects.equals(params1, params2) ; + } + +}