@Test public void testBuildFromSegKey() { SourceKey tableKey = new SourceKey("table1"); SwiftDatabase swiftSchema = SwiftDatabase.CUBE; int segOrder = 10; SegmentKey segKey = EasyMock.mock(SegmentKey.class); EasyMock.expect(segKey.getSwiftSchema()).andReturn(swiftSchema).anyTimes(); EasyMock.expect(segKey.getTable()).andReturn(tableKey).anyTimes(); EasyMock.expect(segKey.getOrder()).andReturn(segOrder).anyTimes(); EasyMock.replay(segKey); String path = new CubePathBuilder(segKey).build(); Assert.assertEquals(String.format("%s/%s/seg%d", swiftSchema.getDir(), tableKey, segOrder), path); }
public String build() { Assert.notNull(schema); Assert.isFalse(tempDir != null && backup, "tempDir is not allowed when backup is present, vice versa"); StringBuilder path = new StringBuilder(); if (absolute) { path.append(PATH_SVC.getSwiftPath()).append('/'); } path.append(backup ? schema.getBackupDir() : schema.getDir()); if (tempDir != null) { path.append('/').append(tempDir); } if (tableKey != null) { path.append('/').append(tableKey.getId()); } if (segOrder != null) { path.append("/seg").append(segOrder); } if (columnId != null) { path.append('/').append(columnId); } return path.toString(); }
CubePathBuilder { public String build() { Assert.notNull(schema); Assert.isFalse(tempDir != null && backup, "tempDir is not allowed when backup is present, vice versa"); StringBuilder path = new StringBuilder(); if (absolute) { path.append(PATH_SVC.getSwiftPath()).append('/'); } path.append(backup ? schema.getBackupDir() : schema.getDir()); if (tempDir != null) { path.append('/').append(tempDir); } if (tableKey != null) { path.append('/').append(tableKey.getId()); } if (segOrder != null) { path.append("/seg").append(segOrder); } if (columnId != null) { path.append('/').append(columnId); } return path.toString(); } }
CubePathBuilder { public String build() { Assert.notNull(schema); Assert.isFalse(tempDir != null && backup, "tempDir is not allowed when backup is present, vice versa"); StringBuilder path = new StringBuilder(); if (absolute) { path.append(PATH_SVC.getSwiftPath()).append('/'); } path.append(backup ? schema.getBackupDir() : schema.getDir()); if (tempDir != null) { path.append('/').append(tempDir); } if (tableKey != null) { path.append('/').append(tableKey.getId()); } if (segOrder != null) { path.append("/seg").append(segOrder); } if (columnId != null) { path.append('/').append(columnId); } return path.toString(); } CubePathBuilder();  CubePathBuilder(SegmentKey segKey); }
CubePathBuilder { public String build() { Assert.notNull(schema); Assert.isFalse(tempDir != null && backup, "tempDir is not allowed when backup is present, vice versa"); StringBuilder path = new StringBuilder(); if (absolute) { path.append(PATH_SVC.getSwiftPath()).append('/'); } path.append(backup ? schema.getBackupDir() : schema.getDir()); if (tempDir != null) { path.append('/').append(tempDir); } if (tableKey != null) { path.append('/').append(tableKey.getId()); } if (segOrder != null) { path.append("/seg").append(segOrder); } if (columnId != null) { path.append('/').append(columnId); } return path.toString(); } CubePathBuilder();  CubePathBuilder(SegmentKey segKey); CubePathBuilder asAbsolute(); CubePathBuilder setSwiftSchema(SwiftDatabase schema); CubePathBuilder setTempDir(int tempDir); CubePathBuilder asBackup(); CubePathBuilder setTableKey(SourceKey tableKey); CubePathBuilder setSegOrder(int segOrder); CubePathBuilder setColumnId(String columnId); String build(); @Override String toString(); }
CubePathBuilder { public String build() { Assert.notNull(schema); Assert.isFalse(tempDir != null && backup, "tempDir is not allowed when backup is present, vice versa"); StringBuilder path = new StringBuilder(); if (absolute) { path.append(PATH_SVC.getSwiftPath()).append('/'); } path.append(backup ? schema.getBackupDir() : schema.getDir()); if (tempDir != null) { path.append('/').append(tempDir); } if (tableKey != null) { path.append('/').append(tableKey.getId()); } if (segOrder != null) { path.append("/seg").append(segOrder); } if (columnId != null) { path.append('/').append(columnId); } return path.toString(); } CubePathBuilder();  CubePathBuilder(SegmentKey segKey); CubePathBuilder asAbsolute(); CubePathBuilder setSwiftSchema(SwiftDatabase schema); CubePathBuilder setTempDir(int tempDir); CubePathBuilder asBackup(); CubePathBuilder setTableKey(SourceKey tableKey); CubePathBuilder setSegOrder(int segOrder); CubePathBuilder setColumnId(String columnId); String build(); @Override String toString();  }