target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void test3() throws MDCSyntaxError { String mdc = "3"; MDCCodeExtractor extractor= new MDCCodeExtractor(); List<String> codeList = extractor.getCodesAsList(mdc); assertEquals(Arrays.asList("3"), codeList); } | public List<String> getCodesAsList(String manuelDeCodageText) throws MDCSyntaxError { SignListBuilder builder = new SignListBuilder(); MDCParserFacade parser = new MDCParserFacade(builder); parser.parse(new StringReader(manuelDeCodageText)); return builder.result; } | MDCCodeExtractor { public List<String> getCodesAsList(String manuelDeCodageText) throws MDCSyntaxError { SignListBuilder builder = new SignListBuilder(); MDCParserFacade parser = new MDCParserFacade(builder); parser.parse(new StringReader(manuelDeCodageText)); return builder.result; } } | MDCCodeExtractor { public List<String> getCodesAsList(String manuelDeCodageText) throws MDCSyntaxError { SignListBuilder builder = new SignListBuilder(); MDCParserFacade parser = new MDCParserFacade(builder); parser.parse(new StringReader(manuelDeCodageText)); return builder.result; } } | MDCCodeExtractor { public List<String> getCodesAsList(String manuelDeCodageText) throws MDCSyntaxError { SignListBuilder builder = new SignListBuilder(); MDCParserFacade parser = new MDCParserFacade(builder); parser.parse(new StringReader(manuelDeCodageText)); return builder.result; } String[] getCodes(String manuelDe... | MDCCodeExtractor { public List<String> getCodesAsList(String manuelDeCodageText) throws MDCSyntaxError { SignListBuilder builder = new SignListBuilder(); MDCParserFacade parser = new MDCParserFacade(builder); parser.parse(new StringReader(manuelDeCodageText)); return builder.result; } String[] getCodes(String manuelDe... |
@Test public void testMatchSecondA() { List<Integer> res = textAndPosition.match("f"); assertEquals(Arrays.asList(11), res); } | public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos); found++; } retu... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... |
@Test public void testMatchSecondB() { List<Integer> res = textAndPosition.match("fg"); assertEquals(Arrays.asList(11), res); } | public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos); found++; } retu... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... |
@Test public void testMatchSecondC() { List<Integer> res = textAndPosition.match("g"); assertEquals(Arrays.asList(11), res); } | public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos); found++; } retu... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... |
@Test public void testMatchLastA() { List<Integer> res = textAndPosition.match("hi"); assertEquals(Arrays.asList(12), res); } | public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos); found++; } retu... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... |
@Test public void testMatchLastB() { List<Integer> res = textAndPosition.match("h"); assertEquals(Arrays.asList(12), res); } | public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos); found++; } retu... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... |
@Test public void testMatchLastC() { List<Integer> res = textAndPosition.match("i"); assertEquals(Arrays.asList(12), res); } | public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos); found++; } retu... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... |
@Test public void testMatchOverlap() { List<Integer> res = textAndPosition.match("ghi"); assertEquals(Arrays.asList(11), res); } | public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos); found++; } retu... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... |
@Test public void testMatchOverlapA() { List<Integer> res = textAndPosition.match("efghi"); assertEquals(Arrays.asList(10), res); } | public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos); found++; } retu... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... |
@Test public void testMatchOverlapAll() { List<Integer> res = textAndPosition.match("abcdefghi"); assertEquals(Arrays.asList(10), res); } | public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos); found++; } retu... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... | TextAndPosition { public List<Integer> match(String toMatch) { toMatch = toMatch.toLowerCase(); ArrayList<Integer> result= new ArrayList<>(); if (toMatch.length() == 0) return result; int found = 0; while ((found = content.indexOf(toMatch, found)) != -1 ) { int actualPos = convertIndexToPos(found); result.add(actualPos... |
@Test public void testGetViewMap() throws SQLException { ViewMapVO viewMapForView = dao.getViewMapForView(testRegister, testDatatype, 1); assertNotNull(viewMapForView); assertEquals(testRegister, viewMapForView.getRegister()); assertEquals(testDatatype, viewMapForView.getDatatype()); assertEquals(1, viewMapForView.getV... | public ViewMapVO getViewMapForView(String register, String dataType, long version) throws SQLException { String sql = "SELECT idSKRSViewMapping,tableName,createdDate FROM SKRSViewMapping WHERE register=? AND " + "datatype=? AND version=?"; ArrayListHandler handler = new ArrayListHandler(); QueryRunner qr = new QueryRun... | DynamicViewDAO { public ViewMapVO getViewMapForView(String register, String dataType, long version) throws SQLException { String sql = "SELECT idSKRSViewMapping,tableName,createdDate FROM SKRSViewMapping WHERE register=? AND " + "datatype=? AND version=?"; ArrayListHandler handler = new ArrayListHandler(); QueryRunner ... | DynamicViewDAO { public ViewMapVO getViewMapForView(String register, String dataType, long version) throws SQLException { String sql = "SELECT idSKRSViewMapping,tableName,createdDate FROM SKRSViewMapping WHERE register=? AND " + "datatype=? AND version=?"; ArrayListHandler handler = new ArrayListHandler(); QueryRunner ... | DynamicViewDAO { public ViewMapVO getViewMapForView(String register, String dataType, long version) throws SQLException { String sql = "SELECT idSKRSViewMapping,tableName,createdDate FROM SKRSViewMapping WHERE register=? AND " + "datatype=? AND version=?"; ArrayListHandler handler = new ArrayListHandler(); QueryRunner ... | DynamicViewDAO { public ViewMapVO getViewMapForView(String register, String dataType, long version) throws SQLException { String sql = "SELECT idSKRSViewMapping,tableName,createdDate FROM SKRSViewMapping WHERE register=? AND " + "datatype=? AND version=?"; ArrayListHandler handler = new ArrayListHandler(); QueryRunner ... |
@Test public void testBasicParserWithoutHeaders() throws CprAbbsException { CprAbbsResponseParser parser = new CprAbbsResponseParser(); List<String> extractCprNumbers = parser.extractCprNumbersWithoutHeaders(exampleSoapResponse); assertEquals(2, extractCprNumbers.size()); assertEquals("0101822231", extractCprNumbers.ge... | public List<String> extractCprNumbersWithoutHeaders(String soapResponse) throws CprAbbsException { try { Document document = createDomTree(soapResponse); NodeList nodeList = extractChangedCprsNodes(document); return convertNodeListToCprStrings(nodeList); } catch (Exception e) { throw new CprAbbsException(e); } } | CprAbbsResponseParser { public List<String> extractCprNumbersWithoutHeaders(String soapResponse) throws CprAbbsException { try { Document document = createDomTree(soapResponse); NodeList nodeList = extractChangedCprsNodes(document); return convertNodeListToCprStrings(nodeList); } catch (Exception e) { throw new CprAbbs... | CprAbbsResponseParser { public List<String> extractCprNumbersWithoutHeaders(String soapResponse) throws CprAbbsException { try { Document document = createDomTree(soapResponse); NodeList nodeList = extractChangedCprsNodes(document); return convertNodeListToCprStrings(nodeList); } catch (Exception e) { throw new CprAbbs... | CprAbbsResponseParser { public List<String> extractCprNumbersWithoutHeaders(String soapResponse) throws CprAbbsException { try { Document document = createDomTree(soapResponse); NodeList nodeList = extractChangedCprsNodes(document); return convertNodeListToCprStrings(nodeList); } catch (Exception e) { throw new CprAbbs... | CprAbbsResponseParser { public List<String> extractCprNumbersWithoutHeaders(String soapResponse) throws CprAbbsException { try { Document document = createDomTree(soapResponse); NodeList nodeList = extractChangedCprsNodes(document); return convertNodeListToCprStrings(nodeList); } catch (Exception e) { throw new CprAbbs... |
@Test public void testBasicParser() throws CprAbbsException { CprAbbsResponseParser parser = new CprAbbsResponseParser(); List<String> extractCprNumbers = parser.extractCprNumbers(exampleResponseWithHeaders); assertEquals(2, extractCprNumbers.size()); assertEquals("0101822231", extractCprNumbers.get(0)); assertEquals("... | public List<String> extractCprNumbers(String soapResponse) throws CprAbbsException { int start = soapResponse.indexOf("<?xml"); if(start == -1) { throw new CprAbbsException("Invalid message body on call to CPR Abbs"); } String soapResponseWithoutHeader = soapResponse.substring(start); return extractCprNumbersWithoutHea... | CprAbbsResponseParser { public List<String> extractCprNumbers(String soapResponse) throws CprAbbsException { int start = soapResponse.indexOf("<?xml"); if(start == -1) { throw new CprAbbsException("Invalid message body on call to CPR Abbs"); } String soapResponseWithoutHeader = soapResponse.substring(start); return ext... | CprAbbsResponseParser { public List<String> extractCprNumbers(String soapResponse) throws CprAbbsException { int start = soapResponse.indexOf("<?xml"); if(start == -1) { throw new CprAbbsException("Invalid message body on call to CPR Abbs"); } String soapResponseWithoutHeader = soapResponse.substring(start); return ext... | CprAbbsResponseParser { public List<String> extractCprNumbers(String soapResponse) throws CprAbbsException { int start = soapResponse.indexOf("<?xml"); if(start == -1) { throw new CprAbbsException("Invalid message body on call to CPR Abbs"); } String soapResponseWithoutHeader = soapResponse.substring(start); return ext... | CprAbbsResponseParser { public List<String> extractCprNumbers(String soapResponse) throws CprAbbsException { int start = soapResponse.indexOf("<?xml"); if(start == -1) { throw new CprAbbsException("Invalid message body on call to CPR Abbs"); } String soapResponseWithoutHeader = soapResponse.substring(start); return ext... |
@Test public void useCorrectReplicaTableName() throws Exception { ReplicaHiveEndpoint replicaDiffEndpoint = new ReplicaHiveEndpoint("name", hiveConf, metastoreSupplier); when(metastoreSupplier.get()).thenReturn(metastoreClient); when(metastoreClient.getTable("dbname", "tableName")).thenReturn(table); when(table.getSd()... | @Override public TableAndStatistics getTableAndStatistics(TableReplication tableReplication) { return super.getTableAndStatistics(tableReplication.getReplicaDatabaseName(), tableReplication.getReplicaTableName()); } | ReplicaHiveEndpoint extends HiveEndpoint { @Override public TableAndStatistics getTableAndStatistics(TableReplication tableReplication) { return super.getTableAndStatistics(tableReplication.getReplicaDatabaseName(), tableReplication.getReplicaTableName()); } } | ReplicaHiveEndpoint extends HiveEndpoint { @Override public TableAndStatistics getTableAndStatistics(TableReplication tableReplication) { return super.getTableAndStatistics(tableReplication.getReplicaDatabaseName(), tableReplication.getReplicaTableName()); } ReplicaHiveEndpoint(
String name,
HiveConf hiveCo... | ReplicaHiveEndpoint extends HiveEndpoint { @Override public TableAndStatistics getTableAndStatistics(TableReplication tableReplication) { return super.getTableAndStatistics(tableReplication.getReplicaDatabaseName(), tableReplication.getReplicaTableName()); } ReplicaHiveEndpoint(
String name,
HiveConf hiveCo... | ReplicaHiveEndpoint extends HiveEndpoint { @Override public TableAndStatistics getTableAndStatistics(TableReplication tableReplication) { return super.getTableAndStatistics(tableReplication.getReplicaDatabaseName(), tableReplication.getReplicaTableName()); } ReplicaHiveEndpoint(
String name,
HiveConf hiveCo... |
@Test public void transformOverride() throws Exception { Map<String, Object> avroOverrideOptions = new HashMap<>(); avroOverrideOptions.put(AvroSerDeConfig.BASE_URL, "schemaOverride"); Map<String, Object> transformOptions = new HashMap<>(); transformOptions.put(AvroSerDeConfig.AVRO_SERDE_OPTIONS, avroOverrideOptions); ... | @Override public Partition transform(Partition partition) { if (avroTransformationSpecified()) { partition = apply(partition, avroDestination(getAvroSchemaDestinationFolder(), getEventId(), getTableLocation())); } return partition; } | AvroSerDePartitionTransformation extends AbstractAvroSerDeTransformation implements PartitionTransformation { @Override public Partition transform(Partition partition) { if (avroTransformationSpecified()) { partition = apply(partition, avroDestination(getAvroSchemaDestinationFolder(), getEventId(), getTableLocation()))... | AvroSerDePartitionTransformation extends AbstractAvroSerDeTransformation implements PartitionTransformation { @Override public Partition transform(Partition partition) { if (avroTransformationSpecified()) { partition = apply(partition, avroDestination(getAvroSchemaDestinationFolder(), getEventId(), getTableLocation()))... | AvroSerDePartitionTransformation extends AbstractAvroSerDeTransformation implements PartitionTransformation { @Override public Partition transform(Partition partition) { if (avroTransformationSpecified()) { partition = apply(partition, avroDestination(getAvroSchemaDestinationFolder(), getEventId(), getTableLocation()))... | AvroSerDePartitionTransformation extends AbstractAvroSerDeTransformation implements PartitionTransformation { @Override public Partition transform(Partition partition) { if (avroTransformationSpecified()) { partition = apply(partition, avroDestination(getAvroSchemaDestinationFolder(), getEventId(), getTableLocation()))... |
@Test public void applyTable() throws Exception { File srcSchemaFile = temporaryFolder.newFile(); File dstFolder = temporaryFolder.newFolder(); table.putToParameters("avro.schema.url", srcSchemaFile.toString()); table = avroSerDeTransformation.apply(table, dstFolder.toString(), "1"); String replicaBasePath = table.getP... | Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(AVRO_SCHEMA_URL_PARAMETER)... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... |
@Test public void applyPartition() throws Exception { File srcSchemaFile = temporaryFolder.newFile(); File dstFolder = temporaryFolder.newFolder(); partition.putToParameters("avro.schema.url", srcSchemaFile.toString()); partition = avroSerDeTransformation.apply(partition, dstFolder.toString(), "1"); String replicaBaseP... | Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(AVRO_SCHEMA_URL_PARAMETER)... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... |
@Test public void getAvroSchemaFileName() throws Exception { String dummyUri = "testing/avro.avsc"; assertThat(avroSerDeTransformation.getAvroSchemaFileName(dummyUri), is("avro.avsc")); } | @VisibleForTesting String getAvroSchemaFileName(String avroSchemaSource) { if (avroSchemaSource == null) { return ""; } return avroSchemaSource.substring(avroSchemaSource.lastIndexOf("/") + 1, avroSchemaSource.length()); } | AvroSerDeTransformation { @VisibleForTesting String getAvroSchemaFileName(String avroSchemaSource) { if (avroSchemaSource == null) { return ""; } return avroSchemaSource.substring(avroSchemaSource.lastIndexOf("/") + 1, avroSchemaSource.length()); } } | AvroSerDeTransformation { @VisibleForTesting String getAvroSchemaFileName(String avroSchemaSource) { if (avroSchemaSource == null) { return ""; } return avroSchemaSource.substring(avroSchemaSource.lastIndexOf("/") + 1, avroSchemaSource.length()); } @Autowired AvroSerDeTransformation(HiveConf sourceHiveConf, HiveConf r... | AvroSerDeTransformation { @VisibleForTesting String getAvroSchemaFileName(String avroSchemaSource) { if (avroSchemaSource == null) { return ""; } return avroSchemaSource.substring(avroSchemaSource.lastIndexOf("/") + 1, avroSchemaSource.length()); } @Autowired AvroSerDeTransformation(HiveConf sourceHiveConf, HiveConf r... | AvroSerDeTransformation { @VisibleForTesting String getAvroSchemaFileName(String avroSchemaSource) { if (avroSchemaSource == null) { return ""; } return avroSchemaSource.substring(avroSchemaSource.lastIndexOf("/") + 1, avroSchemaSource.length()); } @Autowired AvroSerDeTransformation(HiveConf sourceHiveConf, HiveConf r... |
@Test public void addTrailingSlash() throws Exception { String dummyUri = "testing/avro"; dummyUri = avroSerDeTransformation.addTrailingSlash(dummyUri); assertThat(dummyUri, is("testing/avro/")); } | @VisibleForTesting String addTrailingSlash(String str) { if (str != null && str.charAt(str.length() - 1) != '/') { str += "/"; } return str; } | AvroSerDeTransformation { @VisibleForTesting String addTrailingSlash(String str) { if (str != null && str.charAt(str.length() - 1) != '/') { str += "/"; } return str; } } | AvroSerDeTransformation { @VisibleForTesting String addTrailingSlash(String str) { if (str != null && str.charAt(str.length() - 1) != '/') { str += "/"; } return str; } @Autowired AvroSerDeTransformation(HiveConf sourceHiveConf, HiveConf replicaHiveConf); } | AvroSerDeTransformation { @VisibleForTesting String addTrailingSlash(String str) { if (str != null && str.charAt(str.length() - 1) != '/') { str += "/"; } return str; } @Autowired AvroSerDeTransformation(HiveConf sourceHiveConf, HiveConf replicaHiveConf); } | AvroSerDeTransformation { @VisibleForTesting String addTrailingSlash(String str) { if (str != null && str.charAt(str.length() - 1) != '/') { str += "/"; } return str; } @Autowired AvroSerDeTransformation(HiveConf sourceHiveConf, HiveConf replicaHiveConf); } |
@Test public void addTrailingSlashOnlyAddsOne() throws Exception { String dummyUri = "testing/avro/"; dummyUri = avroSerDeTransformation.addTrailingSlash(dummyUri); assertThat(dummyUri, is("testing/avro/")); } | @VisibleForTesting String addTrailingSlash(String str) { if (str != null && str.charAt(str.length() - 1) != '/') { str += "/"; } return str; } | AvroSerDeTransformation { @VisibleForTesting String addTrailingSlash(String str) { if (str != null && str.charAt(str.length() - 1) != '/') { str += "/"; } return str; } } | AvroSerDeTransformation { @VisibleForTesting String addTrailingSlash(String str) { if (str != null && str.charAt(str.length() - 1) != '/') { str += "/"; } return str; } @Autowired AvroSerDeTransformation(HiveConf sourceHiveConf, HiveConf replicaHiveConf); } | AvroSerDeTransformation { @VisibleForTesting String addTrailingSlash(String str) { if (str != null && str.charAt(str.length() - 1) != '/') { str += "/"; } return str; } @Autowired AvroSerDeTransformation(HiveConf sourceHiveConf, HiveConf replicaHiveConf); } | AvroSerDeTransformation { @VisibleForTesting String addTrailingSlash(String str) { if (str != null && str.charAt(str.length() - 1) != '/') { str += "/"; } return str; } @Autowired AvroSerDeTransformation(HiveConf sourceHiveConf, HiveConf replicaHiveConf); } |
@Test public void nullAvroDestinationFailsInTableApply() throws Exception { table.putToParameters("avro.schema.url", "/test/"); Table result = avroSerDeTransformation.apply(table, null, "1"); assertThat(result, is(table)); } | Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(AVRO_SCHEMA_URL_PARAMETER)... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... |
@Test public void nullAvroDestinationFailsInPartitionApply() throws Exception { partition.putToParameters("avro.schema.url", "/test/"); Partition result = avroSerDeTransformation.apply(partition, null, "1"); assertThat(result, is(partition)); } | Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(AVRO_SCHEMA_URL_PARAMETER)... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... | AvroSerDeTransformation { Table apply(Table table, String avroSchemaDestination, String eventId) throws Exception { if (avroSchemaDestination == null) { return table; } avroSchemaDestination = addTrailingSlash(avroSchemaDestination); avroSchemaDestination += eventId; String avroSchemaSource = table.getParameters().get(... |
@Test(expected = NullPointerException.class) public void unqualifiedTableNameFailsIsSessionIsNotSet() throws Exception { ArrayList<Node> children = new ArrayList<>(); children.add(tableNode); when(node.getChildren()).thenReturn(children); when(node.getChildCount()).thenReturn(children.size()); when(node.getChild(0)).th... | @Override public Object process(Node node, Stack<Node> stack, NodeProcessorCtx procCtx, Object... nodeOutputs) throws SemanticException { ASTNode astNode = (ASTNode) node; if (astNode.getToken() != null && astNode.getToken().getText() != null) { if ("TOK_TABNAME".equals(astNode.getToken().getText())) { tables.add(extra... | TableProcessor implements NodeProcessor { @Override public Object process(Node node, Stack<Node> stack, NodeProcessorCtx procCtx, Object... nodeOutputs) throws SemanticException { ASTNode astNode = (ASTNode) node; if (astNode.getToken() != null && astNode.getToken().getText() != null) { if ("TOK_TABNAME".equals(astNode... | TableProcessor implements NodeProcessor { @Override public Object process(Node node, Stack<Node> stack, NodeProcessorCtx procCtx, Object... nodeOutputs) throws SemanticException { ASTNode astNode = (ASTNode) node; if (astNode.getToken() != null && astNode.getToken().getText() != null) { if ("TOK_TABNAME".equals(astNode... | TableProcessor implements NodeProcessor { @Override public Object process(Node node, Stack<Node> stack, NodeProcessorCtx procCtx, Object... nodeOutputs) throws SemanticException { ASTNode astNode = (ASTNode) node; if (astNode.getToken() != null && astNode.getToken().getText() != null) { if ("TOK_TABNAME".equals(astNode... | TableProcessor implements NodeProcessor { @Override public Object process(Node node, Stack<Node> stack, NodeProcessorCtx procCtx, Object... nodeOutputs) throws SemanticException { ASTNode astNode = (ASTNode) node; if (astNode.getToken() != null && astNode.getToken().getText() != null) { if ("TOK_TABNAME".equals(astNode... |
@Test public void unescapedOriginalName() { assertThat(tableTranslation.toUnescapedQualifiedOriginalName(), is("odb.o_table")); } | String toUnescapedQualifiedOriginalName() { return toUnescapedQualifiedName(originalDatabaseName, originalTableName); } | TableTranslation { String toUnescapedQualifiedOriginalName() { return toUnescapedQualifiedName(originalDatabaseName, originalTableName); } } | TableTranslation { String toUnescapedQualifiedOriginalName() { return toUnescapedQualifiedName(originalDatabaseName, originalTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); } | TableTranslation { String toUnescapedQualifiedOriginalName() { return toUnescapedQualifiedName(originalDatabaseName, originalTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Objec... | TableTranslation { String toUnescapedQualifiedOriginalName() { return toUnescapedQualifiedName(originalDatabaseName, originalTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Objec... |
@Test public void getCannedAcl() throws Exception { copierOptions.put(S3S3CopierOptions.Keys.CANNED_ACL.keyName(), CannedAccessControlList.BucketOwnerFullControl.toString()); S3S3CopierOptions options = new S3S3CopierOptions(copierOptions); assertThat(options.getCannedAcl(), is(CannedAccessControlList.BucketOwnerFullCo... | public CannedAccessControlList getCannedAcl() { String cannedAcl = MapUtils.getString(copierOptions, Keys.CANNED_ACL.keyName(), null); if (cannedAcl != null) { return CannedAclUtils.toCannedAccessControlList(cannedAcl); } return null; } | S3S3CopierOptions { public CannedAccessControlList getCannedAcl() { String cannedAcl = MapUtils.getString(copierOptions, Keys.CANNED_ACL.keyName(), null); if (cannedAcl != null) { return CannedAclUtils.toCannedAccessControlList(cannedAcl); } return null; } } | S3S3CopierOptions { public CannedAccessControlList getCannedAcl() { String cannedAcl = MapUtils.getString(copierOptions, Keys.CANNED_ACL.keyName(), null); if (cannedAcl != null) { return CannedAclUtils.toCannedAccessControlList(cannedAcl); } return null; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> cop... | S3S3CopierOptions { public CannedAccessControlList getCannedAcl() { String cannedAcl = MapUtils.getString(copierOptions, Keys.CANNED_ACL.keyName(), null); if (cannedAcl != null) { return CannedAclUtils.toCannedAccessControlList(cannedAcl); } return null; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> cop... | S3S3CopierOptions { public CannedAccessControlList getCannedAcl() { String cannedAcl = MapUtils.getString(copierOptions, Keys.CANNED_ACL.keyName(), null); if (cannedAcl != null) { return CannedAclUtils.toCannedAccessControlList(cannedAcl); } return null; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> cop... |
@Test public void escapedOriginalName() { assertThat(tableTranslation.toEscapedQualifiedOriginalName(), is("`odb`.`o_table`")); } | String toEscapedQualifiedOriginalName() { return toEscapedQualifiedName(originalDatabaseName, originalTableName); } | TableTranslation { String toEscapedQualifiedOriginalName() { return toEscapedQualifiedName(originalDatabaseName, originalTableName); } } | TableTranslation { String toEscapedQualifiedOriginalName() { return toEscapedQualifiedName(originalDatabaseName, originalTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); } | TableTranslation { String toEscapedQualifiedOriginalName() { return toEscapedQualifiedName(originalDatabaseName, originalTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object ob... | TableTranslation { String toEscapedQualifiedOriginalName() { return toEscapedQualifiedName(originalDatabaseName, originalTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object ob... |
@Test public void unescapedReplicaName() { assertThat(tableTranslation.toUnescapedQualifiedReplicaName(), is("rdb.r_table")); } | String toUnescapedQualifiedReplicaName() { return toUnescapedQualifiedName(replicaDatabaseName, replicaTableName); } | TableTranslation { String toUnescapedQualifiedReplicaName() { return toUnescapedQualifiedName(replicaDatabaseName, replicaTableName); } } | TableTranslation { String toUnescapedQualifiedReplicaName() { return toUnescapedQualifiedName(replicaDatabaseName, replicaTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); } | TableTranslation { String toUnescapedQualifiedReplicaName() { return toUnescapedQualifiedName(replicaDatabaseName, replicaTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object o... | TableTranslation { String toUnescapedQualifiedReplicaName() { return toUnescapedQualifiedName(replicaDatabaseName, replicaTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object o... |
@Test public void escapedReplicaName() { assertThat(tableTranslation.toEscapedQualifiedReplicaName(), is("`rdb`.`r_table`")); } | String toEscapedQualifiedReplicaName() { return toEscapedQualifiedName(replicaDatabaseName, replicaTableName); } | TableTranslation { String toEscapedQualifiedReplicaName() { return toEscapedQualifiedName(replicaDatabaseName, replicaTableName); } } | TableTranslation { String toEscapedQualifiedReplicaName() { return toEscapedQualifiedName(replicaDatabaseName, replicaTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); } | TableTranslation { String toEscapedQualifiedReplicaName() { return toEscapedQualifiedName(replicaDatabaseName, replicaTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object obj);... | TableTranslation { String toEscapedQualifiedReplicaName() { return toEscapedQualifiedName(replicaDatabaseName, replicaTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object obj);... |
@Test public void unescapedOriginalTableReference() { assertThat(tableTranslation.toUnescapedOriginalTableReference(), is("o_table.")); } | String toUnescapedOriginalTableReference() { return unescapedTableReference(originalTableName); } | TableTranslation { String toUnescapedOriginalTableReference() { return unescapedTableReference(originalTableName); } } | TableTranslation { String toUnescapedOriginalTableReference() { return unescapedTableReference(originalTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); } | TableTranslation { String toUnescapedOriginalTableReference() { return unescapedTableReference(originalTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object obj); } | TableTranslation { String toUnescapedOriginalTableReference() { return unescapedTableReference(originalTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object obj); } |
@Test public void escapedOriginalTableReference() { assertThat(tableTranslation.toEscapedOriginalTableReference(), is("`o_table`.")); } | String toEscapedOriginalTableReference() { return escapedTableReference(originalTableName); } | TableTranslation { String toEscapedOriginalTableReference() { return escapedTableReference(originalTableName); } } | TableTranslation { String toEscapedOriginalTableReference() { return escapedTableReference(originalTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); } | TableTranslation { String toEscapedOriginalTableReference() { return escapedTableReference(originalTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object obj); } | TableTranslation { String toEscapedOriginalTableReference() { return escapedTableReference(originalTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object obj); } |
@Test public void unescapedReplicaTableReference() { assertThat(tableTranslation.toUnescapedReplicaTableReference(), is("r_table.")); } | String toUnescapedReplicaTableReference() { return unescapedTableReference(replicaTableName); } | TableTranslation { String toUnescapedReplicaTableReference() { return unescapedTableReference(replicaTableName); } } | TableTranslation { String toUnescapedReplicaTableReference() { return unescapedTableReference(replicaTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); } | TableTranslation { String toUnescapedReplicaTableReference() { return unescapedTableReference(replicaTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object obj); } | TableTranslation { String toUnescapedReplicaTableReference() { return unescapedTableReference(replicaTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object obj); } |
@Test public void escapedReplicaTableReference() { assertThat(tableTranslation.toEscapedReplicaTableReference(), is("`r_table`.")); } | String toEscapedReplicaTableReference() { return escapedTableReference(replicaTableName); } | TableTranslation { String toEscapedReplicaTableReference() { return escapedTableReference(replicaTableName); } } | TableTranslation { String toEscapedReplicaTableReference() { return escapedTableReference(replicaTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); } | TableTranslation { String toEscapedReplicaTableReference() { return escapedTableReference(replicaTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object obj); } | TableTranslation { String toEscapedReplicaTableReference() { return escapedTableReference(replicaTableName); } TableTranslation(
String originalDatabaseName,
String originalTableName,
String replicaDatabaseName,
String replicaTableName); @Override boolean equals(Object obj); } |
@Test public void skipTables() { when(table.getTableType()).thenReturn(TableType.EXTERNAL_TABLE.name()); Table transformedTable = transformation.transform(table); assertThat(transformedTable, is(table)); } | @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTranslator.translate(tableQualifiedName, table.getViewOr... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... |
@Test public void transform() { Table transformedTable = transformation.transform(table); assertThat(transformedTable, is(not(table))); verify(translator).translate(QUALIFIED_NAME, ORIGINAL_HQL); verify(translator).translate(QUALIFIED_NAME, EXPANDED_HQL); assertThat(transformedTable.getViewOriginalText(), is(ORIGINAL_T... | @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTranslator.translate(tableQualifiedName, table.getViewOr... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... |
@Test(expected = CircusTrainException.class) public void underlyingTableIsMissing() throws Exception { hiveConf.setBoolean(ViewTransformation.SKIP_TABLE_EXIST_CHECKS, false); when(metaStoreClient.getTable("replica", "tt")).thenThrow(new NoSuchObjectException()); transformation.transform(table); } | @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTranslator.translate(tableQualifiedName, table.getViewOr... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... |
@Test public void getCannedAclDefaultIsNull() throws Exception { S3S3CopierOptions options = new S3S3CopierOptions(copierOptions); assertNull(options.getCannedAcl()); } | public CannedAccessControlList getCannedAcl() { String cannedAcl = MapUtils.getString(copierOptions, Keys.CANNED_ACL.keyName(), null); if (cannedAcl != null) { return CannedAclUtils.toCannedAccessControlList(cannedAcl); } return null; } | S3S3CopierOptions { public CannedAccessControlList getCannedAcl() { String cannedAcl = MapUtils.getString(copierOptions, Keys.CANNED_ACL.keyName(), null); if (cannedAcl != null) { return CannedAclUtils.toCannedAccessControlList(cannedAcl); } return null; } } | S3S3CopierOptions { public CannedAccessControlList getCannedAcl() { String cannedAcl = MapUtils.getString(copierOptions, Keys.CANNED_ACL.keyName(), null); if (cannedAcl != null) { return CannedAclUtils.toCannedAccessControlList(cannedAcl); } return null; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> cop... | S3S3CopierOptions { public CannedAccessControlList getCannedAcl() { String cannedAcl = MapUtils.getString(copierOptions, Keys.CANNED_ACL.keyName(), null); if (cannedAcl != null) { return CannedAclUtils.toCannedAccessControlList(cannedAcl); } return null; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> cop... | S3S3CopierOptions { public CannedAccessControlList getCannedAcl() { String cannedAcl = MapUtils.getString(copierOptions, Keys.CANNED_ACL.keyName(), null); if (cannedAcl != null) { return CannedAclUtils.toCannedAccessControlList(cannedAcl); } return null; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> cop... |
@Test public void underlyingTablesExist() { hiveConf.setBoolean(ViewTransformation.SKIP_TABLE_EXIST_CHECKS, false); when(table.getTableType()).thenReturn(TableType.VIRTUAL_VIEW.name()); Table transformedTable = transformation.transform(table); assertThat(transformedTable, is(not(table))); verify(translator).translate(Q... | @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTranslator.translate(tableQualifiedName, table.getViewOr... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... | ViewTransformation implements TableTransformation { @Override public Table transform(Table table) { if (!MetaStoreUtils.isView(table)) { return table; } LOG.info("Translating HQL of view {}.{}", table.getDbName(), table.getTableName()); String tableQualifiedName = Warehouse.getQualifiedName(table); String hql = hqlTran... |
@Test public void mappings() { Map<String, String> replicationMappings = ImmutableMap .<String, String> builder() .put("db1.table_a", "r_db.a_table") .put("odb.o_table", "r_db.r_table") .build(); when(tableReplication.getTableMappings()).thenReturn(replicationMappings); HqlTranslator translator = new HqlTranslator(tabl... | Map<String, List<TableTranslation>> getMappings() { return mappings; } | HqlTranslator { Map<String, List<TableTranslation>> getMappings() { return mappings; } } | HqlTranslator { Map<String, List<TableTranslation>> getMappings() { return mappings; } @Autowired HqlTranslator(TableReplications tableReplications); } | HqlTranslator { Map<String, List<TableTranslation>> getMappings() { return mappings; } @Autowired HqlTranslator(TableReplications tableReplications); String translate(String viewQualifiedName, String hql); } | HqlTranslator { Map<String, List<TableTranslation>> getMappings() { return mappings; } @Autowired HqlTranslator(TableReplications tableReplications); String translate(String viewQualifiedName, String hql); } |
@Test public void unescapedStatement() { Map<String, String> replicationMappings = ImmutableMap .<String, String> builder() .put("db1.table_a", "r_db.a_table") .build(); when(tableReplication.getTableMappings()).thenReturn(replicationMappings); HqlTranslator translator = new HqlTranslator(tableReplications); String tra... | public String translate(String viewQualifiedName, String hql) { List<TableTranslation> translations = mappings.get(viewQualifiedName); if (translations == null) { return hql; } return translate(hql, translations); } | HqlTranslator { public String translate(String viewQualifiedName, String hql) { List<TableTranslation> translations = mappings.get(viewQualifiedName); if (translations == null) { return hql; } return translate(hql, translations); } } | HqlTranslator { public String translate(String viewQualifiedName, String hql) { List<TableTranslation> translations = mappings.get(viewQualifiedName); if (translations == null) { return hql; } return translate(hql, translations); } @Autowired HqlTranslator(TableReplications tableReplications); } | HqlTranslator { public String translate(String viewQualifiedName, String hql) { List<TableTranslation> translations = mappings.get(viewQualifiedName); if (translations == null) { return hql; } return translate(hql, translations); } @Autowired HqlTranslator(TableReplications tableReplications); String translate(String ... | HqlTranslator { public String translate(String viewQualifiedName, String hql) { List<TableTranslation> translations = mappings.get(viewQualifiedName); if (translations == null) { return hql; } return translate(hql, translations); } @Autowired HqlTranslator(TableReplications tableReplications); String translate(String ... |
@Test public void escapedStatment() { Map<String, String> replicationMappings = ImmutableMap .<String, String> builder() .put("db1.table_a", "r_db.a_table") .put("db2.table_b", "r_db.b_table") .build(); when(tableReplication.getTableMappings()).thenReturn(replicationMappings); HqlTranslator translator = new HqlTranslat... | public String translate(String viewQualifiedName, String hql) { List<TableTranslation> translations = mappings.get(viewQualifiedName); if (translations == null) { return hql; } return translate(hql, translations); } | HqlTranslator { public String translate(String viewQualifiedName, String hql) { List<TableTranslation> translations = mappings.get(viewQualifiedName); if (translations == null) { return hql; } return translate(hql, translations); } } | HqlTranslator { public String translate(String viewQualifiedName, String hql) { List<TableTranslation> translations = mappings.get(viewQualifiedName); if (translations == null) { return hql; } return translate(hql, translations); } @Autowired HqlTranslator(TableReplications tableReplications); } | HqlTranslator { public String translate(String viewQualifiedName, String hql) { List<TableTranslation> translations = mappings.get(viewQualifiedName); if (translations == null) { return hql; } return translate(hql, translations); } @Autowired HqlTranslator(TableReplications tableReplications); String translate(String ... | HqlTranslator { public String translate(String viewQualifiedName, String hql) { List<TableTranslation> translations = mappings.get(viewQualifiedName); if (translations == null) { return hql; } return translate(hql, translations); } @Autowired HqlTranslator(TableReplications tableReplications); String translate(String ... |
@Test(expected = IllegalArgumentException.class) public void noPort() { factory.newInstance("localhost"); } | public InetSocketAddress newInstance(String host) { int index = host.indexOf(':'); if (index == -1) { throw new IllegalArgumentException("No port found in host:" + host); } String hostname = host.substring(0, index); int port = Integer.parseInt(host.substring(index + 1)); return new InetSocketAddress(hostname, port); } | InetSocketAddressFactory { public InetSocketAddress newInstance(String host) { int index = host.indexOf(':'); if (index == -1) { throw new IllegalArgumentException("No port found in host:" + host); } String hostname = host.substring(0, index); int port = Integer.parseInt(host.substring(index + 1)); return new InetSocke... | InetSocketAddressFactory { public InetSocketAddress newInstance(String host) { int index = host.indexOf(':'); if (index == -1) { throw new IllegalArgumentException("No port found in host:" + host); } String hostname = host.substring(0, index); int port = Integer.parseInt(host.substring(index + 1)); return new InetSocke... | InetSocketAddressFactory { public InetSocketAddress newInstance(String host) { int index = host.indexOf(':'); if (index == -1) { throw new IllegalArgumentException("No port found in host:" + host); } String hostname = host.substring(0, index); int port = Integer.parseInt(host.substring(index + 1)); return new InetSocke... | InetSocketAddressFactory { public InetSocketAddress newInstance(String host) { int index = host.indexOf(':'); if (index == -1) { throw new IllegalArgumentException("No port found in host:" + host); } String hostname = host.substring(0, index); int port = Integer.parseInt(host.substring(index + 1)); return new InetSocke... |
@Test public void typical() { InetSocketAddress address = factory.newInstance("localhost:1234"); assertThat(address.getHostName(), is("localhost")); assertThat(address.getPort(), is(1234)); } | public InetSocketAddress newInstance(String host) { int index = host.indexOf(':'); if (index == -1) { throw new IllegalArgumentException("No port found in host:" + host); } String hostname = host.substring(0, index); int port = Integer.parseInt(host.substring(index + 1)); return new InetSocketAddress(hostname, port); } | InetSocketAddressFactory { public InetSocketAddress newInstance(String host) { int index = host.indexOf(':'); if (index == -1) { throw new IllegalArgumentException("No port found in host:" + host); } String hostname = host.substring(0, index); int port = Integer.parseInt(host.substring(index + 1)); return new InetSocke... | InetSocketAddressFactory { public InetSocketAddress newInstance(String host) { int index = host.indexOf(':'); if (index == -1) { throw new IllegalArgumentException("No port found in host:" + host); } String hostname = host.substring(0, index); int port = Integer.parseInt(host.substring(index + 1)); return new InetSocke... | InetSocketAddressFactory { public InetSocketAddress newInstance(String host) { int index = host.indexOf(':'); if (index == -1) { throw new IllegalArgumentException("No port found in host:" + host); } String hostname = host.substring(0, index); int port = Integer.parseInt(host.substring(index + 1)); return new InetSocke... | InetSocketAddressFactory { public InetSocketAddress newInstance(String host) { int index = host.indexOf(':'); if (index == -1) { throw new IllegalArgumentException("No port found in host:" + host); } String hostname = host.substring(0, index); int port = Integer.parseInt(host.substring(index + 1)); return new InetSocke... |
@Test public void typical() throws IOException { when(graphite.isConnected()).thenReturn(false); sender.send("name", 2L); verify(graphite).connect(); verify(graphite).send("prefix.name", "2", 1L); verify(graphite).flush(); verify(graphite).close(); } | @Override public void send(String name, long value) { send(singletonMap(name, value)); } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); static GraphiteMetricSender newInstance(String host, String prefix); @Override void send(String name, long va... | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); static GraphiteMetricSender newInstance(String host, String prefix); @Override void send(String name, long va... |
@Test public void alreadyConnected() throws IOException { when(graphite.isConnected()).thenReturn(true); sender.send("name", 2L); verify(graphite, never()).connect(); verify(graphite).send("prefix.name", "2", 1L); verify(graphite).flush(); verify(graphite).close(); } | @Override public void send(String name, long value) { send(singletonMap(name, value)); } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); static GraphiteMetricSender newInstance(String host, String prefix); @Override void send(String name, long va... | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); static GraphiteMetricSender newInstance(String host, String prefix); @Override void send(String name, long va... |
@Test public void exceptionOnConnect() throws IOException { when(graphite.isConnected()).thenReturn(false); doThrow(IOException.class).when(graphite).connect(); try { sender.send("name", 2L); } catch (Exception e) { fail("Unexpected exception"); } verify(graphite, never()).send("prefix.name", "2", 1L); verify(graphite,... | @Override public void send(String name, long value) { send(singletonMap(name, value)); } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); static GraphiteMetricSender newInstance(String host, String prefix); @Override void send(String name, long va... | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); static GraphiteMetricSender newInstance(String host, String prefix); @Override void send(String name, long va... |
@Test public void exceptionOnSend() throws IOException { when(graphite.isConnected()).thenReturn(true); doThrow(IOException.class).when(graphite).send(anyString(), anyString(), anyLong()); try { sender.send("name", 2L); } catch (Exception e) { fail("Unexpected exception"); } verify(graphite, never()).flush(); verify(gr... | @Override public void send(String name, long value) { send(singletonMap(name, value)); } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); static GraphiteMetricSender newInstance(String host, String prefix); @Override void send(String name, long va... | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); static GraphiteMetricSender newInstance(String host, String prefix); @Override void send(String name, long va... |
@Test public void getMaxCopyAttempts() throws Exception { copierOptions.put(S3S3CopierOptions.Keys.MAX_COPY_ATTEMPTS.keyName(), 3); S3S3CopierOptions options = new S3S3CopierOptions(copierOptions); assertThat(options.getMaxCopyAttempts(), is(3)); } | public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } | S3S3CopierOptions { public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } } | S3S3CopierOptions { public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); } | S3S3CopierOptions { public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); void setMaxThreadPoolSize(int maxThread... | S3S3CopierOptions { public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); void setMaxThreadPoolSize(int maxThread... |
@Test public void exceptionOnFlush() throws IOException { when(graphite.isConnected()).thenReturn(true); doThrow(IOException.class).when(graphite).flush(); try { sender.send("name", 2L); } catch (Exception e) { fail("Unexpected exception"); } verify(graphite).close(); } | @Override public void send(String name, long value) { send(singletonMap(name, value)); } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); static GraphiteMetricSender newInstance(String host, String prefix); @Override void send(String name, long va... | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); static GraphiteMetricSender newInstance(String host, String prefix); @Override void send(String name, long va... |
@Test public void exceptionOnClose() throws IOException { when(graphite.isConnected()).thenReturn(true); doThrow(IOException.class).when(graphite).close(); try { sender.send("name", 2L); } catch (Exception e) { fail("Unexpected exception"); } verify(graphite).close(); } | @Override public void send(String name, long value) { send(singletonMap(name, value)); } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); } | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); static GraphiteMetricSender newInstance(String host, String prefix); @Override void send(String name, long va... | GraphiteMetricSender implements MetricSender { @Override public void send(String name, long value) { send(singletonMap(name, value)); } GraphiteMetricSender(GraphiteSender graphite, Clock clock, String prefix); static GraphiteMetricSender newInstance(String host, String prefix); @Override void send(String name, long va... |
@Test public void getValue() { jobCounterGauge = new JobCounterGauge(job, key); Long result = jobCounterGauge.getValue(); assertThat(result, is(expectedResult)); } | @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " + counter, e); } return 0L; } | JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " +... | JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " +... | JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " +... | JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " +... |
@Test public void getValueGroupName() { jobCounterGauge = new JobCounterGauge(job, groupName, counterName); Long result = jobCounterGauge.getValue(); assertThat(result, is(expectedResult)); } | @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " + counter, e); } return 0L; } | JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " +... | JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " +... | JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " +... | JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " +... |
@Test public void getValueCannotGetCounters() throws IOException { when(job.getCounters()).thenThrow(new IOException()); jobCounterGauge = new JobCounterGauge(job, key); Long result = jobCounterGauge.getValue(); assertThat(result, is(0L)); } | @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " + counter, e); } return 0L; } | JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " +... | JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " +... | JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " +... | JobCounterGauge implements Gauge<Long> { @Override public Long getValue() { try { if (groupName != null) { return job.getCounters().findCounter(groupName, counterName).getValue(); } else { return job.getCounters().findCounter(counter).getValue(); } } catch (IOException e) { LOG.warn("Could not get value for counter " +... |
@Test public void nullGraphite() { ValidatedGraphite validated = validator.validate(null); assertThat(validated.isEnabled(), is(false)); } | public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graphite.getPrefix()); } ... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... |
@Test public void disabledGraphite() { input.init(); ValidatedGraphite validated = validator.validate(input); assertThat(validated.isEnabled(), is(false)); } | public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graphite.getPrefix()); } ... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... |
@Test public void enabledConfigOnly() { input.setConfig(new Path(".")); input.init(); ValidatedGraphite validated = validator.validate(input); assertThat(validated.isEnabled(), is(false)); } | public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graphite.getPrefix()); } ... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... |
@Test(expected = CircusTrainException.class) public void enabledNoHost() { input.setPrefix("prefix"); input.setNamespace("namespace"); input.init(); validator.validate(input); } | public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graphite.getPrefix()); } ... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... |
@Test(expected = CircusTrainException.class) public void enabledNoPrefix() { input.setHost("host"); input.setNamespace("namespace"); input.init(); validator.validate(input); } | public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graphite.getPrefix()); } ... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... |
@Test public void getMaxCopyAttemptsDefaultIsThree() throws Exception { S3S3CopierOptions options = new S3S3CopierOptions(copierOptions); assertThat(options.getMaxCopyAttempts(), is(3)); } | public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } | S3S3CopierOptions { public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } } | S3S3CopierOptions { public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); } | S3S3CopierOptions { public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); void setMaxThreadPoolSize(int maxThread... | S3S3CopierOptions { public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); void setMaxThreadPoolSize(int maxThread... |
@Test(expected = CircusTrainException.class) public void enabledNoNamespace() { input.setHost("host"); input.setPrefix("prefix"); input.init(); validator.validate(input); } | public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graphite.getPrefix()); } ... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... |
@Test public void enabledHostPrefixAndNamespace() { input.setHost("host"); input.setPrefix("prefix"); input.setNamespace("namespace"); input.init(); ValidatedGraphite validated = validator.validate(input); assertThat(validated.isEnabled(), is(true)); assertThat(validated.getHost(), is("host")); assertThat(validated.get... | public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graphite.getPrefix()); } ... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... |
@Test public void enabledHostPrefixAndNamespaceFromConfigFile() { loaded.setHost("hostx"); loaded.setPrefix("prefixx"); loaded.setNamespace("namespacex"); loaded.init(); ValidatedGraphite validated = validator.validate(input); assertThat(validated.isEnabled(), is(true)); assertThat(validated.getHost(), is("hostx")); as... | public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graphite.getPrefix()); } ... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... |
@Test public void enabledHostPrefixAndNamespaceFromConfigFileWithOverride() { loaded.setHost("hostx"); loaded.setPrefix("prefixx"); loaded.setNamespace("namespacex"); loaded.init(); input.setHost("host"); input.setPrefix("prefix"); input.setNamespace("namespace"); input.init(); ValidatedGraphite validated = validator.v... | public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graphite.getPrefix()); } ... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... | GraphiteValidator { public ValidatedGraphite validate(Graphite graphite) { if (graphite == null) { graphite = new Graphite(); } Graphite validated = loader.load(graphite.getConfig()); if (graphite.getHost() != null) { validated.setHost(graphite.getHost()); } if (graphite.getPrefix() != null) { validated.setPrefix(graph... |
@Test public void graphiteMetricSender() { when(validatedGraphite.getHost()).thenReturn("localhost:123"); when(validatedGraphite.getFormattedPrefix()).thenReturn("prefix.namespace"); when(validatedGraphite.isEnabled()).thenReturn(true); MetricSender sender = new MetricsConf().metricSender(validatedGraphite); assertTrue... | @Bean MetricSender metricSender(ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return GraphiteMetricSender.newInstance(validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } return MetricSender.DEFAULT_LOG_ONLY; } | MetricsConf { @Bean MetricSender metricSender(ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return GraphiteMetricSender.newInstance(validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } return MetricSender.DEFAULT_LOG_ONLY; } } | MetricsConf { @Bean MetricSender metricSender(ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return GraphiteMetricSender.newInstance(validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } return MetricSender.DEFAULT_LOG_ONLY; } } | MetricsConf { @Bean MetricSender metricSender(ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return GraphiteMetricSender.newInstance(validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } return MetricSender.DEFAULT_LOG_ONLY; } } | MetricsConf { @Bean MetricSender metricSender(ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return GraphiteMetricSender.newInstance(validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } return MetricSender.DEFAULT_LOG_ONLY; } } |
@Test public void defaultMetricSender() { when(validatedGraphite.isEnabled()).thenReturn(false); MetricSender sender = new MetricsConf().metricSender(validatedGraphite); assertTrue(sender == MetricSender.DEFAULT_LOG_ONLY); } | @Bean MetricSender metricSender(ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return GraphiteMetricSender.newInstance(validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } return MetricSender.DEFAULT_LOG_ONLY; } | MetricsConf { @Bean MetricSender metricSender(ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return GraphiteMetricSender.newInstance(validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } return MetricSender.DEFAULT_LOG_ONLY; } } | MetricsConf { @Bean MetricSender metricSender(ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return GraphiteMetricSender.newInstance(validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } return MetricSender.DEFAULT_LOG_ONLY; } } | MetricsConf { @Bean MetricSender metricSender(ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return GraphiteMetricSender.newInstance(validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } return MetricSender.DEFAULT_LOG_ONLY; } } | MetricsConf { @Bean MetricSender metricSender(ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return GraphiteMetricSender.newInstance(validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } return MetricSender.DEFAULT_LOG_ONLY; } } |
@Test public void graphiteReporter() { when(validatedGraphite.isEnabled()).thenReturn(true); ScheduledReporterFactory reporterFactory = new MetricsConf().runningScheduledReporterFactory(new MetricRegistry(), validatedGraphite); assertTrue(reporterFactory instanceof GraphiteScheduledReporterFactory); } | @Bean ScheduledReporterFactory runningScheduledReporterFactory( MetricRegistry runningMetricRegistry, ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return new GraphiteScheduledReporterFactory(runningMetricRegistry, validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } ret... | MetricsConf { @Bean ScheduledReporterFactory runningScheduledReporterFactory( MetricRegistry runningMetricRegistry, ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return new GraphiteScheduledReporterFactory(runningMetricRegistry, validatedGraphite.getHost(), validatedGraphite.getFormattedPr... | MetricsConf { @Bean ScheduledReporterFactory runningScheduledReporterFactory( MetricRegistry runningMetricRegistry, ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return new GraphiteScheduledReporterFactory(runningMetricRegistry, validatedGraphite.getHost(), validatedGraphite.getFormattedPr... | MetricsConf { @Bean ScheduledReporterFactory runningScheduledReporterFactory( MetricRegistry runningMetricRegistry, ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return new GraphiteScheduledReporterFactory(runningMetricRegistry, validatedGraphite.getHost(), validatedGraphite.getFormattedPr... | MetricsConf { @Bean ScheduledReporterFactory runningScheduledReporterFactory( MetricRegistry runningMetricRegistry, ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return new GraphiteScheduledReporterFactory(runningMetricRegistry, validatedGraphite.getHost(), validatedGraphite.getFormattedPr... |
@Test public void defaultReporter() { when(validatedGraphite.isEnabled()).thenReturn(false); ScheduledReporterFactory reporterFactory = new MetricsConf().runningScheduledReporterFactory(new MetricRegistry(), validatedGraphite); assertTrue(reporterFactory instanceof LoggingScheduledReporterFactory); } | @Bean ScheduledReporterFactory runningScheduledReporterFactory( MetricRegistry runningMetricRegistry, ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return new GraphiteScheduledReporterFactory(runningMetricRegistry, validatedGraphite.getHost(), validatedGraphite.getFormattedPrefix()); } ret... | MetricsConf { @Bean ScheduledReporterFactory runningScheduledReporterFactory( MetricRegistry runningMetricRegistry, ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return new GraphiteScheduledReporterFactory(runningMetricRegistry, validatedGraphite.getHost(), validatedGraphite.getFormattedPr... | MetricsConf { @Bean ScheduledReporterFactory runningScheduledReporterFactory( MetricRegistry runningMetricRegistry, ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return new GraphiteScheduledReporterFactory(runningMetricRegistry, validatedGraphite.getHost(), validatedGraphite.getFormattedPr... | MetricsConf { @Bean ScheduledReporterFactory runningScheduledReporterFactory( MetricRegistry runningMetricRegistry, ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return new GraphiteScheduledReporterFactory(runningMetricRegistry, validatedGraphite.getHost(), validatedGraphite.getFormattedPr... | MetricsConf { @Bean ScheduledReporterFactory runningScheduledReporterFactory( MetricRegistry runningMetricRegistry, ValidatedGraphite validatedGraphite) { if (validatedGraphite.isEnabled()) { return new GraphiteScheduledReporterFactory(runningMetricRegistry, validatedGraphite.getHost(), validatedGraphite.getFormattedPr... |
@Test public void readAllProps() throws IOException { Properties properties = new Properties(); properties.put("graphite.host", "h"); properties.put("graphite.prefix", "p"); properties.put("graphite.namespace", "n"); try (OutputStream outputStream = new FileOutputStream(clusterProperties)) { properties.store(outputStre... | Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(properties.getPropert... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... |
@Test public void nullPath() throws IOException { Graphite graphite = loader.load(null); assertThat(graphite.getConfig(), is(nullValue())); assertThat(graphite.getHost(), is(nullValue())); assertThat(graphite.getPrefix(), is(nullValue())); assertThat(graphite.getNamespace(), is(nullValue())); } | Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(properties.getPropert... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... |
@Test public void getMaxCopyAttemptsDefaultIfLessThanOne() throws Exception { copierOptions.put(S3S3CopierOptions.Keys.MAX_COPY_ATTEMPTS.keyName(), -1); S3S3CopierOptions options = new S3S3CopierOptions(copierOptions); assertThat(options.getMaxCopyAttempts(), is(3)); } | public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } | S3S3CopierOptions { public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } } | S3S3CopierOptions { public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); } | S3S3CopierOptions { public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); void setMaxThreadPoolSize(int maxThread... | S3S3CopierOptions { public int getMaxCopyAttempts() { Integer maxCopyAttempts = MapUtils.getInteger(copierOptions, Keys.MAX_COPY_ATTEMPTS.keyName(), 3); return maxCopyAttempts < 1 ? 3 : maxCopyAttempts; } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); void setMaxThreadPoolSize(int maxThread... |
@Test(expected = CircusTrainException.class) public void pathDoesNotExist() throws IOException { loader.load(new Path(new File(temp.getRoot(), "dummy.properties").toURI())); } | Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(properties.getPropert... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... |
@SuppressWarnings("unchecked") @Test(expected = CircusTrainException.class) public void ioException() throws IOException { Path mockPath = mock(Path.class); when(mockPath.getFileSystem(conf)).thenThrow(IOException.class); loader.load(mockPath); } | Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(properties.getPropert... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... | GraphiteLoader { Graphite load(Path path) { Graphite graphite = new Graphite(); if (path != null) { graphite.setConfig(path); Properties properties = loadProperties(path); graphite.setHost(properties.getProperty("graphite.host")); graphite.setPrefix(properties.getProperty("graphite.prefix")); graphite.setNamespace(prop... |
@Test public void validHostAndPort() { graphite.setHost("foo.com:1234"); Set<ConstraintViolation<Graphite>> violations = validator.validate(graphite); assertThat(violations.size(), is(0)); } | public void setHost(String host) { this.host = host; } | Graphite { public void setHost(String host) { this.host = host; } } | Graphite { public void setHost(String host) { this.host = host; } } | Graphite { public void setHost(String host) { this.host = host; } boolean isEnabled(); Path getConfig(); void setConfig(Path config); String getHost(); void setHost(String host); String getPrefix(); void setPrefix(String prefix); String getNamespace(); void setNamespace(String namespace); } | Graphite { public void setHost(String host) { this.host = host; } boolean isEnabled(); Path getConfig(); void setConfig(Path config); String getHost(); void setHost(String host); String getPrefix(); void setPrefix(String prefix); String getNamespace(); void setNamespace(String namespace); } |
@Test public void missingPort() { graphite.setHost("foo"); Set<ConstraintViolation<Graphite>> violations = validator.validate(graphite); assertThat(violations.size(), is(1)); } | public void setHost(String host) { this.host = host; } | Graphite { public void setHost(String host) { this.host = host; } } | Graphite { public void setHost(String host) { this.host = host; } } | Graphite { public void setHost(String host) { this.host = host; } boolean isEnabled(); Path getConfig(); void setConfig(Path config); String getHost(); void setHost(String host); String getPrefix(); void setPrefix(String prefix); String getNamespace(); void setNamespace(String namespace); } | Graphite { public void setHost(String host) { this.host = host; } boolean isEnabled(); Path getConfig(); void setConfig(Path config); String getHost(); void setHost(String host); String getPrefix(); void setPrefix(String prefix); String getNamespace(); void setNamespace(String namespace); } |
@Test public void nullHost() { graphite.setHost(null); Set<ConstraintViolation<Graphite>> violations = validator.validate(graphite); assertThat(violations.size(), is(0)); } | public void setHost(String host) { this.host = host; } | Graphite { public void setHost(String host) { this.host = host; } } | Graphite { public void setHost(String host) { this.host = host; } } | Graphite { public void setHost(String host) { this.host = host; } boolean isEnabled(); Path getConfig(); void setConfig(Path config); String getHost(); void setHost(String host); String getPrefix(); void setPrefix(String prefix); String getNamespace(); void setNamespace(String namespace); } | Graphite { public void setHost(String host) { this.host = host; } boolean isEnabled(); Path getConfig(); void setConfig(Path config); String getHost(); void setHost(String host); String getPrefix(); void setPrefix(String prefix); String getNamespace(); void setNamespace(String namespace); } |
@Test public void nullJob() throws Exception { Map<String, Long> metrics = new JobMetrics(null, GROUP, COUNTER).getMetrics(); assertThat(metrics.size(), is(0)); } | @Override public Map<String, Long> getMetrics() { return metrics; } | JobMetrics implements Metrics { @Override public Map<String, Long> getMetrics() { return metrics; } } | JobMetrics implements Metrics { @Override public Map<String, Long> getMetrics() { return metrics; } JobMetrics(Job job, String bytesReplicatedGroup, String bytesReplicatedCounter); JobMetrics(Job job, Enum<?> bytesReplicatedCounter); JobMetrics(Job job, String bytesReplicatedKey); } | JobMetrics implements Metrics { @Override public Map<String, Long> getMetrics() { return metrics; } JobMetrics(Job job, String bytesReplicatedGroup, String bytesReplicatedCounter); JobMetrics(Job job, Enum<?> bytesReplicatedCounter); JobMetrics(Job job, String bytesReplicatedKey); @Override Map<String, Long> getMetri... | JobMetrics implements Metrics { @Override public Map<String, Long> getMetrics() { return metrics; } JobMetrics(Job job, String bytesReplicatedGroup, String bytesReplicatedCounter); JobMetrics(Job job, Enum<?> bytesReplicatedCounter); JobMetrics(Job job, String bytesReplicatedKey); @Override Map<String, Long> getMetri... |
@Test public void nullCounters() throws Exception { when(job.getCounters()).thenReturn(null); Map<String, Long> metrics = new JobMetrics(job, GROUP, COUNTER).getMetrics(); assertThat(metrics.size(), is(0)); } | @Override public Map<String, Long> getMetrics() { return metrics; } | JobMetrics implements Metrics { @Override public Map<String, Long> getMetrics() { return metrics; } } | JobMetrics implements Metrics { @Override public Map<String, Long> getMetrics() { return metrics; } JobMetrics(Job job, String bytesReplicatedGroup, String bytesReplicatedCounter); JobMetrics(Job job, Enum<?> bytesReplicatedCounter); JobMetrics(Job job, String bytesReplicatedKey); } | JobMetrics implements Metrics { @Override public Map<String, Long> getMetrics() { return metrics; } JobMetrics(Job job, String bytesReplicatedGroup, String bytesReplicatedCounter); JobMetrics(Job job, Enum<?> bytesReplicatedCounter); JobMetrics(Job job, String bytesReplicatedKey); @Override Map<String, Long> getMetri... | JobMetrics implements Metrics { @Override public Map<String, Long> getMetrics() { return metrics; } JobMetrics(Job job, String bytesReplicatedGroup, String bytesReplicatedCounter); JobMetrics(Job job, Enum<?> bytesReplicatedCounter); JobMetrics(Job job, String bytesReplicatedKey); @Override Map<String, Long> getMetri... |
@Test(expected = PartitionNotFoundException.class) public void unknowPartition() throws Exception { when(metastore.getPartitionsByNames(DATABASE_NAME, TABLE_NAME, Arrays.asList("a=01", "a=02", "a=03"))) .thenReturn(Arrays.asList(p01, p02, p03)); BufferedPartitionFetcher fetcher = spy(new BufferedPartitionFetcher(metast... | @Override public Partition fetch(String partitionName) { int partitionPosition = partitionNames.indexOf(partitionName); if (partitionPosition < 0) { throw new PartitionNotFoundException("Unknown partition " + partitionName); } if (!buffer.containsKey(partitionName)) { bufferPartitions(partitionPosition); } return buffe... | BufferedPartitionFetcher implements PartitionFetcher { @Override public Partition fetch(String partitionName) { int partitionPosition = partitionNames.indexOf(partitionName); if (partitionPosition < 0) { throw new PartitionNotFoundException("Unknown partition " + partitionName); } if (!buffer.containsKey(partitionName)... | BufferedPartitionFetcher implements PartitionFetcher { @Override public Partition fetch(String partitionName) { int partitionPosition = partitionNames.indexOf(partitionName); if (partitionPosition < 0) { throw new PartitionNotFoundException("Unknown partition " + partitionName); } if (!buffer.containsKey(partitionName)... | BufferedPartitionFetcher implements PartitionFetcher { @Override public Partition fetch(String partitionName) { int partitionPosition = partitionNames.indexOf(partitionName); if (partitionPosition < 0) { throw new PartitionNotFoundException("Unknown partition " + partitionName); } if (!buffer.containsKey(partitionName)... | BufferedPartitionFetcher implements PartitionFetcher { @Override public Partition fetch(String partitionName) { int partitionPosition = partitionNames.indexOf(partitionName); if (partitionPosition < 0) { throw new PartitionNotFoundException("Unknown partition " + partitionName); } if (!buffer.containsKey(partitionName)... |
@SuppressWarnings("unchecked") @Test public void typical() throws Exception { parser.parse(CREATE_TABLE_STATEMENT, nodeProcessor); verify(nodeProcessor, times(49)).process(any(Node.class), any(Stack.class), any(NodeProcessorCtx.class), anyVararg()); } | public void parse(String statement, NodeProcessor nodeProcessor) { Context parserContext; try { parserContext = new Context(hiveConf); } catch (IOException e) { throw new RuntimeException("Unable to create Context for parser", e); } ParseDriver parserDriver = new ParseDriver(); ASTNode tree; try { tree = parserDriver.p... | HiveLanguageParser { public void parse(String statement, NodeProcessor nodeProcessor) { Context parserContext; try { parserContext = new Context(hiveConf); } catch (IOException e) { throw new RuntimeException("Unable to create Context for parser", e); } ParseDriver parserDriver = new ParseDriver(); ASTNode tree; try { ... | HiveLanguageParser { public void parse(String statement, NodeProcessor nodeProcessor) { Context parserContext; try { parserContext = new Context(hiveConf); } catch (IOException e) { throw new RuntimeException("Unable to create Context for parser", e); } ParseDriver parserDriver = new ParseDriver(); ASTNode tree; try { ... | HiveLanguageParser { public void parse(String statement, NodeProcessor nodeProcessor) { Context parserContext; try { parserContext = new Context(hiveConf); } catch (IOException e) { throw new RuntimeException("Unable to create Context for parser", e); } ParseDriver parserDriver = new ParseDriver(); ASTNode tree; try { ... | HiveLanguageParser { public void parse(String statement, NodeProcessor nodeProcessor) { Context parserContext; try { parserContext = new Context(hiveConf); } catch (IOException e) { throw new RuntimeException("Unable to create Context for parser", e); } ParseDriver parserDriver = new ParseDriver(); ASTNode tree; try { ... |
@Test(expected = HiveParseException.class) public void invalidSyntax() throws Exception { parser.parse("CREATE TABLE abc () LOCATION 'path'", nodeProcessor); } | public void parse(String statement, NodeProcessor nodeProcessor) { Context parserContext; try { parserContext = new Context(hiveConf); } catch (IOException e) { throw new RuntimeException("Unable to create Context for parser", e); } ParseDriver parserDriver = new ParseDriver(); ASTNode tree; try { tree = parserDriver.p... | HiveLanguageParser { public void parse(String statement, NodeProcessor nodeProcessor) { Context parserContext; try { parserContext = new Context(hiveConf); } catch (IOException e) { throw new RuntimeException("Unable to create Context for parser", e); } ParseDriver parserDriver = new ParseDriver(); ASTNode tree; try { ... | HiveLanguageParser { public void parse(String statement, NodeProcessor nodeProcessor) { Context parserContext; try { parserContext = new Context(hiveConf); } catch (IOException e) { throw new RuntimeException("Unable to create Context for parser", e); } ParseDriver parserDriver = new ParseDriver(); ASTNode tree; try { ... | HiveLanguageParser { public void parse(String statement, NodeProcessor nodeProcessor) { Context parserContext; try { parserContext = new Context(hiveConf); } catch (IOException e) { throw new RuntimeException("Unable to create Context for parser", e); } ParseDriver parserDriver = new ParseDriver(); ASTNode tree; try { ... | HiveLanguageParser { public void parse(String statement, NodeProcessor nodeProcessor) { Context parserContext; try { parserContext = new Context(hiveConf); } catch (IOException e) { throw new RuntimeException("Unable to create Context for parser", e); } ParseDriver parserDriver = new ParseDriver(); ASTNode tree; try { ... |
@Test public void getAssumedRole() throws Exception { copierOptions.put(S3S3CopierOptions.Keys.ASSUME_ROLE.keyName(), "iam:role:1234:user"); S3S3CopierOptions options = new S3S3CopierOptions(copierOptions); assertThat(options.getAssumedRole(), is("iam:role:1234:user")); } | public String getAssumedRole() { return MapUtils.getString(copierOptions, Keys.ASSUME_ROLE.keyName(), null); } | S3S3CopierOptions { public String getAssumedRole() { return MapUtils.getString(copierOptions, Keys.ASSUME_ROLE.keyName(), null); } } | S3S3CopierOptions { public String getAssumedRole() { return MapUtils.getString(copierOptions, Keys.ASSUME_ROLE.keyName(), null); } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); } | S3S3CopierOptions { public String getAssumedRole() { return MapUtils.getString(copierOptions, Keys.ASSUME_ROLE.keyName(), null); } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); void setMaxThreadPoolSize(int maxThreadPoolSize); int getMaxThreadPoolSize(); Long getMultipartCopyThreshold(); L... | S3S3CopierOptions { public String getAssumedRole() { return MapUtils.getString(copierOptions, Keys.ASSUME_ROLE.keyName(), null); } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); void setMaxThreadPoolSize(int maxThreadPoolSize); int getMaxThreadPoolSize(); Long getMultipartCopyThreshold(); L... |
@Test public void bindFileSystemTest() throws Exception { Configuration conf = new Configuration(); BindGoogleHadoopFileSystem binder = new BindGoogleHadoopFileSystem(); binder.bindFileSystem(conf); assertNotNull(conf.get(GCP_PROJECT_ID)); assertEquals("true", conf.get(GCP_SERVICE_ACCOUNT_ENABLE)); assertEquals(GoogleH... | public void bindFileSystem(Configuration configuration) { LOG.debug("Binding GoogleHadoopFileSystem"); configuration.set(GS_FS_IMPLEMENTATION, GoogleHadoopFileSystem.class.getName()); configuration.set(GS_ABSTRACT_FS, GoogleHadoopFS.class.getName()); configuration.set(GCP_SERVICE_ACCOUNT_ENABLE, "true"); configuration.... | BindGoogleHadoopFileSystem { public void bindFileSystem(Configuration configuration) { LOG.debug("Binding GoogleHadoopFileSystem"); configuration.set(GS_FS_IMPLEMENTATION, GoogleHadoopFileSystem.class.getName()); configuration.set(GS_ABSTRACT_FS, GoogleHadoopFS.class.getName()); configuration.set(GCP_SERVICE_ACCOUNT_EN... | BindGoogleHadoopFileSystem { public void bindFileSystem(Configuration configuration) { LOG.debug("Binding GoogleHadoopFileSystem"); configuration.set(GS_FS_IMPLEMENTATION, GoogleHadoopFileSystem.class.getName()); configuration.set(GS_ABSTRACT_FS, GoogleHadoopFS.class.getName()); configuration.set(GCP_SERVICE_ACCOUNT_EN... | BindGoogleHadoopFileSystem { public void bindFileSystem(Configuration configuration) { LOG.debug("Binding GoogleHadoopFileSystem"); configuration.set(GS_FS_IMPLEMENTATION, GoogleHadoopFileSystem.class.getName()); configuration.set(GS_ABSTRACT_FS, GoogleHadoopFS.class.getName()); configuration.set(GCP_SERVICE_ACCOUNT_EN... | BindGoogleHadoopFileSystem { public void bindFileSystem(Configuration configuration) { LOG.debug("Binding GoogleHadoopFileSystem"); configuration.set(GS_FS_IMPLEMENTATION, GoogleHadoopFileSystem.class.getName()); configuration.set(GS_ABSTRACT_FS, GoogleHadoopFS.class.getName()); configuration.set(GCP_SERVICE_ACCOUNT_EN... |
@Test public void newInstanceWithRelativePath() { String relativePath = "../test.json"; security.setCredentialProvider(relativePath); String result = new GCPCredentialPathProvider(security).newPath().toString(); assertThat(result, is(relativePath)); } | public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCredentialProvider()); if (pat... | GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCr... | GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCr... | GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCr... | GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCr... |
@Test public void newInstanceWithAbsolutePath() { security.setCredentialProvider("/test.json"); String result = new GCPCredentialPathProvider(security).newPath().toString(); assertFalse(new Path(result).isAbsolute()); assertThat(result, startsWith("../")); } | public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCredentialProvider()); if (pat... | GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCr... | GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCr... | GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCr... | GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCr... |
@Test public void newInstanceWithBlankPath() { security.setCredentialProvider(""); Path result = new GCPCredentialPathProvider(security).newPath(); assertNull(result); } | public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCredentialProvider()); if (pat... | GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCr... | GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCr... | GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCr... | GCPCredentialPathProvider { public Path newPath() { String credentialProviderPath = security.getCredentialProvider(); if (isBlank(credentialProviderPath)) { return null; } java.nio.file.Path currentDirectory = Paths.get(System.getProperty("user.dir")); java.nio.file.Path pathToCredentialsFile = Paths.get(security.getCr... |
@Test public void newInstanceWithoutConfigurationSet() { String dfsDirectory = "hdfs:/test-dir/"; doReturn(randomString).when(randomStringFactory).newInstance(); doReturn(dfsDirectory).when(configuration).get("hive.exec.scratchdir"); Path directory = new DistributedFileSystemPathProvider(security, randomStringFactory).... | public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP_KEY_NAME); } else { Path parentDire... | DistributedFileSystemPathProvider { public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP... | DistributedFileSystemPathProvider { public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP... | DistributedFileSystemPathProvider { public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP... | DistributedFileSystemPathProvider { public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP... |
@Test public void newInstanceWithConfigurationSet() { String providedDirectory = "hdfs:/test/directory"; doReturn(randomString).when(randomStringFactory).newInstance(); security.setDistributedFileSystemWorkingDirectory(providedDirectory); Path directory = new DistributedFileSystemPathProvider(security, randomStringFact... | public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP_KEY_NAME); } else { Path parentDire... | DistributedFileSystemPathProvider { public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP... | DistributedFileSystemPathProvider { public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP... | DistributedFileSystemPathProvider { public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP... | DistributedFileSystemPathProvider { public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP... |
@Test public void newInstanceWithoutHiveConfScratchDir() { doReturn("").when(configuration).get("hive.exec.scratchdir"); doReturn(randomString).when(randomStringFactory).newInstance(); Path directory = new DistributedFileSystemPathProvider(security, randomStringFactory).newPath(configuration); String baseDirectoryExpec... | public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP_KEY_NAME); } else { Path parentDire... | DistributedFileSystemPathProvider { public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP... | DistributedFileSystemPathProvider { public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP... | DistributedFileSystemPathProvider { public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP... | DistributedFileSystemPathProvider { public Path newPath(Configuration configuration) { String randomString = randomStringFactory.newInstance(); if (isBlank(security.getDistributedFileSystemWorkingDirectory())) { Path parentDirectory = getTemporaryFolder(configuration, randomString); return new Path(parentDirectory, GCP... |
@Test public void postProcessAfterInitializationWithIncorrectBeanName() throws Exception { String beanName = "notBaseConf"; processor.postProcessAfterInitialization(configuration, beanName); verifyZeroInteractions(credentialPathProvider, bindGoogleHadoopFileSystem, credentialCopier); } | @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return bean; } | GCPBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return b... | GCPBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return b... | GCPBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return b... | GCPBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return b... |
@Test public void postProcessAfterInitializationWithConfigurationBeanProviderPathIsNotNull() throws Exception { String beanName = CommonBeans.BEAN_BASE_CONF; when(credentialPathProvider.newPath()).thenReturn(new Path("/test.json")); when(fileSystemFactory.getFileSystem(configuration)).thenReturn(fileSystem); processor.... | @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return bean; } | GCPBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return b... | GCPBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return b... | GCPBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return b... | GCPBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return b... |
@Test public void postProcessAfterInitializationWithConfigurationBeanProviderPathIsNull() throws Exception { String beanName = CommonBeans.BEAN_BASE_CONF; when(credentialPathProvider.newPath()).thenReturn(null); processor.postProcessAfterInitialization(configuration, beanName); verifyZeroInteractions(bindGoogleHadoopFi... | @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return bean; } | GCPBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return b... | GCPBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return b... | GCPBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return b... | GCPBeanPostProcessor implements BeanPostProcessor { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { if (CommonBeans.BEAN_BASE_CONF.equals(beanName)) { Configuration baseConf = (Configuration) bean; setHadoopConfiguration(baseConf); return baseConf; } return b... |
@Test public void getAssumedRoleDefaultIsNull() throws Exception { S3S3CopierOptions options = new S3S3CopierOptions(copierOptions); assertNull(options.getAssumedRole()); } | public String getAssumedRole() { return MapUtils.getString(copierOptions, Keys.ASSUME_ROLE.keyName(), null); } | S3S3CopierOptions { public String getAssumedRole() { return MapUtils.getString(copierOptions, Keys.ASSUME_ROLE.keyName(), null); } } | S3S3CopierOptions { public String getAssumedRole() { return MapUtils.getString(copierOptions, Keys.ASSUME_ROLE.keyName(), null); } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); } | S3S3CopierOptions { public String getAssumedRole() { return MapUtils.getString(copierOptions, Keys.ASSUME_ROLE.keyName(), null); } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); void setMaxThreadPoolSize(int maxThreadPoolSize); int getMaxThreadPoolSize(); Long getMultipartCopyThreshold(); L... | S3S3CopierOptions { public String getAssumedRole() { return MapUtils.getString(copierOptions, Keys.ASSUME_ROLE.keyName(), null); } S3S3CopierOptions(); S3S3CopierOptions(Map<String, Object> copierOptions); void setMaxThreadPoolSize(int maxThreadPoolSize); int getMaxThreadPoolSize(); Long getMultipartCopyThreshold(); L... |
@Test public void copyCredentialsWithCredentialProviderSupplied() throws Exception { copier.copyCredentials(fileSystem, conf, credentialPathProvider, distributedFileSystemPathProvider); verify(fileSystem).copyFromLocalFile(credentialsFileRelativePath, dfsAbsolutePath); verify(fileSystem).deleteOnExit(dfsDirectory); ass... | public void copyCredentials( FileSystem fs, Configuration conf, GCPCredentialPathProvider credentialPathProvider, DistributedFileSystemPathProvider dfsPathProvider) { try { Path source = credentialPathProvider.newPath(); Path destination = dfsPathProvider.newPath(conf); copyCredentialIntoHdfs(fs, source, destination); ... | GCPCredentialCopier { public void copyCredentials( FileSystem fs, Configuration conf, GCPCredentialPathProvider credentialPathProvider, DistributedFileSystemPathProvider dfsPathProvider) { try { Path source = credentialPathProvider.newPath(); Path destination = dfsPathProvider.newPath(conf); copyCredentialIntoHdfs(fs, ... | GCPCredentialCopier { public void copyCredentials( FileSystem fs, Configuration conf, GCPCredentialPathProvider credentialPathProvider, DistributedFileSystemPathProvider dfsPathProvider) { try { Path source = credentialPathProvider.newPath(); Path destination = dfsPathProvider.newPath(conf); copyCredentialIntoHdfs(fs, ... | GCPCredentialCopier { public void copyCredentials( FileSystem fs, Configuration conf, GCPCredentialPathProvider credentialPathProvider, DistributedFileSystemPathProvider dfsPathProvider) { try { Path source = credentialPathProvider.newPath(); Path destination = dfsPathProvider.newPath(conf); copyCredentialIntoHdfs(fs, ... | GCPCredentialCopier { public void copyCredentials( FileSystem fs, Configuration conf, GCPCredentialPathProvider credentialPathProvider, DistributedFileSystemPathProvider dfsPathProvider) { try { Path source = credentialPathProvider.newPath(); Path destination = dfsPathProvider.newPath(conf); copyCredentialIntoHdfs(fs, ... |
@Test(expected = CircusTrainException.class) public void copyCredentialsWhenFileDoesntExistThrowsException() throws Exception { doThrow(new IOException("File does not exist")) .when(fileSystem) .copyFromLocalFile(any(Path.class), any(Path.class)); copier.copyCredentials(fileSystem, conf, credentialPathProvider, distrib... | public void copyCredentials( FileSystem fs, Configuration conf, GCPCredentialPathProvider credentialPathProvider, DistributedFileSystemPathProvider dfsPathProvider) { try { Path source = credentialPathProvider.newPath(); Path destination = dfsPathProvider.newPath(conf); copyCredentialIntoHdfs(fs, source, destination); ... | GCPCredentialCopier { public void copyCredentials( FileSystem fs, Configuration conf, GCPCredentialPathProvider credentialPathProvider, DistributedFileSystemPathProvider dfsPathProvider) { try { Path source = credentialPathProvider.newPath(); Path destination = dfsPathProvider.newPath(conf); copyCredentialIntoHdfs(fs, ... | GCPCredentialCopier { public void copyCredentials( FileSystem fs, Configuration conf, GCPCredentialPathProvider credentialPathProvider, DistributedFileSystemPathProvider dfsPathProvider) { try { Path source = credentialPathProvider.newPath(); Path destination = dfsPathProvider.newPath(conf); copyCredentialIntoHdfs(fs, ... | GCPCredentialCopier { public void copyCredentials( FileSystem fs, Configuration conf, GCPCredentialPathProvider credentialPathProvider, DistributedFileSystemPathProvider dfsPathProvider) { try { Path source = credentialPathProvider.newPath(); Path destination = dfsPathProvider.newPath(conf); copyCredentialIntoHdfs(fs, ... | GCPCredentialCopier { public void copyCredentials( FileSystem fs, Configuration conf, GCPCredentialPathProvider credentialPathProvider, DistributedFileSystemPathProvider dfsPathProvider) { try { Path source = credentialPathProvider.newPath(); Path destination = dfsPathProvider.newPath(conf); copyCredentialIntoHdfs(fs, ... |
@Test public void supportSchemes() { DistCpCopierFactory factory = new DistCpCopierFactory(conf, metricRegistry); assertThat(factory.supportsSchemes("hdfs", "s3a"), is(true)); assertThat(factory.supportsSchemes("hdfs", "s3"), is(true)); assertThat(factory.supportsSchemes("hdfs", "s3n"), is(true)); assertThat(factory.su... | @Override public boolean supportsSchemes(String sourceScheme, String replicaScheme) { return true; } | DistCpCopierFactory implements CopierFactory { @Override public boolean supportsSchemes(String sourceScheme, String replicaScheme) { return true; } } | DistCpCopierFactory implements CopierFactory { @Override public boolean supportsSchemes(String sourceScheme, String replicaScheme) { return true; } @Autowired DistCpCopierFactory(@Value("#{sourceHiveConf}") Configuration conf, MetricRegistry runningMetricsRegistry); } | DistCpCopierFactory implements CopierFactory { @Override public boolean supportsSchemes(String sourceScheme, String replicaScheme) { return true; } @Autowired DistCpCopierFactory(@Value("#{sourceHiveConf}") Configuration conf, MetricRegistry runningMetricsRegistry); @Override boolean supportsSchemes(String sourceSchem... | DistCpCopierFactory implements CopierFactory { @Override public boolean supportsSchemes(String sourceScheme, String replicaScheme) { return true; } @Autowired DistCpCopierFactory(@Value("#{sourceHiveConf}") Configuration conf, MetricRegistry runningMetricsRegistry); @Override boolean supportsSchemes(String sourceSchem... |
@Test public void hdfsTableCopier() { DistCpCopierFactory factory = new DistCpCopierFactory(conf, metricRegistry); Copier copier = factory.newInstance("evt-123", new Path("confLocation"), Collections.<Path> emptyList(), new Path("hdfs:/replicaLocation"), copierOptions); assertEquals(DistCpCopier.class, copier.getClass(... | @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } } | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... |
@Test public void fileTableCopier() { DistCpCopierFactory factory = new DistCpCopierFactory(conf, metricRegistry); Copier copier = factory.newInstance("evt-123", new Path("confLocation"), Collections.<Path> emptyList(), new Path("file:/replicaLocation"), copierOptions); assertEquals(DistCpCopier.class, copier.getClass(... | @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } } | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... |
@Test public void s3aTableCopier() { DistCpCopierFactory factory = new DistCpCopierFactory(conf, metricRegistry); Copier copier = factory.newInstance("evt-123", new Path("confLocation"), Collections.<Path> emptyList(), new Path("s3a:/replicaLocation"), copierOptions); assertEquals(DistCpCopier.class, copier.getClass())... | @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } } | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... |
@Test public void s3TableCopier() { DistCpCopierFactory factory = new DistCpCopierFactory(conf, metricRegistry); Copier copier = factory.newInstance("evt-123", new Path("confLocation"), Collections.<Path> emptyList(), new Path("s3:/replicaLocation"), copierOptions); assertEquals(DistCpCopier.class, copier.getClass()); ... | @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } } | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... |
@Test public void s3nTableCopier() { DistCpCopierFactory factory = new DistCpCopierFactory(conf, metricRegistry); Copier copier = factory.newInstance("evt-123", new Path("confLocation"), Collections.<Path> emptyList(), new Path("s3n:/replicaLocation"), copierOptions); assertEquals(DistCpCopier.class, copier.getClass())... | @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } } | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... | DistCpCopierFactory implements CopierFactory { @Override public Copier newInstance(CopierContext copierContext) { return new DistCpCopier(conf, copierContext.getSourceBaseLocation(), copierContext.getSourceSubLocations(), copierContext.getReplicaLocation(), copierContext.getCopierOptions(), runningMetricsRegistry); } @... |
@Test public void checkSupportsHdfs() { sourceLocation = hdfsPath; replicaLocation = hdfsPath; assertTrue(dataManipulatorFactory.supportsSchemes(sourceLocation, replicaLocation)); } | @Override public boolean supportsSchemes(String sourceScheme, String replicaScheme) { return true; } | HdfsDataManipulatorFactory implements DataManipulatorFactory { @Override public boolean supportsSchemes(String sourceScheme, String replicaScheme) { return true; } } | HdfsDataManipulatorFactory implements DataManipulatorFactory { @Override public boolean supportsSchemes(String sourceScheme, String replicaScheme) { return true; } @Autowired HdfsDataManipulatorFactory(@Value("#{replicaHiveConf}") Configuration conf); } | HdfsDataManipulatorFactory implements DataManipulatorFactory { @Override public boolean supportsSchemes(String sourceScheme, String replicaScheme) { return true; } @Autowired HdfsDataManipulatorFactory(@Value("#{replicaHiveConf}") Configuration conf); @Override DataManipulator newInstance(Path path, Map<String, Object... | HdfsDataManipulatorFactory implements DataManipulatorFactory { @Override public boolean supportsSchemes(String sourceScheme, String replicaScheme) { return true; } @Autowired HdfsDataManipulatorFactory(@Value("#{replicaHiveConf}") Configuration conf); @Override DataManipulator newInstance(Path path, Map<String, Object... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.