auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void setTreeProviders(ITreeContentProvider contentProvider, ILabelProvider labelProvider) { List items; if (root == null) { items = Collections.emptyList(); } else { items = getAllWhiteCheckedItems(); for (Object object : items) { setTreeChecked(object, false); } } treeViewer.setContentProvider(contentProvider); treeViewer.setLabelProvider(labelProvider); treeContentProvider = contentProvider; treeLabelProvider = labelProvider; for (Object object : items) { setTreeChecked(object, true); } }

Target:
public void setTreeProviders(ITreeContentProvider contentProvider, ILabelProvider labelProvider) { List<?> items; if (root == null) { items = Collections.emptyList(); } else { items = getAllWhiteCheckedItems(); for (Object object : items) { setTreeChecked(object, false); } } treeViewer.setContentProvider(contentProvider); treeViewer.setLabelProvider(labelProvider); treeContentProvider = contentProvider; treeLabelProvider = labelProvider; for (Object object : items) { setTreeChecked(object, true); } }
Source:
public String index(Request request, Response response) throws IOException { Map<AgentInstance, Collection<EnvironmentConfig>> agentToEnvConfigsMap = new HashMap<>(); agentService.getAgentInstances().values().forEach(instance -> agentToEnvConfigsMap.put(instance, environmentConfigService.getAgentEnvironments(instance.getUuid()))); return writerForTopLevelObject(request, response, outputWriter -> AgentsRepresenter.toJSON(outputWriter, agentToEnvConfigsMap, securityService, currentUsername())); }

Target:
public String index(Request request, Response response) throws IOException { Map<AgentInstance, Collection<EnvironmentConfig>> agentToEnvConfigsMap = new HashMap<>(); agentService.getAgentInstances().forEach(instance -> agentToEnvConfigsMap.put(instance, environmentConfigService.getAgentEnvironments(instance.getUuid()))); return writerForTopLevelObject(request, response, outputWriter -> AgentsRepresenter.toJSON(outputWriter, agentToEnvConfigsMap, securityService, currentUsername())); }
Source:
public void testSameIndexFailure() throws Exception { lh = bkc.createLedger(5, 5, digestType, ledgerPassword); LedgerHandle mlh = spy(lh); LOG.info("Ledger ID: " + mlh.getId()); for (int i = 0; i < numEntriesToWrite; i++) { ByteBuffer entry = ByteBuffer.allocate(4); entry.putInt(rng.nextInt(maxInt)); entry.position(0); entries1.add(entry.array()); mlh.addEntry(entry.array()); } LedgerMetadata myMetadata = new LedgerMetadata(mlh.getLedgerMetadata()); long savedVersion = ((LongVersion) mlh.getLedgerMetadata().getVersion()).getLongVersion(); GenericCallbackFuture<Void> callbackFuture = new GenericCallbackFuture<>(); bkc.getLedgerManager().writeLedgerMetadata(mlh.getId(), myMetadata, callbackFuture); result(callbackFuture); lh.getLedgerMetadata().setVersion(new LongVersion(savedVersion)); BookieSocketAddress newBkAddr = startNewBookieAndReturnAddress(); CountDownLatch sleepLatch1 = new CountDownLatch(1); ArrayList<BookieSocketAddress> ensemble = mlh.getLedgerMetadata() .getEnsembles().entrySet().iterator().next().getValue(); sleepBookie(ensemble.get(0), sleepLatch1); Map<Integer, BookieSocketAddress> injectFailedBookies = new HashMap<Integer, BookieSocketAddress>(); injectFailedBookies.put(0, newBkAddr); when(mlh.testStubResolveConflict()).thenAnswer( invoke -> { LOG.info("JV inside testInsertEnsembleChange"); mlh.replaceBookieInMetadata(injectFailedBookies, 0); return true; }); ByteBuffer entry = ByteBuffer.allocate(4); entry.putInt(rng.nextInt(maxInt)); entry.position(0); entries1.add(entry.array()); mlh.addEntry(entry.array()); sleepLatch1.countDown(); }

Target:
public void testSameIndexFailure() throws Exception { lh = bkc.createLedger(5, 5, digestType, ledgerPassword); LedgerHandle mlh = spy(lh); LOG.info("Ledger ID: " + mlh.getId()); for (int i = 0; i < numEntriesToWrite; i++) { ByteBuffer entry = ByteBuffer.allocate(4); entry.putInt(rng.nextInt(maxInt)); entry.position(0); entries1.add(entry.array()); mlh.addEntry(entry.array()); } LedgerMetadata myMetadata = new LedgerMetadata(mlh.getLedgerMetadata()); long savedVersion = ((LongVersion) mlh.getLedgerMetadata().getVersion()).getLongVersion(); GenericCallbackFuture<LedgerMetadata> callbackFuture = new GenericCallbackFuture<>(); bkc.getLedgerManager().writeLedgerMetadata(mlh.getId(), myMetadata, callbackFuture); callbackFuture.get(); lh.getLedgerMetadata().setVersion(new LongVersion(savedVersion)); BookieSocketAddress newBkAddr = startNewBookieAndReturnAddress(); CountDownLatch sleepLatch1 = new CountDownLatch(1); List<BookieSocketAddress> ensemble = mlh.getLedgerMetadata() .getEnsembles().entrySet().iterator().next().getValue(); sleepBookie(ensemble.get(0), sleepLatch1); Map<Integer, BookieSocketAddress> injectFailedBookies = new HashMap<Integer, BookieSocketAddress>(); injectFailedBookies.put(0, newBkAddr); when(mlh.testStubResolveConflict()).thenAnswer( invoke -> { mlh.replaceBookieInMetadata(injectFailedBookies, 0); return true; }); ByteBuffer entry = ByteBuffer.allocate(4); entry.putInt(rng.nextInt(maxInt)); entry.position(0); entries1.add(entry.array()); mlh.addEntry(entry.array()); sleepLatch1.countDown(); }
Source:
private void runTests() throws DeviceNotAvailableException { mDevice.runInstrumentationTests(mRunner, mLaunchListener); if (mLaunchListener.getCurrentRunResults().hasFailedTests()) { throw new RuntimeException("Some tests failed!"); } }

