com.bigdata.rdf.store.TestLocalTripleStoreWithoutStatementIdentifiers Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bigdata-rdf-test Show documentation
Show all versions of bigdata-rdf-test Show documentation
Blazegraph(TM) RDF Test Suites
/**
Copyright (C) SYSTAP, LLC DBA Blazegraph 2006-2016. All rights reserved.
Contact:
SYSTAP, LLC DBA Blazegraph
2501 Calvert ST NW #106
Washington, DC 20008
[email protected]
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
* Created on Oct 18, 2007
*/
package com.bigdata.rdf.store;
import java.io.File;
import java.util.Properties;
import junit.extensions.proxy.ProxyTestSuite;
import junit.framework.Test;
import com.bigdata.btree.BTree;
import com.bigdata.journal.Options;
/**
* Proxy test suite for {@link LocalTripleStore} when the backing indices are
* {@link BTree}s. This configuration does NOT support transactions since the
* various indices are NOT isolatable.
*
* @author Bryan Thompson
* @version $Id$
*/
public class TestLocalTripleStoreWithoutStatementIdentifiers extends AbstractTestCase {
/**
*
*/
public TestLocalTripleStoreWithoutStatementIdentifiers() {
}
public TestLocalTripleStoreWithoutStatementIdentifiers(String name) {
super(name);
}
public static Test suite() {
final TestLocalTripleStoreWithoutStatementIdentifiers delegate = new TestLocalTripleStoreWithoutStatementIdentifiers(); // !!!! THIS CLASS !!!!
/*
* Use a proxy test suite and specify the delegate.
*/
final ProxyTestSuite suite = new ProxyTestSuite(delegate,
"Local Triple Store Without Statement Identifiers");
/*
* List any non-proxied tests (typically bootstrapping tests).
*/
// ...
/*
* Proxied test suite for use only with the LocalTripleStore.
*/
suite.addTestSuite(TestLocalTripleStoreTransactionSemantics.class);
/*
* Pickup the basic triple store test suite. This is a proxied test
* suite, so all the tests will run with the configuration specified in
* this test class and its optional .properties file.
*/
// basic test suite.
suite.addTest(TestTripleStoreBasics.suite());
// rules, inference, and truth maintenance test suite.
suite.addTest( com.bigdata.rdf.rules.TestAll.suite() );
return suite;
}
@Override
public Properties getProperties() {
final Properties properties = super.getProperties();
// turn off statement identifiers.
properties
.setProperty(
com.bigdata.rdf.store.AbstractTripleStore.Options.STATEMENT_IDENTIFIERS,
"false");
// triples only.
properties.setProperty(
com.bigdata.rdf.store.AbstractTripleStore.Options.QUADS,
"false");
return properties;
}
@Override
protected AbstractTripleStore getStore(final Properties properties) {
return LocalTripleStore.getInstance(properties);
}
/**
* Re-open the same backing store.
*
* @param store
* the existing store.
*
* @return A new store.
*
* @exception Throwable
* if the existing store is closed, or if the store can not
* be re-opened, e.g., from failure to obtain a file lock,
* etc.
*/
@Override
protected AbstractTripleStore reopenStore(final AbstractTripleStore store) {
// close the store.
store.close();
if (!store.isStable()) {
throw new UnsupportedOperationException(
"The backing store is not stable");
}
// Note: clone to avoid modifying!!!
final Properties properties = (Properties) getProperties().clone();
// Turn this off now since we want to re-open the same store.
properties.setProperty(Options.CREATE_TEMP_FILE, "false");
// The backing file that we need to re-open.
final File file = ((LocalTripleStore) store).getIndexManager().getFile();
assertNotNull(file);
// Set the file property explicitly.
properties.setProperty(Options.FILE, file.toString());
return LocalTripleStore.getInstance(properties);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy