Java tutorial
/** * Copyright 2015 StreamSets Inc. * * Licensed under 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.streamsets.datacollector.execution.snapshot; import com.streamsets.datacollector.execution.SnapshotStore; import com.streamsets.datacollector.execution.snapshot.cache.CacheSnapshotStore; import com.streamsets.datacollector.execution.snapshot.cache.dagger.CacheSnapshotStoreModule; import com.streamsets.datacollector.main.RuntimeInfo; import com.streamsets.datacollector.main.RuntimeModule; import dagger.ObjectGraph; import org.apache.commons.io.FileUtils; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import java.io.File; import java.io.IOException; public class TestCacheSnapshotStore extends TestSnapshotStore { @BeforeClass public static void beforeClass() { System.setProperty(RuntimeModule.SDC_PROPERTY_PREFIX + RuntimeInfo.DATA_DIR, "./target/var"); } @AfterClass public static void afterClass() { System.getProperties().remove(RuntimeModule.SDC_PROPERTY_PREFIX + RuntimeInfo.DATA_DIR); } @Before public void setUp() throws IOException { File f = new File(System.getProperty(RuntimeModule.SDC_PROPERTY_PREFIX + RuntimeInfo.DATA_DIR)); FileUtils.deleteDirectory(f); ObjectGraph objectGraph = ObjectGraph.create(CacheSnapshotStoreModule.class); snapshotStore = objectGraph.get(SnapshotStore.class); } @After public void tearDown() { } @Test public void testCheckStoreImplementation() { Assert.assertTrue(snapshotStore instanceof CacheSnapshotStore); } }