Target:
private void runTests() throws DeviceNotAvailableException { mDevice.runInstrumentationTests(mRunner, mLaunchListener); final TestRunResult runResults = mLaunchListener.getCurrentRunResults(); if (runResults.isRunFailure()) { throw new RuntimeException("Error: test run failed!"); } if (runResults.hasFailedTests()) { throw new RuntimeException("Error: some tests failed!"); } }
Source:
StaticProviderDefinition() { super(new Parameters(PathElement.pathElement(STATIC_PROVIDER), DiscoveryExtension.getResourceDescriptionResolver(STATIC_PROVIDER)) .setAddHandler(StaticProviderAddHandler.getInstance()) .setAddRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES) .setRemoveRestartLevel(OperationEntry.Flag.RESTART_RESOURCE_SERVICES) .setCapabilities(DISCOVERY_PROVIDER_RUNTIME_CAPABILITY)); }

Target:
StaticProviderDefinition() { super(new Parameters(PathElement.pathElement(STATIC_PROVIDER), DiscoveryExtension.getResourceDescriptionResolver(STATIC_PROVIDER)) .setAddHandler(StaticProviderAddHandler.getInstance()) .setRemoveHandler(new TrivialRemoveStepHandler(DISCOVERY_PROVIDER_RUNTIME_CAPABILITY)) .setCapabilities(DISCOVERY_PROVIDER_RUNTIME_CAPABILITY)); }
Source:
public void testFormatDateForInstructorPages() { ZoneId zoneId = ZoneId.of("UTC"); Instant instant = LocalDateTime.of(2018, Month.AUGUST, 18, 0, 0).atZone(zoneId).toInstant(); assertEquals("18 Aug 2018", TimeHelper.formatDateForInstructorPages(instant, zoneId)); Instant instantWithNonZeroTime = LocalDateTime.of(2018, Month.AUGUST, 18, 12, 10).atZone(zoneId).toInstant(); assertEquals("18 Aug 2018", TimeHelper.formatDateForInstructorPages(instantWithNonZeroTime, zoneId)); }

Target:
public void testFormatDateForInstructorPages() { ZoneId zoneId = ZoneId.of("UTC"); Instant instant = LocalDateTime.of(2018, Month.AUGUST, 18, 0, 0).atZone(zoneId).toInstant(); assertEquals("18 Aug 2018", TimeHelper.formatDateForInstructorPages(instant, zoneId)); assertEquals("", TimeHelper.formatDateForInstructorPages(null, zoneId)); }
Source:
public DatabaseSAML2ClientConfiguration(final SamlClientDao dao) { super(); if (dao == null) { throw new IllegalArgumentException("DAO must not be null."); } this.dao = dao; }

Target:
public DatabaseSAML2ClientConfiguration(final SamlClientDao dao) { super(); CommonHelper.assertNotNull("dao", dao); this.dao = dao; }
Source:
public Function<@NonNull ISegment, @Nullable Long> getMapper() { return (o) -> { return o.getEnd(); }; }

Target:
public Function<@NonNull ISegment, @Nullable Long> getMapper() { return o -> o.getEnd(); }
Source:
private List<EncryptionGroup> toEncryptionGroups(List<DwrfProto.EncryptionGroup> encryptionGroups) { ImmutableList.Builder<EncryptionGroup> encryptionGroupBuilder = ImmutableList.builder(); for (DwrfProto.EncryptionGroup dwrfEncryptionGroup : encryptionGroups) { encryptionGroupBuilder.add(new EncryptionGroup( dwrfEncryptionGroup.getNodesList(), dwrfEncryptionGroup.hasKeyMetadata() ? Optional.of(byteStringToSlice(dwrfEncryptionGroup.getKeyMetadata())) : Optional.empty(), byteStringToSlice(dwrfEncryptionGroup.getStatistics()))); } return encryptionGroupBuilder.build(); }

Target:
private static List<EncryptionGroup> toEncryptionGroups(List<DwrfProto.EncryptionGroup> encryptionGroups) { ImmutableList.Builder<EncryptionGroup> encryptionGroupBuilder = ImmutableList.builder(); for (DwrfProto.EncryptionGroup dwrfEncryptionGroup : encryptionGroups) { encryptionGroupBuilder.add(new EncryptionGroup( dwrfEncryptionGroup.getNodesList(), dwrfEncryptionGroup.hasKeyMetadata() ? Optional.of(byteStringToSlice(dwrfEncryptionGroup.getKeyMetadata())) : Optional.empty(), byteStringToSlice(dwrfEncryptionGroup.getStatistics()))); } return encryptionGroupBuilder.build(); }
Source:
protected void executeCommand() { VDSGroup vdsGroup = getVdsGroup(); vdsGroup.setArchitecture(getArchitecture()); checkMaxMemoryOverCommitValue(); vdsGroup.setDetectEmulatedMachine(true); vdsGroupDao.save(vdsGroup); alertIfFencingDisabled(); if (getParameters().getVdsGroup().getStoragePoolId() != null) { attachManagementNetwork(); } if (FeatureSupported.cpuQoS(getParameters().getVdsGroup().getCompatibilityVersion())) { getCpuProfileDao().save(CpuProfileHelper.createCpuProfile(getParameters().getVdsGroup().getId(), getParameters().getVdsGroup().getName())); } if (vdsGroup.getFeaturesSupported() != null && !vdsGroup.getFeaturesSupported().isEmpty()) { for(ClusterFeature feature:vdsGroup.getFeaturesSupported()){ feature.setVdsGroupId(vdsGroup.getId()); } getClusterFeatureDao().saveAll(vdsGroup.getFeaturesSupported()); } setActionReturnValue(vdsGroup.getId()); setSucceeded(true); }

Target:
protected void executeCommand() { VDSGroup cluster = getVdsGroup(); cluster.setArchitecture(getArchitecture()); checkMaxMemoryOverCommitValue(); cluster.setDetectEmulatedMachine(true); vdsGroupDao.save(cluster); alertIfFencingDisabled(); if (getParameters().getVdsGroup().getStoragePoolId() != null) { attachManagementNetwork(); } if (FeatureSupported.cpuQoS(getParameters().getVdsGroup().getCompatibilityVersion())) { getCpuProfileDao().save(CpuProfileHelper.createCpuProfile(getParameters().getVdsGroup().getId(), getParameters().getVdsGroup().getName())); } if (CollectionUtils.isNotEmpty(cluster.getFeaturesSupported())) { for (ClusterFeature feature : cluster.getFeaturesSupported()) { feature.setClusterId(cluster.getId()); } clusterFeatureDao.addAllSupportedClusterFeature(cluster.getFeaturesSupported()); } setActionReturnValue(cluster.getId()); setSucceeded(true); }
Source:
public FormatInfo process(String templatePath, ImageFormat format, String templateName, long processTimeout) throws InternalErrorException { return process(templatePath, format, templateName); }

Target:
public FormatInfo process(String templatePath, ImageFormat format, String templateName, long processTimeout) throws InternalErrorException { if (format != null) { s_logger.debug("We currently don't handle conversion from " + format + " to QCOW2."); return null; } String qcow2Path = templatePath + File.separator + templateName + "." + ImageFormat.QCOW2.getFileExtension(); if (!_storage.exists(qcow2Path)) { s_logger.debug("Unable to find the qcow2 file: " + qcow2Path); return null; } FormatInfo info = new FormatInfo(); info.format = ImageFormat.QCOW2; info.filename = templateName + "." + ImageFormat.QCOW2.getFileExtension(); File qcow2File = _storage.getFile(qcow2Path); info.size = _storage.getSize(qcow2Path); try { info.virtualSize = getTemplateVirtualSize(qcow2File); } catch (IOException e) { s_logger.error("Unable to get virtual size from " + qcow2File.getName()); throw new InternalErrorException("unable to get virtual size from qcow2 file"); } return info; }
Source:
AcquireTokenRequest(final Context appContext, final AuthenticationContext authContext, final APIEvent apiEvent) { mContext = appContext; mAuthContext = authContext; if (authContext.getCache() != null && apiEvent != null) { mTokenCacheAccessor = new TokenCacheAccessor(authContext.getCache(), authContext.getAuthority(), apiEvent.getRequestId()); } mBrokerProxy = new BrokerProxy(appContext); mAPIEvent = apiEvent; }

Target:
AcquireTokenRequest(final Context appContext, final AuthenticationContext authContext, final APIEvent apiEvent) { mContext = appContext; mAuthContext = authContext; if (authContext.getCache() != null && apiEvent != null) { mTokenCacheAccessor = new TokenCacheAccessor(authContext.getCache(), authContext.getAuthority(), apiEvent.getTelemetryRequestId()); } mBrokerProxy = new BrokerProxy(appContext); mAPIEvent = apiEvent; }
Source:
public void init() { scheduledTask = executor.scheduleWithFixedDelay( () -> { try { refreshRegistryEntries(); } catch (FederationAdminException | InterruptedException e) { LOGGER.error("Problem refreshing registry entries.", e); Thread.currentThread().interrupt(); } }, 10, refreshIntervalSeconds, TimeUnit.SECONDS); }

Target:
public void init() { scheduledTask = executor.scheduleWithFixedDelay( () -> { try { refreshRegistryEntries(); } catch (FederationAdminException e) { LOGGER.error("Problem refreshing registry entries.", e); } catch (InterruptedException e) { LOGGER.error("Thread interrupted while refreshing registry entries.", e); Thread.currentThread().interrupt(); } }, 10, refreshIntervalSeconds, TimeUnit.SECONDS); }
Source:
public String toString() { return "SubscribeCommand[" + command.toString() + " " + spec + "]"; }

Target:
public String toString() { return "SubscribeCommand[" + command + " " + spec + "]"; }
Source:
public void preInitColoredLights(FMLPreInitializationEvent event) { lightHelper = new LightHelperColored(); }

Target:
public void preInitColoredLights(FMLPreInitializationEvent event) { System.out.println("easycolor!"); lightHelper = new LightHelperColored(); }
Source:
<S, T> T attemptUntilTimeLimitOrException( S request, Duration duration, BiFunction<S, Duration, S> durationLimiter, Function<S, T> query, Predicate<T> isTimedOutResponse) { Instant now = clock.instant(); Instant deadline = now.plus(duration); S currentRequest = request; T currentResponse = null; while (now.isBefore(deadline)) { Duration remainingTime = Duration.between(now, deadline); currentRequest = durationLimiter.apply(currentRequest, remainingTime); try { currentResponse = query.apply(currentRequest); if (!isTimedOutResponse.test(currentResponse)) { return currentResponse; } } catch (Exception e) { if (!isPlausiblyTimeout(e) || clock.instant().isAfter(deadline)) { throw e; } } now = clock.instant(); } Preconditions.checkNotNull(currentResponse, "We attempted to return because a blocking duration was" + " reached. However, we had never tried applying the query. This indicates a bug in user requests" + " or AtlasDB code."); return currentResponse; }

Target:
<S, T> T attemptUntilTimeLimitOrException( S request, Duration duration, BiFunction<S, Duration, S> durationLimiter, Function<S, T> query, Predicate<T> isTimedOutResponse) { Instant now = clock.instant(); Instant deadline = now.plus(duration); S currentRequest = request; T currentResponse = null; while (now.isBefore(deadline)) { Duration remainingTime = Duration.between(now, deadline); currentRequest = durationLimiter.apply(currentRequest, remainingTime); try { currentResponse = query.apply(currentRequest); if (!isTimedOutResponse.test(currentResponse)) { return currentResponse; } } catch (RuntimeException e) { if (!isPlausiblyTimeout(e) || clock.instant().isAfter(deadline)) { throw e; } } now = clock.instant(); } Preconditions.checkNotNull(currentResponse, "We attempted to return because a blocking duration was" + " reached. However, we had never tried applying the query. This indicates a bug in user requests" + " or AtlasDB code."); return currentResponse; }
Source:
public <T extends ComputerLauncher> T setLauncher(Class<T> type) { try { selectType(type); } catch (NoSuchElementException x) { save(); try { getJenkins().getPluginManager().installPlugins(new PluginSpec("command-launcher", null)); } catch (IOException x2) { throw new AssertionError(x2); } configure(); selectType(type); } return newInstance(type, this, "/launcher"); }

Target:
public <T extends ComputerLauncher> T setLauncher(Class<T> type) { try { selectType(type); } catch (NoSuchElementException x) { if (type == CommandSlaveLauncher.class) { save(); try { getJenkins().getPluginManager().installPlugins(new PluginSpec("command-launcher", null)); } catch (IOException x2) { throw new AssertionError(x2); } configure(); selectType(type); } else { throw x; } } return newInstance(type, this, "/launcher"); }
Source:
public boolean validateAmountsAndDebitCreditCode(ConcurStandardAccountingExtractFile concurStandardAccountingExtractFile) { KualiDecimal journalTotal = concurStandardAccountingExtractFile.getJournalAmountTotal(); KualiDecimal detailTotal = KualiDecimal.ZERO; boolean debbitCreditValid = true; boolean employeeGroupIdValid = true; for (ConcurStandardAccountingExtractDetailLine line : concurStandardAccountingExtractFile .getConcurStandardAccountingExtractDetailLines()) { detailTotal = detailTotal.add(line.getJournalAmount()); debbitCreditValid &= validateDebitCreditField(line.getJounalDebitCredit()); employeeGroupIdValid &= validateEmployeeGroupId(line.getEmployeeGroupId()); } boolean journalTotalValidation = journalTotal.equals(detailTotal); if (journalTotalValidation) { LOG.debug("validateAmounts, journal total: " + journalTotal.doubleValue() + " and detailTotal: " + detailTotal.doubleValue() + " do match."); } else { LOG.error("validateAmounts, The journal total (" + journalTotal + ") does not equal the detail line total (" + detailTotal + ")"); } return journalTotalValidation && debbitCreditValid && employeeGroupIdValid; }

Target:
public boolean validateAmountsAndDebitCreditCode(ConcurStandardAccountingExtractFile concurStandardAccountingExtractFile) { KualiDecimal journalTotal = concurStandardAccountingExtractFile.getJournalAmountTotal(); KualiDecimal detailTotal = KualiDecimal.ZERO; boolean debitCreditValid = true; boolean employeeGroupIdValid = true; for (ConcurStandardAccountingExtractDetailLine line : concurStandardAccountingExtractFile .getConcurStandardAccountingExtractDetailLines()) { detailTotal = detailTotal.add(line.getJournalAmount()); debitCreditValid &= validateDebitCreditField(line.getJounalDebitCredit()); employeeGroupIdValid &= validateEmployeeGroupId(line.getEmployeeGroupId()); } boolean journalTotalValidation = journalTotal.equals(detailTotal); if (journalTotalValidation) { LOG.debug("validateAmounts, journal total: " + journalTotal.doubleValue() + " and detailTotal: " + detailTotal.doubleValue() + " do match."); } else { LOG.error("validateAmounts, The journal total (" + journalTotal + ") does not equal the detail line total (" + detailTotal + ")"); } return journalTotalValidation && debitCreditValid && employeeGroupIdValid; }
Source:
private boolean isReversedAdapter(final Class<?> payloadType, final Class<?> aClass, final Adapter<?, ?> instance) { if (TypeAwareAdapter.class.isInstance(instance)) { return !payloadType.isAssignableFrom(Class.class.cast(TypeAwareAdapter.class.cast(instance).getTo())) && payloadType.isAssignableFrom(Class.class.cast(TypeAwareAdapter.class.cast(instance).getFrom())); } final Type[] genericInterfaces = aClass.getGenericInterfaces(); return Stream.of(genericInterfaces).filter(ParameterizedType.class::isInstance) .filter(i -> ParameterizedType.class.cast(i).getRawType() instanceof Class) .filter(i -> ParameterizedType.class.cast(i).getActualTypeArguments()[0] instanceof Class) .filter(i -> Adapter.class.isAssignableFrom(Class.class.cast(ParameterizedType.class.cast(i).getRawType()))) .findFirst() .map(pt -> payloadType.isAssignableFrom(Class.class.cast(ParameterizedType.class.cast(pt).getActualTypeArguments()[0]))) .orElseGet(() -> { final Class<?> superclass = aClass.getSuperclass(); return superclass != Object.class && isReversedAdapter(payloadType, superclass, instance); }); }

Target:
private boolean isReversedAdapter(final Class<?> payloadType, final Class<?> aClass, final Adapter<?, ?> instance) { if (TypeAwareAdapter.class.isInstance(instance)) { return !payloadType.isAssignableFrom(Class.class.cast(TypeAwareAdapter.class.cast(instance).getTo())) && payloadType.isAssignableFrom(Class.class.cast(TypeAwareAdapter.class.cast(instance).getFrom())); } final Type[] genericInterfaces = aClass.getGenericInterfaces(); return Stream.of(genericInterfaces).filter(ParameterizedType.class::isInstance) .filter(i -> ParameterizedType.class.cast(i).getRawType() instanceof Class) .filter(i -> Objects.nonNull(ParameterizedType.class.cast(i).getActualTypeArguments()) && ParameterizedType.class.cast(i).getActualTypeArguments().length>0) .filter(i -> ParameterizedType.class.cast(i).getActualTypeArguments()[0] instanceof Class) .filter(i -> Adapter.class.isAssignableFrom(Class.class.cast(ParameterizedType.class.cast(i).getRawType()))) .findFirst() .map(pt -> payloadType.isAssignableFrom(Class.class.cast(ParameterizedType.class.cast(pt).getActualTypeArguments()[0]))) .orElseGet(() -> { final Class<?> superclass = aClass.getSuperclass(); return superclass != Object.class && isReversedAdapter(payloadType, superclass, instance); }); }
Source:
public void executeDelayedDisposal() { synchronized (this) { for (int i = 0; i < abandonedTables.size(); i++) { long nativePointer = abandonedTables.get(i); Table.nativeClose(nativePointer); } abandonedTables.clear(); for (int i = 0; i < abandonedTableViews.size(); i++) { long nativePointer = abandonedTableViews.get(i); TableView.nativeClose(nativePointer); } abandonedTableViews.clear(); for (int i = 0; i < abandonedQueries.size(); i++) { long nativePointer = abandonedQueries.get(i); TableQuery.nativeClose(nativePointer); } abandonedQueries.clear(); cleanNativeReferences(); } }

Target:
public synchronized void executeDelayedDisposal() { for (int i = 0; i < abandonedTables.size(); i++) { long nativePointer = abandonedTables.get(i); Table.nativeClose(nativePointer); } abandonedTables.clear(); for (int i = 0; i < abandonedTableViews.size(); i++) { long nativePointer = abandonedTableViews.get(i); TableView.nativeClose(nativePointer); } abandonedTableViews.clear(); for (int i = 0; i < abandonedQueries.size(); i++) { long nativePointer = abandonedQueries.get(i); TableQuery.nativeClose(nativePointer); } abandonedQueries.clear(); cleanNativeReferences(); }
Source:
private StringBuilder appendToString(StringBuilder builder, String indent){ int i = 0; for (Type field : schema.getFields()) { String name = field.getName(); List<Object> values = data[i]; ++i; if (values != null && !values.isEmpty()) { for (Object value : values) { builder.append(indent).append(name); if (value == null) { builder.append(": NULL\n"); } else if (value instanceof Group) { builder.append("\n").append(((SimpleGroup)value).appendToString(builder,indent+" ")); } else { builder.append(": " ).append(value.toString()).append("\n"); } } } } return builder; }

