// Path: common/src/test/java/com/msd/gin/halyard/common/HBaseServerTestInstance.java
// public class HBaseServerTestInstance {
// 
//     private static Configuration conf = null;
// 
//     public static synchronized Configuration getInstanceConfig() throws Exception {
//         if (conf == null) {
//             File zooRoot = File.createTempFile("hbase-zookeeper", "");
//             zooRoot.delete();
//             ZooKeeperServer zookeper = new ZooKeeperServer(zooRoot, zooRoot, 2000);
//             ServerCnxnFactory factory = ServerCnxnFactory.createFactory(new InetSocketAddress("localhost", 0), 5000);
//             factory.startup(zookeper);
// 
//             YarnConfiguration yconf = new YarnConfiguration();
//             String argLine = System.getProperty("argLine");
//             if (argLine != null) {
//                 yconf.set("yarn.app.mapreduce.am.command-opts", argLine.replace("jacoco.exec", "jacocoMR.exec"));
//             }
//             yconf.setBoolean(MRConfig.MAPREDUCE_MINICLUSTER_CONTROL_RESOURCE_MONITORING, false);
//             yconf.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class, ResourceScheduler.class);
//             MiniMRYarnCluster miniCluster = new MiniMRYarnCluster("testCluster");
//             miniCluster.init(yconf);
//             String resourceManagerLink = yconf.get(YarnConfiguration.RM_ADDRESS);
//             yconf.setBoolean(MRJobConfig.JOB_UBERTASK_ENABLE, true);
//             miniCluster.start();
//             miniCluster.waitForNodeManagersToConnect(10000);
//             // following condition set in MiniYarnCluster:273
//             while (resourceManagerLink.endsWith(":0")) {
//                 Thread.sleep(100);
//                 resourceManagerLink = yconf.get(YarnConfiguration.RM_ADDRESS);
//             }
// 
//             File hbaseRoot = File.createTempFile("hbase-root", "");
//             hbaseRoot.delete();
//             conf = HBaseConfiguration.create(miniCluster.getConfig());
//             conf.set(HConstants.HBASE_DIR, hbaseRoot.toURI().toURL().toString());
//             conf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, factory.getLocalPort());
//             conf.set("hbase.master.hostname", "localhost");
//             conf.set("hbase.regionserver.hostname", "localhost");
//             conf.setInt("hbase.master.info.port", -1);
//             conf.set("hbase.fs.tmp.dir", new File(System.getProperty("java.io.tmpdir")).toURI().toURL().toString());
//             LocalHBaseCluster cluster = new LocalHBaseCluster(conf);
//             cluster.startup();
//         }
//         return new Configuration(conf);
//     }
// }


import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import com.msd.gin.halyard.common.HBaseServerTestInstance;
import java.util.Arrays;
import java.util.Collection;
import org.eclipse.rdf4j.common.iteration.CloseableIteration;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Resource;
import org.eclipse.rdf4j.model.Statement;
import org.eclipse.rdf4j.model.Value;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
import org.eclipse.rdf4j.sail.SailException;
import org.junit.AfterClass;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.BeforeClass;
/*
 * Copyright 2016 Merck Sharp & Dohme Corp. a subsidiary of Merck & Co.,
 * Inc., Kenilworth, NJ, USA.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.msd.gin.halyard.sail;


/**
 *
 * @author Adam Sotona (MSD)
 */
@RunWith(Parameterized.class)
public class HBaseSailAddRemoveTest {
    private static final Resource SUBJ = SimpleValueFactory.getInstance().createIRI("http://whatever/subject/");
    private static final IRI PRED = SimpleValueFactory.getInstance().createIRI("http://whatever/pred/");
    private static final Value OBJ = SimpleValueFactory.getInstance().createLiteral("whatever literal");
    private static final IRI CONTEXT = SimpleValueFactory.getInstance().createIRI("http://whatever/cont/");

    private static HBaseSail explicitSail;

    @Parameterized.Parameters
    public static Collection<Object[]> data() {
        return Arrays.asList(new Object[][] {
                 {null, null, null},
                 {SUBJ, null, null},
                 {null, PRED, null},
                 {null, null,  OBJ},
                 {SUBJ, PRED, null},
                 {null, PRED,  OBJ},
                 {SUBJ, null,  OBJ},
                 {SUBJ, PRED,  OBJ},
        });
    }

    @BeforeClass
    public static void setup() throws Exception {
// Path: common/src/test/java/com/msd/gin/halyard/common/HBaseServerTestInstance.java
// public class HBaseServerTestInstance {
// 
//     private static Configuration conf = null;
// 
//     public static synchronized Configuration getInstanceConfig() throws Exception {
//         if (conf == null) {
//             File zooRoot = File.createTempFile("hbase-zookeeper", "");
//             zooRoot.delete();
//             ZooKeeperServer zookeper = new ZooKeeperServer(zooRoot, zooRoot, 2000);
//             ServerCnxnFactory factory = ServerCnxnFactory.createFactory(new InetSocketAddress("localhost", 0), 5000);
//             factory.startup(zookeper);
// 
//             YarnConfiguration yconf = new YarnConfiguration();
//             String argLine = System.getProperty("argLine");
//             if (argLine != null) {
//                 yconf.set("yarn.app.mapreduce.am.command-opts", argLine.replace("jacoco.exec", "jacocoMR.exec"));
//             }
//             yconf.setBoolean(MRConfig.MAPREDUCE_MINICLUSTER_CONTROL_RESOURCE_MONITORING, false);
//             yconf.setClass(YarnConfiguration.RM_SCHEDULER, FifoScheduler.class, ResourceScheduler.class);
//             MiniMRYarnCluster miniCluster = new MiniMRYarnCluster("testCluster");
//             miniCluster.init(yconf);
//             String resourceManagerLink = yconf.get(YarnConfiguration.RM_ADDRESS);
//             yconf.setBoolean(MRJobConfig.JOB_UBERTASK_ENABLE, true);
//             miniCluster.start();
//             miniCluster.waitForNodeManagersToConnect(10000);
//             // following condition set in MiniYarnCluster:273
//             while (resourceManagerLink.endsWith(":0")) {
//                 Thread.sleep(100);
//                 resourceManagerLink = yconf.get(YarnConfiguration.RM_ADDRESS);
//             }
// 
//             File hbaseRoot = File.createTempFile("hbase-root", "");
//             hbaseRoot.delete();
//             conf = HBaseConfiguration.create(miniCluster.getConfig());
//             conf.set(HConstants.HBASE_DIR, hbaseRoot.toURI().toURL().toString());
//             conf.setInt(HConstants.ZOOKEEPER_CLIENT_PORT, factory.getLocalPort());
//             conf.set("hbase.master.hostname", "localhost");
//             conf.set("hbase.regionserver.hostname", "localhost");
//             conf.setInt("hbase.master.info.port", -1);
//             conf.set("hbase.fs.tmp.dir", new File(System.getProperty("java.io.tmpdir")).toURI().toURL().toString());
//             LocalHBaseCluster cluster = new LocalHBaseCluster(conf);
//             cluster.startup();
//         }
//         return new Configuration(conf);
//     }
// }


// Path: sail/src/test/java/com/msd/gin/halyard/sail/HBaseSailAddRemoveTest.java
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import com.msd.gin.halyard.common.HBaseServerTestInstance;
import java.util.Arrays;
import java.util.Collection;
import org.eclipse.rdf4j.common.iteration.CloseableIteration;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Resource;
import org.eclipse.rdf4j.model.Statement;
import org.eclipse.rdf4j.model.Value;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
import org.eclipse.rdf4j.sail.SailException;
import org.junit.AfterClass;
import org.junit.Test;
import static org.junit.Assert.*;
import org.junit.BeforeClass;

/*
 * Copyright 2016 Merck Sharp & Dohme Corp. a subsidiary of Merck & Co.,
 * Inc., Kenilworth, NJ, USA.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.msd.gin.halyard.sail;


/**
 *
 * @author Adam Sotona (MSD)
 */
@RunWith(Parameterized.class)
public class HBaseSailAddRemoveTest {
    private static final Resource SUBJ = SimpleValueFactory.getInstance().createIRI("http://whatever/subject/");
    private static final IRI PRED = SimpleValueFactory.getInstance().createIRI("http://whatever/pred/");
    private static final Value OBJ = SimpleValueFactory.getInstance().createLiteral("whatever literal");
    private static final IRI CONTEXT = SimpleValueFactory.getInstance().createIRI("http://whatever/cont/");

    private static HBaseSail explicitSail;

    @Parameterized.Parameters
    public static Collection<Object[]> data() {
        return Arrays.asList(new Object[][] {
                 {null, null, null},
                 {SUBJ, null, null},
                 {null, PRED, null},
                 {null, null,  OBJ},
                 {SUBJ, PRED, null},
                 {null, PRED,  OBJ},
                 {SUBJ, null,  OBJ},
                 {SUBJ, PRED,  OBJ},
        });
    }

    @BeforeClass
    public static void setup() throws Exception {
        explicitSail = new HBaseSail(HBaseServerTestInstance.getInstanceConfig(), "testAddRemove", true, 0, true, 0, null, null);