Search in sources :

Example 46 with BeforeClass

use of org.junit.BeforeClass in project agera by google.

the class HttpFunctionsTest method onlyOnce.

@BeforeClass
public static void onlyOnce() throws Throwable {
    mockHttpURLConnection = mock(HttpURLConnection.class);
    URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory() {

        @Override
        public URLStreamHandler createURLStreamHandler(final String s) {
            return s.equals(TEST_PROTOCOL) ? new URLStreamHandler() {

                @Override
                protected URLConnection openConnection(final URL url) throws IOException {
                    return mockHttpURLConnection;
                }
            } : null;
        }
    });
}
Also used : URLStreamHandler(java.net.URLStreamHandler) HttpURLConnection(java.net.HttpURLConnection) URLStreamHandlerFactory(java.net.URLStreamHandlerFactory) Matchers.anyString(org.mockito.Matchers.anyString) URL(java.net.URL) BeforeClass(org.junit.BeforeClass)

Example 47 with BeforeClass

use of org.junit.BeforeClass in project Gaffer by gchq.

the class AccumuloRangeIDRetrieverTest method setup.

@BeforeClass
public static void setup() throws StoreException, IOException {
    byteEntityStore = new MockAccumuloStore();
    gaffer1KeyStore = new MockAccumuloStore();
    byteEntityStore.initialise(schema, PROPERTIES);
    gaffer1KeyStore.initialise(schema, CLASSIC_PROPERTIES);
    defaultView = new View.Builder().edge(TestGroups.EDGE).entity(TestGroups.ENTITY).build();
    setupGraph(byteEntityStore, numEntries);
    setupGraph(gaffer1KeyStore, numEntries);
}
Also used : MockAccumuloStore(uk.gov.gchq.gaffer.accumulostore.MockAccumuloStore) BeforeClass(org.junit.BeforeClass)

Example 48 with BeforeClass

use of org.junit.BeforeClass in project Gaffer by gchq.

the class GetElementsWithinSetHandlerTest method setup.

@BeforeClass
public static void setup() throws StoreException, IOException {
    byteEntityStore = new SingleUseMockAccumuloStore();
    gaffer1KeyStore = new SingleUseMockAccumuloStore();
}
Also used : SingleUseMockAccumuloStore(uk.gov.gchq.gaffer.accumulostore.SingleUseMockAccumuloStore) BeforeClass(org.junit.BeforeClass)

Example 49 with BeforeClass

use of org.junit.BeforeClass in project hazelcast by hazelcast.

the class CacheReadQuorumTest method initialize.

@BeforeClass
public static void initialize() throws Exception {
    CacheSimpleConfig cacheConfig = new CacheSimpleConfig();
    cacheConfig.setName(CACHE_NAME_PREFIX + "*");
    cacheConfig.setQuorumName(QUORUM_ID);
    QuorumConfig quorumConfig = new QuorumConfig();
    quorumConfig.setName(QUORUM_ID);
    quorumConfig.setType(QuorumType.READ);
    quorumConfig.setEnabled(true);
    quorumConfig.setSize(3);
    PartitionedCluster cluster = new PartitionedCluster(new TestHazelcastInstanceFactory()).partitionFiveMembersThreeAndTwo(cacheConfig, quorumConfig);
    cachingProvider1 = HazelcastServerCachingProvider.createCachingProvider(cluster.h1);
    cachingProvider2 = HazelcastServerCachingProvider.createCachingProvider(cluster.h2);
    cachingProvider3 = HazelcastServerCachingProvider.createCachingProvider(cluster.h3);
    cachingProvider4 = HazelcastServerCachingProvider.createCachingProvider(cluster.h4);
    cachingProvider5 = HazelcastServerCachingProvider.createCachingProvider(cluster.h5);
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) PartitionedCluster(com.hazelcast.quorum.PartitionedCluster) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) BeforeClass(org.junit.BeforeClass)

Example 50 with BeforeClass

use of org.junit.BeforeClass in project hazelcast by hazelcast.

the class CacheReadWriteQuorumTest method initialize.

@BeforeClass
public static void initialize() throws Exception {
    CacheSimpleConfig cacheConfig = new CacheSimpleConfig();
    cacheConfig.setName(CACHE_NAME_PREFIX + "*");
    cacheConfig.setQuorumName(QUORUM_ID);
    QuorumConfig quorumConfig = new QuorumConfig();
    quorumConfig.setName(QUORUM_ID);
    quorumConfig.setType(QuorumType.READ_WRITE);
    quorumConfig.setEnabled(true);
    quorumConfig.setSize(3);
    PartitionedCluster cluster = new PartitionedCluster(new TestHazelcastInstanceFactory()).partitionFiveMembersThreeAndTwo(cacheConfig, quorumConfig);
    cachingProvider1 = HazelcastServerCachingProvider.createCachingProvider(cluster.h1);
    cachingProvider2 = HazelcastServerCachingProvider.createCachingProvider(cluster.h2);
    cachingProvider3 = HazelcastServerCachingProvider.createCachingProvider(cluster.h3);
    cachingProvider4 = HazelcastServerCachingProvider.createCachingProvider(cluster.h4);
    cachingProvider5 = HazelcastServerCachingProvider.createCachingProvider(cluster.h5);
}
Also used : QuorumConfig(com.hazelcast.config.QuorumConfig) CacheSimpleConfig(com.hazelcast.config.CacheSimpleConfig) PartitionedCluster(com.hazelcast.quorum.PartitionedCluster) TestHazelcastInstanceFactory(com.hazelcast.test.TestHazelcastInstanceFactory) BeforeClass(org.junit.BeforeClass)

Aggregations

BeforeClass (org.junit.BeforeClass)2813 File (java.io.File)388 Configuration (org.apache.hadoop.conf.Configuration)287 IOException (java.io.IOException)128 Connection (java.sql.Connection)126 Properties (java.util.Properties)108 Reader (java.io.Reader)99 SqlSessionFactoryBuilder (org.apache.ibatis.session.SqlSessionFactoryBuilder)98 Provisioning (com.zimbra.cs.account.Provisioning)93 ScriptRunner (org.apache.ibatis.jdbc.ScriptRunner)91 HiveConf (org.apache.hadoop.hive.conf.HiveConf)86 MockProvisioning (com.zimbra.cs.account.MockProvisioning)77 Path (org.apache.hadoop.fs.Path)75 URI (java.net.URI)73 HashMap (java.util.HashMap)70 URL (java.net.URL)63 SqlSession (org.apache.ibatis.session.SqlSession)62 MiniDFSCluster (org.apache.hadoop.hdfs.MiniDFSCluster)61 Injector (com.google.inject.Injector)57 CConfiguration (co.cask.cdap.common.conf.CConfiguration)56