Target:
private StringBuilder appendToString(StringBuilder builder, String indent) { int i = 0; for (Type field : schema.getFields()) { String name = field.getName(); List<Object> values = data[i]; ++i; if (values != null && !values.isEmpty()) { for (Object value : values) { builder.append(indent).append(name); if (value == null) { builder.append(": NULL\n"); } else if (value instanceof Group) { builder.append('\n'); ((SimpleGroup) value).appendToString(builder, indent + " "); } else { builder.append(": ").append(value.toString()).append('\n'); } } } } return builder; }
Source:
public static PrestoException toPrestoException(Exception e) { if ((e instanceof TTransportException) && "No hosts available".equals(e.getMessage())) { throw new PrestoException(THRIFT_SERVICE_NO_AVAILABLE_HOSTS, e); } if ((e instanceof TApplicationException) || (e instanceof PrestoThriftServiceException)) { return new PrestoException(THRIFT_SERVICE_GENERIC_REMOTE_ERROR, "Exception raised by remote Thrift server. Original error message: " + e.getMessage(), e); } if (e instanceof TException) { return new PrestoException(THRIFT_SERVICE_CONNECTION_ERROR, "Error communicating with remote Thrift server", e); } throw new PrestoException(GENERIC_INTERNAL_ERROR, e); }

Target:
public static PrestoException toPrestoException(Exception e) { if ((e instanceof TTransportException) && "No hosts available".equals(e.getMessage())) { throw new PrestoException(THRIFT_SERVICE_NO_AVAILABLE_HOSTS, e); } if ((e instanceof TApplicationException) || (e instanceof PrestoThriftServiceException)) { return new PrestoException(THRIFT_SERVICE_GENERIC_REMOTE_ERROR, "Exception raised by remote Thrift server: " + e.getMessage(), e); } if (e instanceof TException) { return new PrestoException(THRIFT_SERVICE_CONNECTION_ERROR, "Error communicating with remote Thrift server", e); } throw new PrestoException(GENERIC_INTERNAL_ERROR, e); }
Source:
private ValueHolder<V> getValue(final ValueHolder<V> cachedValue) { if (cachedValue instanceof Fault) { return ((Fault<V>)cachedValue).get(); } return cachedValue; }

Target:
private ValueHolder<V> getValue(final ValueHolder<V> cachedValue) { if (cachedValue instanceof Fault) { return ((Fault<V>)cachedValue).get(); } else { return cachedValue; } }
Source:
public boolean isStopped() { if (! stopped && this.spiderParam.getMaxDuration() > 0) { if ((new Date().getTime() - this.timeStarted.getTime()) > (this.spiderParam.getMaxDuration() * 60000)) { log.info("Spidering process has exceeded maxDuration of " + this.spiderParam.getMaxDuration() + " minute(s)"); this.stop(); } } return stopped; }

Target:
public boolean isStopped() { if (! stopped && this.spiderParam.getMaxDuration() > 0) { if (TimeUnit.MILLISECONDS.toMinutes(System.currentTimeMillis() - this.timeStarted) > this.spiderParam.getMaxDuration()) { log.info("Spidering process has exceeded maxDuration of " + this.spiderParam.getMaxDuration() + " minute(s)"); this.complete(); } } return stopped; }
Source:
public static ResultSet queryParentRepairHistory(AbstractCluster<?> cluster, int coordinator, String ks, String table) { Set<String> tableNames = table == null? Collections.emptySet() : ImmutableSet.of(table); ResultSet rs = null; Exception latestException = null; for (int i = 0; i < 10; i++) { try { rs = cluster.coordinator(coordinator) .executeWithResult("SELECT * FROM system_distributed.parent_repair_history", ConsistencyLevel.QUORUM) .filter(row -> ks.equals(row.getString("keyspace_name"))) .filter(row -> tableNames.equals(row.getSet("columnfamily_names"))); break; } catch (Exception e) { latestException = e; rs = null; Uninterruptibles.sleepUninterruptibly( (i + 1) * 300, TimeUnit.MILLISECONDS); } } if (rs == null) { if (latestException == null) { Assert.fail("Unable to query system_distributed.parent_repair_history, got back neither result set or exception "); } if (latestException instanceof RuntimeException) throw (RuntimeException) latestException; throw new RuntimeException(latestException); } return rs; }

Target:
public static QueryResult queryParentRepairHistory(AbstractCluster<?> cluster, int coordinator, String ks, String table) { Set<String> tableNames = table == null? Collections.emptySet() : ImmutableSet.of(table); QueryResult rs = retryWithBackoffBlocking(10, () -> cluster.coordinator(coordinator) .executeWithResult("SELECT * FROM system_distributed.parent_repair_history", ConsistencyLevel.QUORUM) .filter(row -> ks.equals(row.getString("keyspace_name"))) .filter(row -> tableNames.equals(row.getSet("columnfamily_names")))); return rs; }
Source:
public synchronized void updateConfig(AvroType avro) { if (avro == null) { avro = new AvroType(); avro.setRegistry(""); } if (m_avro == null || !Objects.equals(m_avro.getRegistry(), avro.getRegistry())) { m_schemaRegistryClient = new CachedSchemaRegistryClient(avro.getRegistry().trim(), 10000); } if (m_avro == null || !Objects.equals(m_avro.getPrefix(), avro.getPrefix()) || !Objects.equals(m_avro.getNamespace(), avro.getNamespace())) { m_decoderMap.clear(); } m_avro = avro; }

Target:
public synchronized void updateConfig(AvroType avro) { if (avro == null) { if (m_schemaRegistryClient != null) { m_schemaRegistryClient.reset(); m_schemaRegistryClient = null; } m_decoderMap.clear(); m_avro = avro; return; } if (m_avro == null || !Objects.equals(m_avro.getRegistry(), avro.getRegistry())) { if (m_schemaRegistryClient != null) { m_schemaRegistryClient.reset(); } m_schemaRegistryClient = new CachedSchemaRegistryClient(avro.getRegistry().trim(), 10000); } if (m_avro == null || !Objects.equals(m_avro.getPrefix(), avro.getPrefix()) || !Objects.equals(m_avro.getNamespace(), avro.getNamespace())) { m_decoderMap.clear(); } m_avro = avro; }
Source:
static MongoDatabaseRule create() { final MongoClient client; if (MongoAssertions.mongoIntegrationTestsEnabled()) { client = new MongoClient("localhost"); } else { client = new Fongo(MongoDatabaseRule.class.getSimpleName()).getMongo(); client.getDatabase(DB_NAME).getCollection("__fongo__").insertOne(new Document()); } return new MongoDatabaseRule(client); }

