@Inject public LocalDataSegmentKiller(LocalDataSegmentPusherConfig config) { this.storageDirectory = config.getStorageDirectory(); }
@Test public void testKillUniquePath() throws Exception { final LocalDataSegmentKiller killer = new LocalDataSegmentKiller(new LocalDataSegmentPusherConfig()); final String uuid = UUID.randomUUID().toString().substring(0, 5); final File dataSourceDir = temporaryFolder.newFolder("dataSource"); final File intervalDir = new File(dataSourceDir, "interval"); final File versionDir = new File(intervalDir, "1"); final File partitionDir = new File(versionDir, "0"); final File uuidDir = new File(partitionDir, uuid); makePartitionDirWithIndex(uuidDir); killer.kill(getSegmentWithPath(new File(uuidDir, "index.zip").toString())); Assert.assertFalse(uuidDir.exists()); Assert.assertFalse(partitionDir.exists()); Assert.assertFalse(versionDir.exists()); Assert.assertFalse(intervalDir.exists()); Assert.assertFalse(dataSourceDir.exists()); }
@Test public void testKill() throws Exception LocalDataSegmentKiller killer = new LocalDataSegmentKiller(new LocalDataSegmentPusherConfig());
@Override public String getPathForHadoop() { return config.getStorageDirectory().getAbsoluteFile().toURI().toString(); }
@Before public void setUp() throws IOException { config = new LocalDataSegmentPusherConfig(); config.storageDirectory = temporaryFolder.newFolder(); localDataSegmentPusher = new LocalDataSegmentPusher(config, TestHelper.makeJsonMapper()); dataSegmentFiles = temporaryFolder.newFolder(); Files.asByteSink(new File(dataSegmentFiles, "version.bin")).write(Ints.toByteArray(0x9)); }
throws IOException final File baseStorageDir = config.getStorageDirectory(); final File outDir = new File(baseStorageDir, this.getStorageDir(segment, useUniquePath));
emitter, dataSegmentPusher, new LocalDataSegmentKiller(new LocalDataSegmentPusherConfig()), new DataSegmentMover()
@Test public void testPush() throws IOException { /* DataSegment - Used to create LoadSpec and Create outDir (Local Deep Storage location in this case) File dataSegmentFile - Used to get location of segment files like version.bin, meta.smoosh and xxxxx.smoosh */ final DataSegment dataSegment2 = dataSegment.withVersion("v2"); DataSegment returnSegment1 = localDataSegmentPusher.push(dataSegmentFiles, dataSegment, false); DataSegment returnSegment2 = localDataSegmentPusher.push(dataSegmentFiles, dataSegment2, false); Assert.assertNotNull(returnSegment1); Assert.assertEquals(dataSegment, returnSegment1); Assert.assertNotNull(returnSegment2); Assert.assertEquals(dataSegment2, returnSegment2); Assert.assertNotEquals( localDataSegmentPusher.getStorageDir(dataSegment, false), localDataSegmentPusher.getStorageDir(dataSegment2, false) ); for (DataSegment returnSegment : ImmutableList.of(returnSegment1, returnSegment2)) { File outDir = new File( config.getStorageDirectory(), localDataSegmentPusher.getStorageDir(returnSegment, false) ); File versionFile = new File(outDir, "index.zip"); File descriptorJson = new File(outDir, "descriptor.json"); Assert.assertTrue(versionFile.exists()); Assert.assertTrue(descriptorJson.exists()); } }
@Inject public LocalDataSegmentKiller(LocalDataSegmentPusherConfig config) { this.storageDirectory = config.getStorageDirectory(); }
@Override public String getPathForHadoop() { return config.getStorageDirectory().getAbsoluteFile().toURI().toString(); }
throws IOException final File baseStorageDir = config.getStorageDirectory(); final File outDir = new File(baseStorageDir, this.getStorageDir(segment, useUniquePath));