auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public <T> T data(LightblueRequest lightblueRequest, Class<T> type) throws IOException { LightblueResponse response = data(lightblueRequest); JsonNode responseJson = response.getJson(); JsonNode objectType = responseJson.get("objectType"); if (objectType != null && "error".equalsIgnoreCase(objectType.textValue())) { throw new RuntimeException("Error in lightblue response: " + responseJson.toString()); } JsonNode responseNode = responseJson.path("processed"); if (responseNode instanceof MissingNode || (responseNode instanceof ArrayNode && responseNode.size() == 0 && !type.isArray())) { return null; } try { return mapper.readValue(responseNode.traverse(), type); } catch (JsonMappingException e) { LOGGER.error("Error parsing lightblue response: " + responseJson.toString(), e); throw new RuntimeException("Error parsing lightblue response: " + responseJson.toString()); } }

Target:
public <T> T data(LightblueRequest lightblueRequest, Class<T> type) throws IOException { LightblueResponse response = data(lightblueRequest); try { return response.parseProcessed(type); } catch (RuntimeException | LightblueResponseParseException e) { throw new LightblueHttpClientException("Error sending lightblue request: " + lightblueRequest.getBody(), e); } }
Source:
public void runTask() { JobConfig jobConfig = new JobConfig(this.config); String taskName = new TaskConfig(config).getTaskClass().get(); if (taskName == null) { throw new SamzaException("Neither APP nor task.class are defined defined"); } LOG.info("LocalApplicationRunner will run " + taskName); LocalStreamProcessorLifeCycleListener listener = new LocalStreamProcessorLifeCycleListener(); StreamProcessor processor = createStreamProcessor(jobConfig, null, listener); listener.setProcessor(processor); processor.start(); }

Target:
public void runTask() { JobConfig jobConfig = new JobConfig(this.config); String taskName = new TaskConfig(config).getTaskClass().getOrElse(null); if (taskName == null) { throw new SamzaException("Neither APP nor task.class are defined defined"); } LOG.info("LocalApplicationRunner will run " + taskName); LocalStreamProcessorLifeCycleListener listener = new LocalStreamProcessorLifeCycleListener(); StreamProcessor processor = createStreamProcessor(jobConfig, null, listener); numProcessorsToStart.set(1); listener.setProcessor(processor); processor.start(); }
Source:
public void testValidationChecksumBuilderChecksumEmptyCollection() { final Log log = mock(Log.class); final Builder builder = new ValidationChecksum.Builder(log, checksumdirectory); final ValidationChecksum checksum = builder.checksum(emptyList()); assertNotNull(checksum); assertFalse(checksum.checkValidation()); }

Target:
public void testValidationChecksumBuilderChecksumEmptyCollection() { final Builder builder = new ValidationChecksum.Builder().destination(checksumdirectory); final ValidationChecksum checksum = builder.artifacts(emptyList()).build(); assertThat(checksum).isNotNull(); assertThat(checksum.checkValidation()).isFalse(); }
Source:
private SegmentNameGenerator getSegmentNameGenerator(TableConfig tableConfig, Schema schema, SegmentConfig segmentConfig) { String rawTableName = TableNameBuilder.extractRawTableName(tableConfig.getTableName()); String segmentNameGeneratorType = segmentConfig.getSegmentNameGeneratorType(); if (segmentNameGeneratorType == null) { segmentNameGeneratorType = SIMPLE_SEGMENT_NAME_GENERATOR; } switch (segmentNameGeneratorType) { case SIMPLE_SEGMENT_NAME_GENERATOR: return new SimpleSegmentNameGenerator(rawTableName, segmentConfig.getSegmentPostfix()); case NORMALIZED_DATE_SEGMENT_NAME_GENERATOR: Preconditions.checkState(tableConfig != null, "In order to use NormalizedDateSegmentNameGenerator, table config must be provided"); SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig(); DateTimeFormatSpec dateTimeFormatSpec = null; String timeColumnName = tableConfig.getValidationConfig().getTimeColumnName(); if (timeColumnName != null) { DateTimeFieldSpec dateTimeFieldSpec = schema.getSpecForTimeColumn(timeColumnName); if (dateTimeFieldSpec != null) { dateTimeFormatSpec = new DateTimeFormatSpec(dateTimeFieldSpec.getFormat()); } } return new NormalizedDateSegmentNameGenerator(rawTableName, segmentConfig.getSegmentPrefix(), segmentConfig.getExcludeSequenceId(), validationConfig.getSegmentPushType(), validationConfig.getSegmentPushFrequency(), dateTimeFormatSpec, segmentConfig.getSegmentPostfix()); default: throw new UnsupportedOperationException("Unsupported segment name generator type: " + segmentNameGeneratorType); } }

Target:
private SegmentNameGenerator getSegmentNameGenerator(TableConfig tableConfig, Schema schema, SegmentConfig segmentConfig) { String rawTableName = TableNameBuilder.extractRawTableName(tableConfig.getTableName()); String segmentNameGeneratorType = segmentConfig.getSegmentNameGeneratorType(); if (segmentNameGeneratorType == null) { segmentNameGeneratorType = SIMPLE_SEGMENT_NAME_GENERATOR; } switch (segmentNameGeneratorType) { case SIMPLE_SEGMENT_NAME_GENERATOR: return new SimpleSegmentNameGenerator(rawTableName, segmentConfig.getSegmentPostfix()); case NORMALIZED_DATE_SEGMENT_NAME_GENERATOR: SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig(); DateTimeFormatSpec dateTimeFormatSpec = null; String timeColumnName = tableConfig.getValidationConfig().getTimeColumnName(); if (timeColumnName != null) { DateTimeFieldSpec dateTimeFieldSpec = schema.getSpecForTimeColumn(timeColumnName); if (dateTimeFieldSpec != null) { dateTimeFormatSpec = new DateTimeFormatSpec(dateTimeFieldSpec.getFormat()); } } return new NormalizedDateSegmentNameGenerator(rawTableName, segmentConfig.getSegmentPrefix(), segmentConfig.getExcludeSequenceId(), validationConfig.getSegmentPushType(), validationConfig.getSegmentPushFrequency(), dateTimeFormatSpec, segmentConfig.getSegmentPostfix()); default: throw new UnsupportedOperationException("Unsupported segment name generator type: " + segmentNameGeneratorType); } }
Source:
public void extractSingle() { assertEquals(foo, new Or<String>( new And<String>(foo, bar), foo ).simplify()); }