Target:
static MongoDatabaseRule create() { final MongoClient client; if (MongoAssertions.useMongo()) { client = new MongoClient(); } else if (MongoAssertions.useFongo()) { client = new Fongo(MongoDatabaseRule.class.getSimpleName()).getMongo(); } else { throw new UnsupportedOperationException("I can only connect to Mongo or Fongo instances"); } return new MongoDatabaseRule(client); }
Source:
private void fillStruct(@NonNull BitBuffer input, final IDefinition[] myFields, StructDefinition structDefinition) throws CTFException { for (int i = 0; i < fFields.length; i++) { myFields[i] = fFields[i].createDefinition(structDefinition, fFieldNames[i], input); } }

Target:
private void fillStruct(@NonNull BitBuffer input, final IDefinition[] myFields, StructDefinition structDefinition) throws CTFException { final @NonNull String[] fieldNames = fFieldNames; final @NonNull IDeclaration[] fields = fFields; for (int i = 0; i < fields.length; i++) { myFields[i] = fields[i].createDefinition(structDefinition, fieldNames[i], input); } }
Source:
private List<ProcessInstanceSummary> getProcessInstancesByParentId(ProcessInstanceKey processInstanceKey, String containerId){ if (processInstanceKey == null || processInstanceKey.isValid() == false) { return null; } ProcessServicesClient processServicesClient = getClient(processInstanceKey.getServerTemplateId(), ProcessServicesClient.class); List<ProcessInstance> processInstances = processServicesClient.findProcessInstancesByParent(containerId, processInstanceKey.getProcessInstanceId(), Arrays.asList(1, 2, 3), 0, Integer.MAX_VALUE); ProcessInstanceSummaryMapper processInstanceSummaryMapper = new ProcessInstanceSummaryMapper(processInstanceKey.getServerTemplateId()); return processInstances.stream().map(processInstance -> processInstanceSummaryMapper.apply(processInstance)).collect(toList()); }

Target:
private List<ProcessInstanceSummary> getProcessInstancesByParentId(ProcessInstanceKey processInstanceKey, String containerId) { if (processInstanceKey == null || !processInstanceKey.isValid()) { return null; } ProcessServicesClient processServicesClient = getClient(processInstanceKey.getServerTemplateId(), ProcessServicesClient.class); List<ProcessInstance> processInstances = processServicesClient.findProcessInstancesByParent(containerId, processInstanceKey.getProcessInstanceId(), Arrays.asList(org.kie.api.runtime.process.ProcessInstance.STATE_ACTIVE, org.kie.api.runtime.process.ProcessInstance.STATE_COMPLETED, org.kie.api.runtime.process.ProcessInstance.STATE_ABORTED, org.kie.api.runtime.process.ProcessInstance.STATE_PENDING, org.kie.api.runtime.process.ProcessInstance.STATE_SUSPENDED), 0, Integer.MAX_VALUE); ProcessInstanceSummaryMapper processInstanceSummaryMapper = new ProcessInstanceSummaryMapper(processInstanceKey.getServerTemplateId()); return processInstances.stream().map(processInstanceSummaryMapper).collect(toList()); }
Source:
private static OutputStream asyncOutputStream(final OutputStream out) throws IOException { PipedOutputStream pos = new PipedOutputStream(); final PipedInputStream pis = new PipedInputStream(pos); new Thread(new Runnable() { @Override public void run() { try { byte[] bytes = new byte[8192]; for(int len; (len = pis.read(bytes)) > 0;) out.write(bytes, 0, len); } catch(IOException ioe) { throw new RuntimeException(ioe); } finally { close(pis); close(out); } } }, "async-output-stream").start(); return pos; }

Target:
private static OutputStream asyncOutputStream(final OutputStream out) throws IOException { PipedOutputStream pos = new PipedOutputStream(); final PipedInputStream pis = new PipedInputStream(pos); new Thread(() -> { try { IOUtils.copy(pis, out); } catch(IOException ioe) { throw new RuntimeException(ioe); } finally { close(pis); close(out); } }, "async-output-stream").start(); return pos; }
Source:
void updateDecorations(ArrayDouble interpolatedStates) { int idx = getStartIndexInFileNotIncludingTime(); setPoint(new double[]{interpolatedStates.get(idx)/conversion, interpolatedStates.get(idx+1)/conversion, interpolatedStates.get(idx+2)/conversion}); }

Target:
void updateDecorations(ArrayDouble interpolatedStates) { int idx = getStartIndexInFileNotIncludingTime(); setPoint(new double[]{interpolatedStates.get(idx)*conversion, interpolatedStates.get(idx+1)*conversion, interpolatedStates.get(idx+2)*conversion}); }
Source:
public void internalAddNodeToCore(RMNode configuredNode) { String nodeURL = configuredNode.getNodeURL(); if (!this.allNodes.containsKey(nodeURL)) { logger.debug("internalAddNodeToCore returned immediately because the node " + nodeURL + " was not known"); return; } RMNode rmnode = this.allNodes.remove(nodeURL); this.allNodes.put(nodeURL, configuredNode); if (toShutDown) { logger.warn("Node " + rmnode.getNodeURL() + " will not be added to the core as the resource manager is shutting down"); removeNodeFromCoreAndSource(rmnode, rmnode.getProvider()); return; } if(isNumberOfNodesLimited() && isMaximumNumberOfNodesReached()) { logger.warn("Node " + rmnode.getNodeURL() + " is removed because the Resource Manager is limited to "+ maximumNumberOfNodes +" nodes."); removeNodeFromCoreAndSource(rmnode, rmnode.getProvider()); throw new AddingNodesException("Maximum number of nodes reached: "+ maximumNumberOfNodes); } if (rmnode.isToRemove()) { removeNodeFromCoreAndSource(rmnode, rmnode.getProvider()); return; } if (rmnode.isDown()) { logger.debug("internalAddNodeToCore returned immediately because the node " + nodeURL + " is already down"); return; } internalSetFree(configuredNode); }

