use of org.junit.rules.TemporaryFolder in project flink by apache.
the class StreamOperatorSnapshotRestoreTest method beforeClass.
@BeforeClass
public static void beforeClass() throws IOException {
temporaryFolder = new TemporaryFolder();
temporaryFolder.create();
}
use of org.junit.rules.TemporaryFolder in project flink by apache.
the class TaskStateManagerImplTest method testForwardingSubtaskLocalStateBaseDirFromLocalStateStore.
/**
* This tests if the {@link TaskStateManager} properly returns the subtask local state dir from
* the corresponding {@link TaskLocalStateStoreImpl}.
*/
@Test
public void testForwardingSubtaskLocalStateBaseDirFromLocalStateStore() throws IOException {
JobID jobID = new JobID(42L, 43L);
AllocationID allocationID = new AllocationID(4711L, 23L);
JobVertexID jobVertexID = new JobVertexID(12L, 34L);
ExecutionAttemptID executionAttemptID = new ExecutionAttemptID();
TestCheckpointResponder checkpointResponderMock = new TestCheckpointResponder();
Executor directExecutor = Executors.directExecutor();
TemporaryFolder tmpFolder = new TemporaryFolder();
try {
tmpFolder.create();
File[] allocBaseDirs = new File[] { tmpFolder.newFolder(), tmpFolder.newFolder(), tmpFolder.newFolder() };
LocalRecoveryDirectoryProviderImpl directoryProvider = new LocalRecoveryDirectoryProviderImpl(allocBaseDirs, jobID, jobVertexID, 0);
LocalRecoveryConfig localRecoveryConfig = new LocalRecoveryConfig(directoryProvider);
TaskLocalStateStore taskLocalStateStore = new TaskLocalStateStoreImpl(jobID, allocationID, jobVertexID, 13, localRecoveryConfig, directExecutor);
InMemoryStateChangelogStorage changelogStorage = new InMemoryStateChangelogStorage();
TaskStateManager taskStateManager = taskStateManager(jobID, executionAttemptID, checkpointResponderMock, null, taskLocalStateStore, changelogStorage);
LocalRecoveryConfig localRecoveryConfFromTaskLocalStateStore = taskLocalStateStore.getLocalRecoveryConfig();
LocalRecoveryConfig localRecoveryConfFromTaskStateManager = taskStateManager.createLocalRecoveryConfig();
for (int i = 0; i < 10; ++i) {
Assert.assertEquals(allocBaseDirs[i % allocBaseDirs.length], localRecoveryConfFromTaskLocalStateStore.getLocalStateDirectoryProvider().get().allocationBaseDirectory(i));
Assert.assertEquals(allocBaseDirs[i % allocBaseDirs.length], localRecoveryConfFromTaskStateManager.getLocalStateDirectoryProvider().get().allocationBaseDirectory(i));
}
Assert.assertEquals(localRecoveryConfFromTaskLocalStateStore.isLocalRecoveryEnabled(), localRecoveryConfFromTaskStateManager.isLocalRecoveryEnabled());
} finally {
tmpFolder.delete();
}
}
use of org.junit.rules.TemporaryFolder in project flink by apache.
the class CheckpointStreamWithResultProviderTest method beforeClass.
@BeforeClass
public static void beforeClass() throws IOException {
temporaryFolder = new TemporaryFolder();
temporaryFolder.create();
}
use of org.junit.rules.TemporaryFolder in project flink by apache.
the class RocksDBResource method before.
@Override
protected void before() throws Throwable {
this.temporaryFolder = new TemporaryFolder();
this.temporaryFolder.create();
final File rocksFolder = temporaryFolder.newFolder();
this.dbOptions = optionsFactory.createDBOptions(new DBOptions().setUseFsync(false).setInfoLogLevel(InfoLogLevel.HEADER_LEVEL).setStatsDumpPeriodSec(0), handlesToClose).setCreateIfMissing(true);
this.columnFamilyOptions = optionsFactory.createColumnOptions(new ColumnFamilyOptions(), handlesToClose);
this.writeOptions = new WriteOptions();
this.writeOptions.disableWAL();
this.readOptions = new ReadOptions();
this.columnFamilyHandles = new ArrayList<>(1);
this.rocksDB = RocksDB.open(dbOptions, rocksFolder.getAbsolutePath(), Collections.singletonList(new ColumnFamilyDescriptor("default".getBytes(), columnFamilyOptions)), columnFamilyHandles);
this.batchWrapper = new RocksDBWriteBatchWrapper(rocksDB, writeOptions);
}
use of org.junit.rules.TemporaryFolder in project indy by Commonjava.
the class TestProvider method setup.
@PostConstruct
public void setup() {
storeDataManager = new MemoryStoreDataManager(true);
nfc = new MemoryNotFoundCache();
objectMapper = new IndyObjectMapper(false);
fileEventManager = new NoOpFileEventManager();
transferDecorator = new NoOpTransferDecorator();
transportManagerConfig = new TransportManagerConfig();
weftConfig = new DefaultWeftConfig();
globalHttpConfiguration = new GlobalHttpConfiguration();
userLifecycleManager = new AlternativeUserLifecycleManager();
temp = new TemporaryFolder();
try {
temp.create();
cacheProvider = new FileCacheProvider(temp.newFolder("storage"), indyPathGenerator, fileEventManager, new TransferDecoratorManager(transferDecorator));
} catch (IOException e) {
fail("Cannot initialize temporary directory structure");
temp.delete();
}
}
Aggregations