Target:
public void extractSingle() { assertEquals(foo, new Or<>( new And<>(foo, bar), foo ).simplify()); }
Source:
public TransactionAndImmutableTsLock setupRunTaskWithConditionThrowOnConflict(PreCommitCondition condition) { StartTransactionWithWatchesResponse responseWithWatches = timelockService .startTransactionWithWatches(OptionalLong.empty()); StartIdentifiedAtlasDbTransactionResponse transactionResponse = responseWithWatches.response(); try { LockToken immutableTsLock = transactionResponse.immutableTimestamp().getLock(); long immutableTs = transactionResponse.immutableTimestamp().getImmutableTimestamp(); recordImmutableTimestamp(immutableTs); cleaner.punch(transactionResponse.startTimestampAndPartition().timestamp()); Supplier<Long> startTimestampSupplier = Suppliers.ofInstance( transactionResponse.startTimestampAndPartition().timestamp()); Transaction transaction = createTransaction( immutableTs, startTimestampSupplier, immutableTsLock, condition); return TransactionAndImmutableTsLock.of(transaction, immutableTsLock); } catch (Throwable e) { timelockService.tryUnlock(ImmutableSet.of(transactionResponse.immutableTimestamp().getLock())); throw Throwables.rewrapAndThrowUncheckedException(e); } }

Target:
public TransactionAndImmutableTsLock setupRunTaskWithConditionThrowOnConflict(PreCommitCondition condition) { StartIdentifiedAtlasDbTransactionResponse transactionResponse = timelockService.startIdentifiedAtlasDbTransaction(); try { LockToken immutableTsLock = transactionResponse.immutableTimestamp().getLock(); long immutableTs = transactionResponse.immutableTimestamp().getImmutableTimestamp(); recordImmutableTimestamp(immutableTs); cleaner.punch(transactionResponse.startTimestampAndPartition().timestamp()); Supplier<Long> startTimestampSupplier = Suppliers.ofInstance( transactionResponse.startTimestampAndPartition().timestamp()); Transaction transaction = createTransaction( immutableTs, startTimestampSupplier, immutableTsLock, condition); return TransactionAndImmutableTsLock.of(transaction, immutableTsLock); } catch (Throwable e) { timelockService.tryUnlock(ImmutableSet.of(transactionResponse.immutableTimestamp().getLock())); throw Throwables.rewrapAndThrowUncheckedException(e); } }
Source:
public void testQueueConsumerPriority() throws JMSException, InterruptedException { connection.start(); Session consumerLowPriority = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session consumerHighPriority = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); assertNotNull(consumerHighPriority); Session senderSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); String queueName = "QUEUE.A"; ActiveMQQueue low = new ActiveMQQueue(queueName + "?consumer.priority=1"); MessageConsumer lowConsumer = consumerLowPriority.createConsumer(low); ActiveMQQueue high = new ActiveMQQueue(queueName + "?consumer.priority=2"); MessageConsumer highConsumer = consumerLowPriority.createConsumer(high); ActiveMQQueue senderQueue = new ActiveMQQueue(queueName); MessageProducer producer = senderSession.createProducer(senderQueue); Message msg = senderSession.createTextMessage("test"); for (int i = 0; i < 1000; i++) { producer.send(msg); assertNotNull("null on iteration: " + i, highConsumer.receive(1000)); } assertNull(lowConsumer.receive(2000)); }

Target:
public void testQueueConsumerPriority() throws JMSException, InterruptedException { connection.start(); Session consumerLowPriority = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session consumerHighPriority = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); assertNotNull(consumerHighPriority); Session senderSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); String queueName = "QUEUE.A"; ActiveMQQueue low = new ActiveMQQueue(queueName + "?consumer.priority=1"); MessageConsumer lowConsumer = consumerLowPriority.createConsumer(low); ActiveMQQueue high = new ActiveMQQueue(queueName + "?consumer.priority=2"); MessageConsumer highConsumer = consumerLowPriority.createConsumer(high); ActiveMQQueue senderQueue = new ActiveMQQueue(queueName); MessageProducer producer = senderSession.createProducer(senderQueue); Message msg = senderSession.createTextMessage("test"); for (int i = 0; i < 1000; i++) { producer.send(msg); assertNotNull("null on iteration: " + i, highConsumer.receive(1000)); } assertNull(lowConsumer.receive(250)); }
Source:
private String getUriExceptionText(Configuration conf) { final String URI_EXCEPTION_TEXT = "Ozone file system URL " + "should be one of the following formats: " + "o3fs://bucket.volume/key OR " + "o3fs://bucket.volume.om-host.example.com/key OR " + "o3fs://bucket.volume.om-host.example.com:" + OmUtils.getOmRpcPort(conf) + "/key"; return URI_EXCEPTION_TEXT; }

Target:
private String getUriExceptionText(Configuration conf) { return "Ozone file system URL should be one of the following formats: " + "o3fs://bucket.volume/key OR " + "o3fs://bucket.volume.om-host.example.com/key OR " + "o3fs://bucket.volume.om-host.example.com:" + OmUtils.getOmRpcPort(getOzoneConf(conf)) + "/key"; }
Source:
public void removeDeploymentGroup(final String name) throws DeploymentGroupDoesNotExistException { log.info("removing deployment-group: name={}", name); final ZooKeeperClient client = provider.get("removeDeploymentGroup"); try { client.ensurePath(Paths.configDeploymentGroups()); client.ensurePath(Paths.statusDeploymentGroups()); final List<ZooKeeperOperation> operations = Lists.newArrayList(); operations.add(delete(Paths.configDeploymentGroup(name))); operations.add(delete(Paths.statusDeploymentGroupHosts(name))); operations.add(delete(Paths.statusDeploymentGroupRollingOps(name))); operations.add(delete(Paths.statusDeploymentGroup(name))); client.transaction(operations); } catch (final NoNodeException e) { throw new DeploymentGroupDoesNotExistException(name); } catch (final KeeperException e) { throw new HeliosRuntimeException("removing deployment-group " + name + " failed", e); } }

Target:
public void removeDeploymentGroup(final String name) throws DeploymentGroupDoesNotExistException { log.info("removing deployment-group: name={}", name); final ZooKeeperClient client = provider.get("removeDeploymentGroup"); try { client.ensurePath(Paths.configDeploymentGroups()); client.ensurePath(Paths.statusDeploymentGroups()); final List<ZooKeeperOperation> operations = Lists.newArrayList(); for (final String id : getRollingOperationIds(client, name)) { removeRollingOperation(client, operations, id); } operations.add(delete(Paths.configDeploymentGroup(name))); operations.add(delete(Paths.statusDeploymentGroupHosts(name))); operations.add(delete(Paths.statusDeploymentGroupRollingOps(name))); operations.add(delete(Paths.statusDeploymentGroup(name))); client.transaction(operations); } catch (final NoNodeException e) { throw new DeploymentGroupDoesNotExistException(name); } catch (final KeeperException e) { throw new HeliosRuntimeException("removing deployment-group " + name + " failed", e); } }
Source:
public void initBiomeGensRTG(WorldTypeEvent.InitBiomeGens event) { if (!(event.worldType instanceof WorldTypeRTG)) { return; } if (event.newBiomeGens[0].getClass().getName().contains("GenLayerEB")) { return; } try { event.newBiomeGens = new RiverRemover().riverLess(event.originalBiomeGens); } catch (ClassCastException ex) { } }

Target:
public void initBiomeGensRTG(WorldTypeEvent.InitBiomeGens event) { if (!(event.worldType instanceof WorldTypeRTG)) { unRegisterEventHandlers(); return; } if (event.newBiomeGens[0].getClass().getName().contains("GenLayerEB")) { return; } try { event.newBiomeGens = new RiverRemover().riverLess(event.originalBiomeGens); } catch (ClassCastException ex) { } }
Source:
public void start() throws Exception { Router router = Router.router(vertx); router.route().handler(BodyHandler.create()); router.route("/").handler(routingContext -> { routingContext.response().putHeader("content-type", "text/html").end( "<form action=\"/form\" method=\"post\">\n" + " <div>\n" + " <label for=\"name\">Enter your name:</label>\n" + " <input type=\"text\" id=\"name\" name=\"name\" />\n" + " </div>\n" + " <div class=\"button\">\n" + " <button type=\"submit\">Send</button>\n" + " </div>" + "</form>" ); }); router.post("/form").handler(ctx -> { ctx.response().putHeader(HttpHeaders.CONTENT_TYPE, "text/plain"); ctx.response().end("Hello " + ctx.request().getFormAttribute("name") + "!"); }); vertx.createHttpServer().requestHandler(router::accept).listen(8080); }

Target:
public void start() throws Exception { Router router = Router.router(vertx); router.route().handler(BodyHandler.create()); router.route("/").handler(routingContext -> { routingContext.response().putHeader("content-type", "text/html").end( "<form action=\"/form\" method=\"post\">\n" + " <div>\n" + " <label for=\"name\">Enter your name:</label>\n" + " <input type=\"text\" id=\"name\" name=\"name\" />\n" + " </div>\n" + " <div class=\"button\">\n" + " <button type=\"submit\">Send</button>\n" + " </div>" + "</form>" ); }); router.post("/form").handler(ctx -> { ctx.response().putHeader(HttpHeaders.CONTENT_TYPE, "text/plain"); ctx.response().end("Hello " + ctx.request().getParam("name") + "!"); }); vertx.createHttpServer().requestHandler(router::accept).listen(8080); }
Source:
public long run (String start, String end) { voltQueueSQL(selAcct, EXPECT_NON_EMPTY, start, end); voltQueueSQL(selActv, start, end); VoltTable results[] = voltExecuteSQL(true); return 1; }

Target:
public long run (String start, String end) { int startPan = Integer.parseInt(start); int endPan = Integer.parseInt(end); double totalBalance = 0; double totalTransfer = 0; voltQueueSQL(selAcct, EXPECT_NON_EMPTY, start, end); voltQueueSQL(selActv, start, end); VoltTable results[] = voltExecuteSQL(true); VoltTable tb1 = results[0]; while (tb1.advanceRow()) { totalBalance += tb1.getDouble(3); } VoltTable tb2 = results[1]; while (tb2.advanceRow()) { totalTransfer += tb2.getDouble(4); } return totalTransfer > totalBalance ? 1 : 0; }
Source:
public void makeString(Token t, int quotes, Str strToFill) { String s = t.image; char quoteChar = s.charAt(0); int start = 0; boolean ustring = false; boolean bstring = false; boolean fstring = false; if (quoteChar == 'u' || quoteChar == 'U') { ustring = true; start++; } else if (quoteChar == 'b' || quoteChar == 'B') { bstring = true; start++; } else if (quoteChar == 'f' || quoteChar == 'F') { fstring = true; start++; } quoteChar = s.charAt(start); if (quoteChar == 'r' || quoteChar == 'R') { if (start == 0) { char quoteCharAux = s.charAt(1); if (quoteCharAux == 'f' || quoteCharAux == 'F') { fstring = true; start++; } else if (quoteCharAux == 'b' || quoteCharAux == 'B') { bstring = true; start++; } } String str; if (bstring) { str = 'b' + s.substring(quotes + start, s.length() - quotes + 1); } else { str = s.substring(quotes + start + 1, s.length() - quotes); } strToFill.type = getType(s.charAt(start + 1), quotes); strToFill.s = str; strToFill.unicode = ustring; strToFill.raw = true; strToFill.binary = bstring; strToFill.fstring = fstring; } else { int n = s.length() - quotes; int i = quotes + start; String str = s.substring(i, n); strToFill.type = getType(s.charAt(start), quotes); strToFill.s = str; strToFill.unicode = ustring; strToFill.raw = false; strToFill.binary = bstring; strToFill.fstring = fstring; } }