Target:
public void internalAddNodeToCore(RMNode configuredNode) { String nodeURL = configuredNode.getNodeURL(); if (!this.allNodes.containsKey(nodeURL)) { logger.debug("internalAddNodeToCore returned immediately because the node " + nodeURL + " was not known"); return; } RMNode rmnode = this.allNodes.remove(nodeURL); this.allNodes.put(nodeURL, configuredNode); if (toShutDown) { logger.warn("Node " + rmnode.getNodeURL() + " will not be added to the core as the resource manager is shutting down"); removeNodeFromCoreAndSource(rmnode, rmnode.getProvider()); return; } if (isNumberOfNodesLimited() && isMaximumNumberOfNodesReachedIncludingAskingNode()) { logger.warn("Node " + rmnode.getNodeURL() + " is removed because the Resource Manager is limited to " + maximumNumberOfNodes + " nodes."); removeNodeFromCoreAndSource(rmnode, rmnode.getProvider()); throw new AddingNodesException("Maximum number of nodes reached: " + maximumNumberOfNodes); } if (rmnode.isToRemove()) { removeNodeFromCoreAndSource(rmnode, rmnode.getProvider()); return; } if (rmnode.isDown()) { logger.debug("internalAddNodeToCore returned immediately because the node " + nodeURL + " is already down"); return; } internalSetFree(configuredNode); }
Source:
public Map<Cell, Value> get(final TableReference tableRef, final Map<Cell, Long> timestampByCell) { if (timestampByCell.isEmpty()) { return ImmutableMap.of(); } Map<Cell, Value> toReturn = new HashMap<>(); for (List<Entry<Cell, Long>> parition : Iterables.partition(timestampByCell.entrySet(), batchSizeForReads)) { toReturn.putAll(run(ctx -> { Select<? extends Record> query = getLatestTimestampQueryManyTimestamps( ctx, tableRef, toRows(parition)); Result<? extends Record> records = fetchValues(ctx, tableRef, query); Map<Cell, Value> results = Maps.newHashMapWithExpectedSize(records.size()); for (Record record : records) { results.put( Cell.create(record.getValue(A_ROW_NAME), record.getValue(A_COL_NAME)), Value.create(record.getValue(A_VALUE), record.getValue(A_TIMESTAMP))); } return results; })); } return toReturn; }

Target:
public Map<Cell, Value> get(final TableReference tableRef, final Map<Cell, Long> timestampByCell) { if (timestampByCell.isEmpty()) { return ImmutableMap.of(); } Map<Cell, Value> toReturn = new HashMap<>(); for (List<Entry<Cell, Long>> partition : Iterables.partition(timestampByCell.entrySet(), batchSizeForReads)) { toReturn.putAll(run(ctx -> { Select<? extends Record> query = getLatestTimestampQueryManyTimestamps( ctx, tableRef, toRows(partition)); Result<? extends Record> records = fetchValues(ctx, tableRef, query); Map<Cell, Value> results = Maps.newHashMapWithExpectedSize(records.size()); for (Record record : records) { results.put( Cell.create(record.getValue(A_ROW_NAME), record.getValue(A_COL_NAME)), Value.create(record.getValue(A_VALUE), record.getValue(A_TIMESTAMP))); } return results; })); } return toReturn; }
Source:
public void start() { setMetricsReporter(metricsGroupName); final String jvmMetricsName = metricsGroupName + "-JVM"; setMetricsReporter(jvmMetricsName); jmxReporter = JmxReporter.forRegistry(metricRegistry).inDomain("Tajo") .createsObjectNamesWith(new TajoJMXObjectNameFactory()).build(); jmxReporter.start(); if(!inited) { metricRegistry.register(MetricRegistry.name(jvmMetricsName, "MEMORY"), new MemoryUsageGaugeSet()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "FILE"), new FileDescriptorRatioGauge()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "GC"), new GarbageCollectorMetricSet()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "THREAD"), new ThreadStatesGaugeSet()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "LOG"), new LogEventGaugeSet()); } inited = true; }

Target:
public void start() { setMetricsReporter(metricsGroupName); final String jvmMetricsName = metricsGroupName + "-JVM"; setMetricsReporter(jvmMetricsName); if(!inited) { metricRegistry.register(MetricRegistry.name(jvmMetricsName, "MEMORY"), new MemoryUsageGaugeSet()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "FILE"), new FileDescriptorRatioGauge()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "GC"), new GarbageCollectorMetricSet()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "THREAD"), new ThreadStatesGaugeSet()); metricRegistry.register(MetricRegistry.name(jvmMetricsName, "LOG"), new LogEventGaugeSet()); jmxReporter = JmxReporter.forRegistry(metricRegistry).inDomain("Tajo") .createsObjectNamesWith(new TajoJMXObjectNameFactory()).build(); jmxReporter.start(); } inited = true; }
Source:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); if( bindingConfig == null || bindingConfig.length() < 1 ) { logger.warn("No settings configured for Hue binding for item '"+item+"'."); return; } try { String[] configParts = bindingConfig.split(";"); if (item instanceof ColorItem) { BindingConfig hueBindingConfig = (BindingConfig) new HueBindingConfig( configParts[0], BindingType.rgb.name(), null); addBindingConfig(item, hueBindingConfig); } else if (item instanceof DimmerItem) { BindingConfig hueBindingConfig = (BindingConfig) new HueBindingConfig( configParts[0], configParts.length < 2 ? null : configParts[1], configParts.length < 3 ? null : configParts[2]); addBindingConfig(item, hueBindingConfig); } else if (item instanceof SwitchItem) { BindingConfig hueBindingConfig = (BindingConfig) new HueBindingConfig( configParts[0], BindingType.switching.name(), null); addBindingConfig(item, hueBindingConfig); } } catch (ArrayIndexOutOfBoundsException e) { logger.warn("bindingConfig is invalid (item=" + item + ") -> processing bindingConfig aborted!"); } }