Target:
public void makeString(Token t, int quotes, Str strToFill) { String s = t.image; char quoteChar = s.charAt(0); int start = 0; boolean ustring = false; boolean bstring = false; boolean fstring = false; if (quoteChar == 'u' || quoteChar == 'U') { ustring = true; start++; } else if (quoteChar == 'b' || quoteChar == 'B') { bstring = true; start++; } else if (quoteChar == 'f' || quoteChar == 'F') { fstring = true; start++; } quoteChar = s.charAt(start); if (quoteChar == 'r' || quoteChar == 'R') { if (start == 0) { char quoteCharAux = s.charAt(1); if (quoteCharAux == 'f' || quoteCharAux == 'F') { fstring = true; start++; } else if (quoteCharAux == 'b' || quoteCharAux == 'B') { bstring = true; start++; } } String str = s.substring(quotes + start + 1, s.length() - quotes); strToFill.type = getType(s.charAt(start + 1), quotes); strToFill.s = str; strToFill.unicode = ustring; strToFill.raw = true; strToFill.binary = bstring; strToFill.fstring = fstring; } else { int n = s.length() - quotes; int i = quotes + start; String str = s.substring(i, n); strToFill.type = getType(s.charAt(start), quotes); strToFill.s = str; strToFill.unicode = ustring; strToFill.raw = false; strToFill.binary = bstring; strToFill.fstring = fstring; } }
Source:
protected void setUp() throws Exception { super.setUp(); if(!hasWifi()) { return; } mWifiManager = (WifiManager) mContext .getSystemService(Context.WIFI_SERVICE); assertNotNull(mWifiManager); SystemUtil.runShellCommand("svc wifi enable"); Thread.sleep(ENABLE_DELAY); if (hasWifi()) { assertTrue(mWifiManager.isWifiEnabled()); } }

Target:
protected void setUp() throws Exception { super.setUp(); if(!hasWifi()) { return; } mWifiManager = (WifiManager) mContext .getSystemService(Context.WIFI_SERVICE); assertNotNull(mWifiManager); SystemUtil.runShellCommand("svc wifi enable"); Thread.sleep(ENABLE_DELAY); assertTrue(mWifiManager.isWifiEnabled()); }
Source:
public Message getMessage() { return message; }

Target:
public Message<?> getMessage() { return message; }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); appendModifier(sb, dynamicEMFMode, DYNAMIC_EMF_MODE_DEFAULT, "dynamicEMF"); appendModifier(sb, wildcardMode, WILDCARD_MODE_DEFAULT, "wildcard"); appendModifier(sb, traverseOnlyWellBehavingDerivedFeatures, TRAVERS_ONLY_WELLBEHAVING_DERIVED_FEATURES_DEFAULT, "wellBehavingOnly"); appendModifier(sb, notifierFilterConfiguration, null, "notifierFilter="); appendModifier(sb, resourceFilterConfiguration, null, "resourceFilter="); appendModifier(sb, featureFilterConfiguration, null, "featureFilterConfiguration="); appendModifier(sb, strictNotificationMode, STRICT_NOTIFICATION_MODE_DEFAULT, "strictNotificationMode"); final String result = sb.toString(); return result.isEmpty() ? "defaults" : result; }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); appendModifier(sb, dynamicEMFMode, DYNAMIC_EMF_MODE_DEFAULT, "dynamicEMF"); appendModifier(sb, wildcardMode, WILDCARD_MODE_DEFAULT, "wildcard"); appendModifier(sb, traverseOnlyWellBehavingDerivedFeatures, TRAVERS_ONLY_WELLBEHAVING_DERIVED_FEATURES_DEFAULT, "wellBehavingOnly"); appendModifier(sb, strictNotificationMode, STRICT_NOTIFICATION_MODE_DEFAULT, "strictNotificationMode"); appendModifier(sb, notifierFilterConfiguration, null, "notifierFilter="); appendModifier(sb, resourceFilterConfiguration, null, "resourceFilter="); appendModifier(sb, featureFilterConfiguration, null, "featureFilterConfiguration="); final String result = sb.toString(); return result.isEmpty() ? "defaults" : result; }
Source:
public void handleRequest(final HttpServerExchange exchange) throws Exception { boolean decodeDone = exchange.getConnection().getUndertowOptions().get(UndertowOptions.DECODE_URL, true); if (!decodeDone) { final StringBuilder sb = getStringBuilderForDecoding(exchange); decodePath(exchange, charset, sb); decodeQueryString(exchange, charset, sb); decodePathTemplateMatch(exchange, charset, sb); } next.handleRequest(exchange); }

Target:
public void handleRequest(final HttpServerExchange exchange) throws Exception { if (shouldDecode(exchange)) { final StringBuilder sb = getStringBuilderForDecoding(exchange); decodePath(exchange, charset, sb); decodeQueryString(exchange, charset, sb); decodePathTemplateMatch(exchange, charset, sb); } next.handleRequest(exchange); }
Source:
public static ITextWrapper get(final TextWrapperStrategy strategy, final Text text) { switch (strategy) { case BOUNDS_AND_LINE_BREAKS: return new TextBoundsAndLineBreaksWrap(text); case LINE_BREAK: return new TextLineBreakWrap(text); case NO_WRAP: return new TextNoWrap(text); case TRUNCATE: return new TextTruncateWrapper(text, new BoundingBox(0, 0, 1, 1)); default: case BOUNDS: return new TextBoundsWrap(text); } }

Target:
public static ITextWrapper get(final TextWrapperStrategy strategy, final Text text) { switch (strategy) { case BOUNDS_AND_LINE_BREAKS: return new TextBoundsAndLineBreaksWrap(text); case LINE_BREAK: return new TextLineBreakWrap(text); case NO_WRAP: return new TextNoWrap(text); case TRUNCATE: return new TextTruncateWrapper(text, new BoundingBox(0, 0, 1, 1)); default: return new TextBoundsWrap(text); } }
Source:
public void testGetAllEmptyRequestWithLoader() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); final FakeCacheLoaderWriter fakeLoaderWriter = new FakeCacheLoaderWriter(TEST_ENTRIES); this.loaderWriter = spy(fakeLoaderWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.loaderWriter); final Map<String, String> actual = ehcache.getAll(Collections.<String>emptySet()); final Map<String, String> expected = Collections.emptyMap(); assertThat(actual, equalTo(expected)); verify(this.store, never()).bulkComputeIfAbsent(eq(Collections.<String>emptySet()), getAnyIterableFunction()); verify(this.spiedResilienceStrategy, never()) .getAllFailure(eq(Collections.<String>emptySet()), any(CacheAccessException.class)); verifyZeroInteractions(this.store, this.spiedResilienceStrategy, this.loaderWriter); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoadingOutcome.class)); }

Target:
public void testGetAllEmptyRequestWithLoader() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); final FakeCacheLoaderWriter fakeLoaderWriter = new FakeCacheLoaderWriter(TEST_ENTRIES); this.loaderWriter = spy(fakeLoaderWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.loaderWriter); final Map<String, String> actual = ehcache.getAll(Collections.<String>emptySet()); final Map<String, String> expected = Collections.emptyMap(); assertThat(actual, equalTo(expected)); verify(this.store, never()).bulkComputeIfAbsent(eq(Collections.<String>emptySet()), getAnyIterableFunction()); verify(this.spiedResilienceStrategy, never()).getAllFailure(eq(Collections.<String>emptySet()), any(CacheAccessException.class)); verify(this.loaderWriter, never()).loadAll(eq(Collections.<String>emptySet())); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoadingOutcome.class)); }
Source:
public CorfuTable(IndexRegistry<K, V> indices, Supplier<StreamingMap<K, V>> streamingMapSupplier) { this.indexSpec = new HashSet<>(); this.secondaryIndexes = new HashMap<>(); this.mainMap = streamingMapSupplier.get(); this.optimisticTable = new CorfuTable<>(this.mainMap.getOptimisticMap(), this.indexSpec, this.secondaryIndexes, null); indices.forEach(index -> { secondaryIndexes.put(index.getName().get(), new HashMap<>()); indexSpec.add(index); }); log.info("CorfuTable: creating CorfuTable with the following indexes: {}", secondaryIndexes.keySet()); }

Target:
public CorfuTable(IndexRegistry<K, V> indices, Supplier<StreamingMap<K, V>> streamingMapSupplier) { this(indices, streamingMapSupplier, ICorfuVersionPolicy.DEFAULT); }
Source:
private CircuitBreakerMetrics(String prefix, Iterable<CircuitBreaker> circuitBreakers) { requireNonNull(prefix); requireNonNull(circuitBreakers); circuitBreakers.forEach(circuitBreaker -> { String name = circuitBreaker.getName(); CircuitBreaker.Metrics metrics = circuitBreaker.getMetrics(); metricRegistry.register(name(prefix, name, STATE), (Gauge<Integer>)()-> circuitBreaker.getState().ordinal()); metricRegistry.register(name(prefix, name, SUCCESSFUL), (Gauge<Integer>) metrics::getNumberOfSuccessfulCalls); metricRegistry.register(name(prefix, name, FAILED), (Gauge<Integer>) metrics::getNumberOfFailedCalls); metricRegistry.register(name(prefix, name, NOT_PERMITTED), (Gauge<Long>) metrics::getNumberOfNotPermittedCalls); metricRegistry.register(name(prefix, name, BUFFERED), (Gauge<Integer>) metrics::getNumberOfBufferedCalls); metricRegistry.register(name(prefix, name, BUFFERED_MAX), (Gauge<Integer>) metrics::getMaxNumberOfBufferedCalls); } ); }

Target:
private CircuitBreakerMetrics(String prefix, Iterable<CircuitBreaker> circuitBreakers) { requireNonNull(prefix); requireNonNull(circuitBreakers); circuitBreakers.forEach(circuitBreaker -> { String name = circuitBreaker.getName(); CircuitBreaker.Metrics metrics = circuitBreaker.getMetrics(); metricRegistry.register(name(prefix, name, STATE), (Gauge<Integer>)()-> circuitBreaker.getState().getOrder()); metricRegistry.register(name(prefix, name, SUCCESSFUL), (Gauge<Integer>) metrics::getNumberOfSuccessfulCalls); metricRegistry.register(name(prefix, name, FAILED), (Gauge<Integer>) metrics::getNumberOfFailedCalls); metricRegistry.register(name(prefix, name, NOT_PERMITTED), (Gauge<Long>) metrics::getNumberOfNotPermittedCalls); metricRegistry.register(name(prefix, name, BUFFERED), (Gauge<Integer>) metrics::getNumberOfBufferedCalls); metricRegistry.register(name(prefix, name, BUFFERED_MAX), (Gauge<Integer>) metrics::getMaxNumberOfBufferedCalls); } ); }
Source:
public List<VDS> filter(SchedulingContext context, List<VDS> hosts, VM vm, PerHostMessages messages) { List<String> vmMDevs = getMDevsFromCustomProperties(vm); if (vmMDevs.isEmpty()) { return hosts; } List<VDS> list = new ArrayList<>(); for (VDS host : hosts) { List<MDevType> hostMDevs = getMDevsForHost(host, vmMDevs); List<String> missingMDevs = getMissingMDevsForHost(hostMDevs, vmMDevs); if (!missingMDevs.isEmpty()) { messages.addMessage(host.getId(), String.format("$missingMDevs %1$s", StringUtils.join(missingMDevs, ","))); messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__HOST_MDEV_DEVICE_MISSING.toString()); log.info("Host '{}' is missing required mDev devices ({}))", host.getName(), StringUtils.join(missingMDevs, ", ")); continue; } List<String> unavailableMDevs = getUnavailableMDevsForHost(hostMDevs, vmMDevs); if (!unavailableMDevs.isEmpty()) { messages.addMessage(host.getId(), String.format("$unavailableMDevs %1$s", StringUtils.join(unavailableMDevs, ","))); messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__HOST_MDEV_DEVICE_UNAVAILABLE.toString()); log.info("Host '{}' has required mDev devices with no available instances ({}))", host.getName(), StringUtils.join(missingMDevs, ", ")); continue; } list.add(host); } return list; }

Target:
public List<VDS> filter(SchedulingContext context, List<VDS> hosts, VM vm, PerHostMessages messages) { List<String> vmMDevs = getMDevsFromCustomProperties(vm); if (vmMDevs.isEmpty()) { return hosts; } List<VDS> list = new ArrayList<>(); for (VDS host : hosts) { List<MDevType> hostMDevs = getMDevsForHost(host, vmMDevs); List<String> missingMDevs = getMissingMDevsForHost(hostMDevs, vmMDevs); if (!missingMDevs.isEmpty()) { messages.addMessage(host.getId(), String.format("$missingMDevs %1$s", StringUtils.join(missingMDevs, ","))); messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__HOST_MDEV_DEVICE_MISSING.toString()); log.debug("Host '{}' is missing required mDev devices ({}))", host.getName(), StringUtils.join(missingMDevs, ", ")); continue; } List<String> unavailableMDevs = getUnavailableMDevsForHost(hostMDevs, vmMDevs); if (!unavailableMDevs.isEmpty()) { messages.addMessage(host.getId(), String.format("$unavailableMDevs %1$s", StringUtils.join(unavailableMDevs, ","))); messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__HOST_MDEV_DEVICE_UNAVAILABLE.toString()); log.debug("Host '{}' has required mDev devices with no available instances ({}))", host.getName(), StringUtils.join(missingMDevs, ", ")); continue; } list.add(host); } return list; }
Source:
private void collectPaths(Object o, List<IPath> result) { if (o instanceof Iterable<?>) { ((Iterable<?>) o).forEach(child -> collectPaths(child, result)); } else if (o instanceof StagingFolderEntry) { collectPaths(Arrays.asList(((StagingFolderEntry) o).getChildren()), result); } else if (o instanceof StagingEntry) { result.add(AdapterUtils.adapt(o, IPath.class)); } }