Target:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); if (bindingConfig == null || bindingConfig.length() < 1) { logger.warn("No settings configured for Hue binding for item '{}'.", item); return; } try { String[] configParts = bindingConfig.split(";"); if (item instanceof ColorItem) { BindingConfig hueBindingConfig = new HueBindingConfig(configParts[0], BindingType.rgb.name(), null); addBindingConfig(item, hueBindingConfig); } else if (item instanceof DimmerItem) { BindingConfig hueBindingConfig = new HueBindingConfig(configParts[0], configParts.length < 2 ? null : configParts[1], configParts.length < 3 ? null : configParts[2]); addBindingConfig(item, hueBindingConfig); } else if (item instanceof SwitchItem) { BindingConfig hueBindingConfig = new HueBindingConfig(configParts[0], BindingType.switching.name(), null); addBindingConfig(item, hueBindingConfig); } } catch (ArrayIndexOutOfBoundsException e) { logger.warn("bindingConfig is invalid (item=" + item + ") -> processing bindingConfig aborted!"); } }
Source:
private static <T> boolean containsSameElements(Collection<T> c1, Collection<T> c2) { return HashMultiset.create(c1).equals(HashMultiset.create(c2)); }

Target:
private static <T> void containsSameElements(Collection<T> c1, Collection<T> c2) { assertEquals(HashMultiset.create(c1), HashMultiset.create(c2)); }
Source:
private boolean isTableOrViewVisibleToUser(QualifiedObjectName tableName) { Set<SchemaTableName> tableNames = ImmutableSet.of(tableName.asSchemaTableName()); tableNames = accessControl.filterTables(session.getRequiredTransactionId(), session.getIdentity(), tableName.getCatalogName(), tableNames); return tableNames.contains(tableName.asSchemaTableName()); }

Target:
private boolean isTableOrViewVisibleToUser(QualifiedObjectName tableName) { return filterTables(tableName.getCatalogName(), ImmutableSet.of(tableName.getSchemaTableName())) .contains(tableName.getSchemaTableName()); }
Source:
public String getValue(Object obj) { Resource result = (Resource) obj; PageManager pageMgr = result.getResourceResolver().adaptTo(PageManager.class); Page page = Optional.ofNullable(pageMgr).map(p -> p.getContainingPage(result)).orElse(null); return page != null ? page.getPath() : ""; }

Target:
public String getValue(Object obj) { Resource result = (Resource) obj; PageManager pageMgr = result.getResourceResolver().adaptTo(PageManager.class); return Optional.ofNullable(pageMgr).map(p -> p.getContainingPage(result)).map(Page::getPath).orElse(""); }
Source:
public Object getNodeEntityById(ClassInfo classInfo, Object id) { Object node = primaryIndexNodeRegister.get(new LabelPrimaryId(classInfo, id)); if (node != null) { return node; } Deque<ClassInfo> queue = new LinkedList<>(classInfo.directSubclasses()); while (!queue.isEmpty()) { ClassInfo subClassInfo = queue.pop(); if (subClassInfo.annotationsInfo().get(NodeEntity.class) ==null) { continue; } node = primaryIndexNodeRegister.get(new LabelPrimaryId(subClassInfo, id)); if (node != null) { return node; } List<ClassInfo> deepSubClassInfos = subClassInfo.directSubclasses(); queue.addAll(deepSubClassInfos); } return null; }

Target:
public Object getNodeEntityById(ClassInfo classInfo, Object id) { if ((classInfo.isInterface() || classInfo.isAbstract()) && classInfo.annotationsInfo().get(NodeEntity.class) == null) { return null; } Object node = primaryIndexNodeRegister.get(new LabelPrimaryId(classInfo, id)); if (node != null) { return node; } Queue<ClassInfo> queue = new LinkedList<>(classInfo.directSubclasses()); while (!queue.isEmpty()) { ClassInfo subClassInfo = queue.poll(); node = primaryIndexNodeRegister.get(new LabelPrimaryId(subClassInfo, id)); if (node != null) { return node; } List<ClassInfo> deepSubClassInfos = subClassInfo.directSubclasses(); queue.addAll(deepSubClassInfos); } return null; }
Source:
public Metacard getMetacardIfExistsOrNull(String id) throws UnsupportedQueryException, SourceUnavailableException, FederationException { Metacard metacard = null; Filter idFilter = filterBuilder.attribute(Metacard.ID).is().equalTo().text(id); Filter tagsFilter = filterBuilder.attribute(Metacard.TAGS).is().like().text("*"); Filter filter = filterBuilder.allOf(idFilter, tagsFilter); QueryResponse queryResponse = catalogFramework.query(new QueryRequestImpl(new QueryImpl(filter), false)); if (!queryResponse.getResults().isEmpty()) { Result result = queryResponse.getResults().get(0); metacard = result.getMetacard(); } return metacard; }

Target:
public Metacard getMetacardIfExistsOrNull(String id) throws UnsupportedQueryException, SourceUnavailableException, FederationException { Filter idFilter = filterBuilder.attribute(Metacard.ID).is().equalTo().text(id); Filter tagsFilter = filterBuilder.attribute(Metacard.TAGS).is().like().text("*"); Filter filter = filterBuilder.allOf(idFilter, tagsFilter); QueryResponse queryResponse = catalogFramework.query(new QueryRequestImpl(new QueryImpl(filter), false)); if (!queryResponse.getResults().isEmpty()) { return queryResponse.getResults().get(0).getMetacard(); } return null; }
Source:
public void correctlyPassesIfThereIsNotCorruption() { writeLogsOnServer(localStateLogComponents, 1, 10); remoteStateLogComponents.stream().forEach(server -> writeLogsOnServer(server, 1, 10)); List<CompletePaxosHistoryForNamespaceAndUseCase> historyForAll = paxosLogHistoryProvider.getHistory(); assertThat(HistoryAnalyzer.violatedCorruptionChecksForNamespaceAndUseCase( Iterables.getOnlyElement(historyForAll))) .isEqualTo(CorruptionCheckViolation.NONE); assertThat(HistoryAnalyzer.corruptionHealthReportForHistory(historyForAll) .statusesToNamespaceAndUseCase() .size()) .isEqualTo(0); }

Target:
public void correctlyPassesIfThereIsNotCorruption() { writeLogsOnServer(localStateLogComponents, 1, 10); remoteStateLogComponents.stream().forEach(server -> writeLogsOnServer(server, 1, 10)); List<CompletePaxosHistoryForNamespaceAndUseCase> historyForAll = paxosLogHistoryProvider.getHistory(); assertThat(HistoryAnalyzer.corruptionCheckViolationLevelForNamespaceAndUseCase( Iterables.getOnlyElement(historyForAll))) .isEqualTo(CorruptionCheckViolation.NONE); assertThat(HistoryAnalyzer.corruptionHealthReportForHistory(historyForAll) .violatingStatusesToNamespaceAndUseCase() .isEmpty()) .isTrue(); }