Target:
private void collectPaths(Object o, List<IPath> result) { if (o instanceof Iterable<?>) { ((Iterable<?>) o).forEach(child -> collectPaths(child, result)); } else if (o instanceof StagingFolderEntry) { StagingViewContentProvider contentProvider = getContentProvider(unstagedViewer); List<StagingEntry> entries = contentProvider .getStagingEntriesFiltered((StagingFolderEntry) o); collectPaths(entries, result); } else if (o instanceof StagingEntry) { result.add(AdapterUtils.adapt(o, IPath.class)); } }
Source:
private void startListenForPhoneState() { if (!mListening) { int subId = SubscriptionManager.getDefaultSubscriptionId(); if (SubscriptionManager.isValidSubscriptionId(subId)) { mPhoneStateListener = new HeadsetPhoneStateListener(subId, mHeadsetService.getStateMachinesThreadLooper()); mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS); mTelephonyManager.setRadioIndicationUpdateMode( TelephonyManager.INDICATION_FILTER_FULL_NETWORK_STATE | TelephonyManager.INDICATION_FILTER_SIGNAL_STRENGTH, TelephonyManager.INDICATION_UPDATE_MODE_IGNORE_SCREEN_OFF); mListening = true; } else { Log.w(TAG, "startListenForPhoneState, invalid subscription ID " + subId); } } }

Target:
private void startListenForPhoneState() { if (!mListening) { int subId = SubscriptionManager.getDefaultSubscriptionId(); if (SubscriptionManager.isValidSubscriptionId(subId)) { mPhoneStateListener = new HeadsetPhoneStateListener(subId, mHeadsetService.getStateMachinesThreadLooper()); mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS); mTelephonyManager.setRadioIndicationUpdateMode( TelephonyManager.INDICATION_FILTER_SIGNAL_STRENGTH, TelephonyManager.INDICATION_UPDATE_MODE_IGNORE_SCREEN_OFF); mListening = true; } else { Log.w(TAG, "startListenForPhoneState, invalid subscription ID " + subId); } } }
Source:
public List<String> unwrap(final ExpressionResolver context, final ModelNode model) throws OperationFailedException { return unwrapValue(context, model.get(getName())); }

Target:
public List<String> unwrap(final ExpressionResolver context, final ModelNode model) throws OperationFailedException { if (!model.hasDefined(getName())){ return Collections.emptyList(); } return unwrapValue(context, model.get(getName())); }
Source:
public int read(long position, byte[] buffer, int offset, int length) throws IOException { checkStream(); if (in instanceof PositionedReadable) { final int n = ((PositionedReadable) in).read(position, buffer, offset, length); if (n > 0) { decrypt(position, buffer, offset, n); } return n; } else { throw new UnsupportedOperationException("This stream does not support " + "positioned read."); } }

Target:
public int read(long position, byte[] buffer, int offset, int length) throws IOException { checkStream(); if (!(in instanceof PositionedReadable)) { throw new UnsupportedOperationException("This stream does not support " + "positioned read."); } final int n = ((PositionedReadable) in).read(position, buffer, offset, length); if (n > 0) { decrypt(position, buffer, offset, n); } return n; }
Source:
private void loadPolicyExtensions(Properties properties, String extensionType) { int count = 1; String className = null; int size = 0; Enumeration<String> keyValues = (Enumeration<String>) properties.propertyNames(); while (keyValues.hasMoreElements()) { String currentProp = keyValues.nextElement(); if (currentProp.contains(extensionType)) { size++; } } while (size > 0) { className = properties.getProperty(extensionType + "." + count); if (className == null) { count++; size--; continue; } try { Class clazz = Thread.currentThread().getContextClassLoader().loadClass(className); PolicyEnforcer policy = (PolicyEnforcer) clazz.newInstance(); policy.init(getParameters(properties, extensionType, count)); this.policyRegistry.addPolicy((PolicyEnforcer) policy); count++; size--; } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | SecurityException e) { log.error("Error while loading password policies " + className, e); } } }

Target:
private void loadPolicyExtensions(Properties properties, String extensionType) { Set<Integer> count = new HashSet(); Iterator<String> keyValues = properties.stringPropertyNames().iterator(); while (keyValues.hasNext()) { String currentProp = keyValues.next(); if (currentProp.startsWith(extensionType)) { String extensionNumber = currentProp.replaceFirst(extensionType + ".", ""); if (StringUtils.isNumeric(extensionNumber)) { count.add(Integer.parseInt(extensionNumber)); } } } Iterator<Integer> countIterator = count.iterator(); while (countIterator.hasNext()) { Integer extensionIndex = countIterator.next(); String className = properties.getProperty(extensionType + "." + extensionIndex); if (className == null) { continue; } try { Class clazz = Thread.currentThread().getContextClassLoader().loadClass(className); PolicyEnforcer policy = (PolicyEnforcer) clazz.newInstance(); policy.init(getParameters(properties, extensionType, extensionIndex)); this.policyRegistry.addPolicy(policy); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | SecurityException e) { log.error("Error while loading password policies " + className, e); } } }
Source:
private void testFunctionIndex() throws SQLException { stat.execute("CREATE ALIAS TEST_INDEX FOR \"" + TestIndex.class.getName() + ".testFunctionIndexFunction\""); try (ResultSet rs = stat.executeQuery("SELECT * FROM TEST_INDEX() WHERE ID = 1 OR ID = 3")) { assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(10, rs.getInt(2)); assertTrue(rs.next()); assertEquals(3, rs.getInt(1)); assertEquals(30, rs.getInt(2)); assertFalse(rs.next()); } finally { stat.execute("DROP ALIAS TEST_INDEX"); } }

Target:
private void testFunctionIndex() throws SQLException { testFunctionIndexCounter = 0; stat.execute("CREATE ALIAS TEST_INDEX FOR \"" + TestIndex.class.getName() + ".testFunctionIndexFunction\""); try (ResultSet rs = stat.executeQuery("SELECT * FROM TEST_INDEX() WHERE ID = 1 OR ID = 3")) { assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(10, rs.getInt(2)); assertTrue(rs.next()); assertEquals(3, rs.getInt(1)); assertEquals(30, rs.getInt(2)); assertFalse(rs.next()); } finally { stat.execute("DROP ALIAS TEST_INDEX"); } assertEquals(1, testFunctionIndexCounter); }
Source:
public static void Init() { Class<?>[] inspectedClassNames = new Class<?>[] { VmBase.class, VM.class, VmStatic.class, VmDynamic.class }; mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(inspectedClassNames), VMStatus.class); for (Pair<EditableField,String> pair : BaseHandler.extractyAnnotatedFields(EditableField.class, (inspectedClassNames))) { mUpdateVmsStatic.AddPermittedFields(pair.getSecond()); } for (Pair<EditableOnVmStatusField, String> pair : BaseHandler.extractyAnnotatedFields(EditableOnVmStatusField.class, inspectedClassNames)) { mUpdateVmsStatic.AddField(Arrays.asList(pair.getFirst().statuses()), pair.getSecond()); } }

Target:
public static void Init() { Class<?>[] inspectedClassNames = new Class<?>[] { VmBase.class, VM.class, VmStatic.class, VmDynamic.class }; mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(inspectedClassNames), VMStatus.class); for (Pair<EditableField,String> pair : BaseHandler.extractAnnotatedFields(EditableField.class, (inspectedClassNames))) { mUpdateVmsStatic.AddPermittedField(pair.getSecond()); } for (Pair<EditableOnVmStatusField, String> pair : BaseHandler.extractAnnotatedFields(EditableOnVmStatusField.class, inspectedClassNames)) { mUpdateVmsStatic.AddField(Arrays.asList(pair.getFirst().statuses()), pair.getSecond()); } }
Source:
public KafkaSupervisor( final TaskStorage taskStorage, final TaskMaster taskMaster, final IndexerMetadataStorageCoordinator indexerMetadataStorageCoordinator, final KafkaIndexTaskClientFactory taskClientFactory, final ObjectMapper mapper, final KafkaSupervisorSpec spec, final RowIngestionMetersFactory rowIngestionMetersFactory ) { super( StringUtils.format("KafkaSupervisor-%s", spec.getDataSchema().getDataSource()), taskStorage, taskMaster, indexerMetadataStorageCoordinator, taskClientFactory, mapper, spec, rowIngestionMetersFactory, NOT_SET, Long.MAX_VALUE, false, true ); this.spec = spec; this.emitter = spec.getEmitter(); this.monitorSchedulerConfig = spec.getMonitorSchedulerConfig(); }

Target:
public KafkaSupervisor( final TaskStorage taskStorage, final TaskMaster taskMaster, final IndexerMetadataStorageCoordinator indexerMetadataStorageCoordinator, final KafkaIndexTaskClientFactory taskClientFactory, final ObjectMapper mapper, final KafkaSupervisorSpec spec, final RowIngestionMetersFactory rowIngestionMetersFactory ) { super( StringUtils.format("KafkaSupervisor-%s", spec.getDataSchema().getDataSource()), taskStorage, taskMaster, indexerMetadataStorageCoordinator, taskClientFactory, mapper, spec, rowIngestionMetersFactory, false ); this.spec = spec; this.emitter = spec.getEmitter(); this.monitorSchedulerConfig = spec.getMonitorSchedulerConfig(); }
Source:
protected synchronized void activate(final ComponentContext componentContext, final Map<String, Object> properties) { logger.debug(message.activatingWireService()); try { this.extractProperties(properties); this.trackerCustomizer = new WireComponentTrackerCustomizer(componentContext.getBundleContext(), this); this.serviceTracker = new ServiceTracker<>(componentContext.getBundleContext(), WireComponent.class, this.trackerCustomizer); this.serviceTracker.open(); this.createWires(); } catch (final Exception exception) { logger.error(ThrowableUtil.stackTraceAsString(exception)); } logger.debug(message.activatingWireServiceDone()); }

Target:
protected synchronized void activate(final ComponentContext componentContext, final Map<String, Object> properties) { logger.debug(message.activatingWireService()); try { this.extractProperties(properties); this.trackerCustomizer = new WireComponentTrackerCustomizer(componentContext.getBundleContext(), this); this.serviceTracker = new ServiceTracker<>(componentContext.getBundleContext(), WireComponent.class, this.trackerCustomizer); this.serviceTracker.open(); this.createWires(); } catch (final Exception e) { logger.error(e.getMessage(), e); } logger.debug(message.activatingWireServiceDone()); }
Source:
public void setUp() throws Exception { hostPort = HOST + PortAssignment.unique(); port = Integer.parseInt(hostPort.split(":")[1]); tmpDir = ClientBase.createTmpDir(); ClientBase.setupTestEnv(); zks = new ZooKeeperServer(tmpDir, tmpDir, 3000); SyncRequestProcessor.setSnapCount(100); serverCnxnFactory = ServerCnxnFactory.createFactory(port, -1); serverCnxnFactory.startup(zks); Assert.assertTrue("waiting for server being up ", ClientBase.waitForServerUp(hostPort,CONNECTION_TIMEOUT)); zk = ClientBase.createZKClient(hostPort); }

Target:
public void setUp() throws Exception { SyncRequestProcessor.setSnapCount(50); super.setUp(); }
Source:
public void vuapDefaultStateShouldStartPlayingAdvertisementAutomatically(Page page, String slot, String videoIframeSelector) { openPageWithVideoInLocalStorage(page, VuapVideos.PORVATA_VAST, VuapVideos.VAST_VIDEO); final AutoplayVuap vuap = new AutoplayVuap(driver, slot, videoIframeSelector); VuapAssertions.verifyVideoPlay(vuap); }

Target:
public void vuapDefaultStateShouldStartPlayingAdvertisementAutomatically(Page page, String slot, String videoIframeSelector) { openPageWithVideoInLocalStorage(page); final AutoplayVuap vuap = new AutoplayVuap(driver, slot, videoIframeSelector); VuapAssertions.verifyVideoPlay(vuap); }
Source:
private void validateSourceInfoRequest(SourceInfoRequest sourceInfoRequest) { if (sourceInfoRequest == null) { IllegalArgumentException illegalArgumentException = new IllegalArgumentException( "SourceInfoRequest was null"); logger.error("Received null sourceInfoRequest", illegalArgumentException); throw illegalArgumentException; } }

Target:
private void validateSourceInfoRequest(SourceInfoRequest sourceInfoRequest) { if (sourceInfoRequest == null) { IllegalArgumentException illegalArgumentException = new IllegalArgumentException( "SourceInfoRequest was null"); logger.throwing(illegalArgumentException); throw illegalArgumentException; } }
Source:
public void add(Marker reference) { }

Target:
public void add(Marker reference) { references.add(reference); }
Source:
public void init() { delegateShapeFactory .delegate(CaseManagementDiagram.class, new CaseManagementDiagramShapeDef(), () -> caseManagementShapeDefFactory) .delegate(AdHocSubprocess.class, new CaseManagementSubprocessShapeDef(), () -> caseManagementShapeDefFactory) .delegate(NoneTask.class, new CaseManagementTaskShapeDef(), () -> caseManagementShapeDefFactory) .delegate(UserTask.class, new CaseManagementTaskShapeDef(), () -> caseManagementShapeDefFactory) .delegate(ScriptTask.class, new CaseManagementTaskShapeDef(), () -> caseManagementShapeDefFactory) .delegate(BusinessRuleTask.class, new CaseManagementTaskShapeDef(), () -> caseManagementShapeDefFactory) .delegate(ReusableSubprocess.class, new CaseManagementReusableSubprocessTaskShapeDef(), () -> caseManagementShapeDefFactory) .delegate(StartNoneEvent.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(StartNoneEvent.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(ParallelGateway.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(ExclusiveDatabasedGateway.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(Lane.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(EndTerminateEvent.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(EndNoneEvent.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(SequenceFlow.class, new SequenceFlowConnectorDef(), () -> basicShapesFactory); }

Target:
public void init() { delegateShapeFactory .delegate(CaseManagementDiagram.class, new CaseManagementDiagramShapeDef(), () -> caseManagementShapeDefFactory) .delegate(AdHocSubprocess.class, new CaseManagementSubprocessShapeDef(), () -> caseManagementShapeDefFactory) .delegate(NoneTask.class, new CaseManagementTaskShapeDef(), () -> caseManagementShapeDefFactory) .delegate(UserTask.class, new CaseManagementTaskShapeDef(), () -> caseManagementShapeDefFactory) .delegate(ScriptTask.class, new CaseManagementTaskShapeDef(), () -> caseManagementShapeDefFactory) .delegate(BusinessRuleTask.class, new CaseManagementTaskShapeDef(), () -> caseManagementShapeDefFactory) .delegate(ReusableSubprocess.class, new CaseManagementReusableSubprocessTaskShapeDef(), () -> caseManagementShapeDefFactory) .delegate(StartNoneEvent.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(ParallelGateway.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(ExclusiveDatabasedGateway.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(Lane.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(EndTerminateEvent.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(EndNoneEvent.class, new NullShapeDef(), () -> caseManagementShapeDefFactory) .delegate(SequenceFlow.class, new SequenceFlowConnectorDef(), () -> basicShapesFactory); }
Source:
public void testIfVerifyOptionIsPassedToTool() { if (!upgrade) { return; } Assert.assertEquals("", VERIFY_VALUE, indexUpgradeTool.getVerify()); String values = indexUpgradeTool.getIndexToolArgValues(Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); Assert.assertTrue(Arrays.asList(values).contains(VERIFY_VALUE)); Assert.assertTrue(Arrays.asList(values).contains("-v")); Assert.assertEquals("verify option and value is not passed consecutively", 1, Arrays.asList(values).indexOf(VERIFY_VALUE) - Arrays.asList(values).indexOf("-v")); }

Target:
public void testIfVerifyOptionIsPassedToTool() { if (!upgrade) { return; } Assert.assertEquals("value passed with verify option does not match with provided value", DUMMY_STRING_VALUE, indexUpgradeTool.getVerify()); String values = indexUpgradeTool.getIndexToolArgValues(DUMMY_STRING_VALUE, DUMMY_STRING_VALUE, DUMMY_STRING_VALUE, DUMMY_STRING_VALUE, DUMMY_STRING_VALUE); List<String> argList = Arrays.asList(values); Assert.assertTrue(argList.contains(DUMMY_STRING_VALUE)); Assert.assertTrue(argList.contains("-v")); Assert.assertEquals("verify option and value are not passed consecutively", 1, argList.indexOf(DUMMY_STRING_VALUE) - argList.indexOf("-v")); }
Source:
public void createSubjectRulesReviewTest() { KubernetesClient client = server.getClient(); createSubjectAccessReviewTest(); SelfSubjectRulesReview selfSubjectRulesReview = new SelfSubjectRulesReviewBuilder() .withNewSpec() .withNamespace("test") .endSpec() .withNewStatus() .withResourceRules(new ResourceRuleBuilder() .withResourceNames("pod") .withVerbs("create", "list", "get", "delete").build()).endStatus().build(); SelfSubjectRulesReview rulesReviewResponse = client.subjectAccessReviewAuth().list().create(selfSubjectRulesReview); assertNotNull(rulesReviewResponse); ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); SelfSubjectRulesReview reviewFromFile = null; try { reviewFromFile = mapper.readValue(getClass().getResourceAsStream("/test-selfsubjectrulesreview.yml"), SelfSubjectRulesReview.class); } catch (IOException e) { e.printStackTrace(); } assertNotNull(reviewFromFile); SelfSubjectRulesReview rulesReviewFromFileResponse = client.subjectAccessReviewAuth().list().create(reviewFromFile); assertNotNull(rulesReviewFromFileResponse); }

Target:
public void createSubjectRulesReviewTest() { KubernetesClient client = server.getClient(); createSubjectAccessReviewTest(); SelfSubjectRulesReview selfSubjectRulesReview = new SelfSubjectRulesReviewBuilder() .withNewSpec() .withNamespace("test") .endSpec() .withNewStatus() .withResourceRules(new ResourceRuleBuilder() .withResourceNames("pod") .withVerbs("create", "list", "get", "delete").build()).endStatus().build(); SelfSubjectRulesReview rulesReviewResponse = client.subjectAccessReviewAuth().list().create(selfSubjectRulesReview); assertNotNull(rulesReviewResponse); }