auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void initiateMocks() { int[] activeSlots = fusionVersion.aliveSlots(); accessors = new IndexAccessor[INSTANCE_COUNT]; Arrays.fill( accessors, IndexAccessor.EMPTY ); aliveAccessors = new IndexAccessor[activeSlots.length]; for ( int i = 0; i < activeSlots.length; i++ ) { IndexAccessor mock = mock( IndexAccessor.class ); aliveAccessors[i] = mock; switch ( activeSlots[i] ) { case STRING: accessors[STRING] = mock; break; case NUMBER: accessors[NUMBER] = mock; break; case SPATIAL: accessors[SPATIAL] = mock; break; case TEMPORAL: accessors[TEMPORAL] = mock; break; case LUCENE: accessors[LUCENE] = mock; break; default: throw new RuntimeException(); } } fusionIndexAccessor = new FusionIndexAccessor( accessors, fusionVersion.selector(), mock( StoreIndexDescriptor.class ), dropAction ); }

Target:
private void initiateMocks() { int[] activeSlots = fusionVersion.aliveSlots(); accessors = new IndexAccessor[INSTANCE_COUNT]; Arrays.fill( accessors, IndexAccessor.EMPTY ); aliveAccessors = new IndexAccessor[activeSlots.length]; for ( int i = 0; i < activeSlots.length; i++ ) { IndexAccessor mock = mock( IndexAccessor.class ); aliveAccessors[i] = mock; switch ( activeSlots[i] ) { case STRING: accessors[STRING] = mock; break; case NUMBER: accessors[NUMBER] = mock; break; case SPATIAL: accessors[SPATIAL] = mock; break; case TEMPORAL: accessors[TEMPORAL] = mock; break; case LUCENE: accessors[LUCENE] = mock; break; default: throw new RuntimeException(); } } fusionIndexAccessor = new FusionIndexAccessor( fusionVersion.slotSelector(), new InstanceSelector<>( accessors ), indexDescriptor, dropAction ); }
Source:
public static Locale languageLocale(@Nullable String languageCode) { if (TextUtils.isEmpty(languageCode)) { return Locale.getDefault(); } if (languageCode.contains("_")) { String[] opts = languageCode.split("_"); if (opts.length >= 2) { return new Locale(opts[0], opts[1]); } else { return new Locale(opts[0]); } } return new Locale(languageCode); }

Target:
public static Locale languageLocale(@Nullable String languageCode) { if (TextUtils.isEmpty(languageCode)) { return Locale.getDefault(); } String[] opts = languageSplitter.split(languageCode, 0); if (opts.length > 1) { return new Locale(opts[0], opts[1]); } else { return new Locale(opts[0]); } }
Source:
protected void testAccessControl() throws Exception { dataBundle = getTypicalDataBundle(); removeAndRestoreDataBundle(dataBundle); StudentAttributes unregStudent1 = dataBundle.students.get("student1InUnregisteredCourse"); String key = StudentsLogic.inst().getStudentForEmail(unregStudent1.course, unregStudent1.email).key; String[] submissionParams = new String[] { Const.ParamsNames.REGKEY, StringHelper.encrypt(key), Const.ParamsNames.NEXT_URL, "randomUrl" }; verifyUnaccessibleWithoutLogin(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForUnregisteredUsers(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForStudents(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForInstructorsOfOtherCourses(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams); ______TS("testStudentCourseJoinLegacyLink"); dataBundle = getTypicalDataBundle(); removeAndRestoreDataBundle(dataBundle); unregStudent1 = dataBundle.students.get("student2InUnregisteredCourse"); key = StudentsLogic.inst().getStudentForEmail(unregStudent1.course, unregStudent1.email).key; submissionParams = new String[] { Const.ParamsNames.REGKEY, StringHelper.encrypt(key) }; verifyAccessibleWithoutLogin(submissionParams); verifyAccessibleForUnregisteredUsers(submissionParams); verifyAccessibleForStudents(submissionParams); verifyAccessibleForInstructorsOfOtherCourses(submissionParams); verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams); }

Target:
protected void testAccessControl() throws Exception { dataBundle = getTypicalDataBundle(); StudentAttributes unregStudent1 = dataBundle.students.get("student1InUnregisteredCourse"); String key = StudentsLogic.inst().getStudentForEmail(unregStudent1.course, unregStudent1.email).key; String[] submissionParams = new String[] { Const.ParamsNames.REGKEY, StringHelper.encrypt(key), Const.ParamsNames.NEXT_URL, "randomUrl" }; verifyUnaccessibleWithoutLogin(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForUnregisteredUsers(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForStudents(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForInstructorsOfOtherCourses(submissionParams); unregStudent1.googleId = ""; StudentsLogic.inst().updateStudentCascade(unregStudent1.email, unregStudent1); verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams); }
Source:
public Integer call() throws Exception { try (CloseableThriftClient client = pool.getCloseableClient()) { begin.await(); int id = System.identityHashCode(client.getThriftClient()); Thread.sleep(holdClientMs); return id; } }

Target:
public Integer call() throws Exception { begin.await(); try (CloseableThriftClient client = pool.getCloseableClient()) { int id = System.identityHashCode(client.getThriftClient()); Thread.sleep(holdClientMs); return id; } }
Source:
public Optional<FieldProjectionExpectations<YearMonth>> getFieldProjectionExpectations() { return Optional.of( new FieldProjectionExpectations<>( YearMonth.of( 1980, Month.NOVEMBER ), YearMonth.of( 1984, Month.JANUARY ), YearMonth.of( 1984, Month.NOVEMBER ) ) ); }

Target:
public Optional<FieldProjectionExpectations<YearMonth>> getFieldProjectionExpectations() { return Optional.of( new FieldProjectionExpectations<>( YearMonth.of( -320, Month.NOVEMBER ), YearMonth.of( 1984, Month.JANUARY ), YearMonth.of( 6001, Month.NOVEMBER ) ) ); }
Source:
public void validate() { if (Stream.of(mElements).noneMatch(e -> e.duration > 0)) { throw new IllegalArgumentException("at least one timing must be non-zero" + " (elements=" + Arrays.toString(mElements) + ")"); } if (Stream.of(mElements).anyMatch(e -> IntStream.of(e.channels) .anyMatch(a -> (a < -1 || a > 255)))) { throw new IllegalArgumentException( "amplitudes must all be DEFAULT_AMPLITUDE or between 0 and 255" + " (elements=" + Arrays.toString(mElements) + ")"); } if (mRepeat < -1 || mRepeat >= mElements.length) { throw new IllegalArgumentException( "repeat index must be within the bounds of the elements array" + " (elements.length=" + mElements.length + ", index=" + mRepeat + ")"); } }

Target:
public void validate() { if (Stream.of(mElements).noneMatch(e -> e.duration != 0)) { throw new IllegalArgumentException("at least one timing must be non-zero" + " (elements=" + Arrays.toString(mElements) + ")"); } if (Stream.of(mElements).anyMatch(e -> e.duration < 0)) { throw new IllegalArgumentException("timings must be positive or zero" + " (elements=" + Arrays.toString(mElements) + ")"); } if (Stream.of(mElements).anyMatch(e -> IntStream.of(e.channels) .anyMatch(a -> (a < -1 || a > 255)))) { throw new IllegalArgumentException( "amplitudes must all be DEFAULT_AMPLITUDE or between 0 and 255" + " (elements=" + Arrays.toString(mElements) + ")"); } if (mRepeat < -1 || mRepeat >= mElements.length) { throw new IllegalArgumentException( "repeat index must be within the bounds of the elements array" + " (elements.length=" + mElements.length + ", index=" + mRepeat + ")"); } }
Source:
protected final IStatus run(IProgressMonitor monitor) { Collection<String> filesToUpdate; Collection<IResource> resourcesToUpdate; synchronized (lock) { filesToUpdate = files; resourcesToUpdate = resources; files = new HashSet<String>(); resources = new HashSet<IResource>(); if (monitor.isCanceled() || filesToUpdate.isEmpty()) { return Status.CANCEL_STATUS; } } return updateIndexDiff(filesToUpdate, resourcesToUpdate, monitor); }

Target:
protected final IStatus run(IProgressMonitor monitor) { Collection<String> filesToUpdate; Collection<IResource> resourcesToUpdate; synchronized (lock) { filesToUpdate = files; resourcesToUpdate = resources; files = new HashSet<String>(); resources = new HashSet<IResource>(); if (monitor.isCanceled() || filesToUpdate.isEmpty()) return Status.CANCEL_STATUS; } return updateIndexDiff(filesToUpdate, resourcesToUpdate, monitor); }
Source:
public synchronized Object get(final ByteBuffer buffer, final int position) { return sketches.get(buffer).get(position); }

Target:
public Object get(final ByteBuffer buffer, final int position) { return sketchCache.get(buffer).get(position); }
Source:
public boolean onMessage(Message<?> message) { String connectionId = (String) message.getHeaders().get(IpHeaders.CONNECTION_ID); if (connectionId == null) { logger.error("Cannot correlate response - no connection id"); return false; } AsyncReply reply = pendingReplies.get(connectionId); if (reply == null) { if (message instanceof ErrorMessage) { if (logger.isDebugEnabled()) { logger.debug("Socket error ignored - no listener for " + connectionId); } return false; } else { logger.error("Cannot correlate response - no pending reply"); return false; } } reply.setReply(message); return false; }

Target:
public boolean onMessage(Message<?> message) { String connectionId = (String) message.getHeaders().get(IpHeaders.CONNECTION_ID); if (connectionId == null) { logger.error("Cannot correlate response - no connection id"); return false; } AsyncReply reply = pendingReplies.get(connectionId); if (reply == null) { if (message instanceof ErrorMessage) { return false; } else { logger.error("Cannot correlate response - no pending reply"); return false; } } reply.setReply(message); return false; }
Source:
private void loadFromDisk() { synchronized (mLock) { if (mLoaded) { return; } if (mBackupFile.exists()) { mFile.delete(); mBackupFile.renameTo(mFile); } } if (mFile.exists() && !mFile.canRead()) { Log.w(TAG, "Attempt to read preferences file " + mFile + " without permission"); } Map<String, Object> map = null; StructStat stat = null; Throwable thrown = null; try { try { stat = Os.stat(mFile.getPath()); if (mFile.canRead()) { BufferedInputStream str = null; try { str = new BufferedInputStream( new FileInputStream(mFile), 16 * 1024); map = (Map<String, Object>) XmlUtils.readMapXml(str); } catch (Exception e) { Log.w(TAG, "Cannot read " + mFile.getAbsolutePath(), e); } finally { IoUtils.closeQuietly(str); } } } catch (ErrnoException e) { } } catch (Throwable t) { thrown = t; } finally { synchronized (mLock) { mLoaded = true; mThrowable = thrown; if (thrown == null) { if (map != null) { mMap = map; mStatTimestamp = stat.st_mtim; mStatSize = stat.st_size; } else { mMap = new HashMap<>(); } } mLock.notifyAll(); } } }

Target:
private void loadFromDisk() { synchronized (mLock) { if (mLoaded) { return; } if (mBackupFile.exists()) { mFile.delete(); mBackupFile.renameTo(mFile); } } if (mFile.exists() && !mFile.canRead()) { Log.w(TAG, "Attempt to read preferences file " + mFile + " without permission"); } Map<String, Object> map = null; StructStat stat = null; Throwable thrown = null; try { stat = Os.stat(mFile.getPath()); if (mFile.canRead()) { BufferedInputStream str = null; try { str = new BufferedInputStream( new FileInputStream(mFile), 16 * 1024); map = (Map<String, Object>) XmlUtils.readMapXml(str); } catch (Exception e) { Log.w(TAG, "Cannot read " + mFile.getAbsolutePath(), e); } finally { IoUtils.closeQuietly(str); } } } catch (ErrnoException e) { } catch (Throwable t) { thrown = t; } synchronized (mLock) { mLoaded = true; mThrowable = thrown; try { if (thrown == null) { if (map != null) { mMap = map; mStatTimestamp = stat.st_mtim; mStatSize = stat.st_size; } else { mMap = new HashMap<>(); } } } catch (Throwable t) { mThrowable = t; } finally { mLock.notifyAll(); } } }
Source:
private void validateModelInfo(MLModelInfo modelInfo) throws SAXException, JAXBException { List<MLModelField> outputFields = doGetOutputFieldsForPMMLStream(modelInfo.getPmml()); if (outputFields.isEmpty()) { throw new RuntimeException( String.format("PMML File %s does not support emitting output fields", modelInfo.getUploadedFileName())); } StorageUtils.ensureUnique(modelInfo, this::listModelInfo, QueryParam.params( MLModelInfo.NAME, modelInfo.getName())); }

Target:
private void validateModelInfo(MLModelInfo modelInfo) throws SAXException, JAXBException { List<MLModelField> outputFields = doGetOutputFieldsForPMMLStream(modelInfo.getPmml()); if (outputFields.isEmpty()) { throw new RuntimeException( String.format("PMML File %s does not support empty output", modelInfo.getUploadedFileName())); } StorageUtils.ensureUnique(modelInfo, this::listModelInfo, QueryParam.params( MLModelInfo.NAME, modelInfo.getName())); }
Source:
static <T> CheckedFunction0<T> decorateCheckedSupplier(AdaptiveBulkhead bulkhead, CheckedFunction0<T> supplier) { return () -> { long start = 0; boolean isFailed=false; bulkhead.acquirePermission(); try { start = Instant.now().toEpochMilli(); return supplier.apply(); } catch (Exception e) { bulkhead.onError( start,TimeUnit.MILLISECONDS, e); isFailed=true; throw e; } finally { if (start != 0 && !isFailed) { bulkhead.onSuccess(start, TimeUnit.MILLISECONDS); } } }; }

Target:
static <T> CheckedFunction0<T> decorateCheckedSupplier(AdaptiveBulkhead bulkhead, CheckedFunction0<T> supplier) { return () -> { long start = 0; boolean isFailed=false; bulkhead.acquirePermission(); try { start = System.nanoTime(); return supplier.apply(); } catch (Exception e) { bulkhead.onError(System.nanoTime() - start, TimeUnit.NANOSECONDS, e); isFailed=true; throw e; } finally { if (start != 0 && !isFailed) { bulkhead.onSuccess(System.nanoTime() - start, TimeUnit.NANOSECONDS); } } }; }
Source:
private void updateAvailabilitByDatacenter(StoragePool datacenter) { if (datacenter == null) { return; } getModel().getActivateDomain().setIsAvailable(datacenter.getId() != StorageModel.UnassignedDataCenterId); }

Target:
private void updateAvailabilitByDatacenter(StoragePool datacenter) { if (datacenter == null) { return; } getModel().getActivateDomain().setIsAvailable(!StorageModel.UnassignedDataCenterId.equals(datacenter.getId())); }
Source:
Mono<Response<SubscriptionDescription>> updateSubscriptionWithResponse(SubscriptionDescription subscription, Context context) { if (subscription == null) { return monoError(logger, new NullPointerException("'subscription' cannot be null")); } final String topicName = subscription.getTopicName(); final String subscriptionName = subscription.getSubscriptionName(); if (topicName == null || topicName.isEmpty()) { return monoError(logger, new IllegalArgumentException("'getTopicName' cannot be null or empty.")); } else if (subscriptionName == null || subscriptionName.isEmpty()) { return monoError(logger, new IllegalArgumentException("'getSubscriptionName' cannot be null or empty.")); } else if (context == null) { return monoError(logger, new NullPointerException("'context' cannot be null.")); } final CreateSubscriptionBodyContent content = new CreateSubscriptionBodyContent() .setType(CONTENT_TYPE) .setSubscriptionDescription(subscription); final CreateSubscriptionBody createEntity = new CreateSubscriptionBody() .setContent(content); final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, SERVICE_BUS_TRACING_NAMESPACE_VALUE); try { return managementClient.getSubscriptions().putWithResponseAsync(topicName, subscriptionName, createEntity, "*", withTracing) .onErrorMap(ServiceBusManagementAsyncClient::mapException) .map(response -> deserializeSubscription(topicName, response)); } catch (RuntimeException ex) { return monoError(logger, ex); } }

Target:
Mono<Response<SubscriptionDescription>> updateSubscriptionWithResponse(SubscriptionDescription subscription, Context context) { if (subscription == null) { return monoError(logger, new NullPointerException("'subscription' cannot be null")); } else if (context == null) { return monoError(logger, new NullPointerException("'context' cannot be null.")); } final String topicName = subscription.getTopicName(); final String subscriptionName = subscription.getSubscriptionName(); final CreateSubscriptionBodyContent content = new CreateSubscriptionBodyContent() .setType(CONTENT_TYPE) .setSubscriptionDescription(subscription); final CreateSubscriptionBody createEntity = new CreateSubscriptionBody() .setContent(content); final Context withTracing = context.addData(AZ_TRACING_NAMESPACE_KEY, SERVICE_BUS_TRACING_NAMESPACE_VALUE); try { return managementClient.getSubscriptions().putWithResponseAsync(topicName, subscriptionName, createEntity, "*", withTracing) .onErrorMap(ServiceBusManagementAsyncClient::mapException) .map(response -> deserializeSubscription(topicName, response)); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
public ZKSubscription subscribeForCursorsReset(final Runnable listener) { final NodeCache cursorResetCache = new NodeCache(curatorFramework, resetCursorPath); cursorResetCache.getListenable().addListener(() -> listener.run()); try { cursorResetCache.start(); } catch (final Exception e) { throw new NakadiRuntimeException(e); } return new ZKSubscription() { @Override public void refresh() { try { cursorResetCache.rebuild(); } catch (final Exception e) { throw new NakadiRuntimeException(e); } } @Override public void cancel() { try { cursorResetCache.getListenable().clear(); cursorResetCache.close(); } catch (final IOException e) { throw new NakadiRuntimeException(e); } } }; }

Target:
public ZKSubscription subscribeForCursorsReset(final Runnable listener) throws NakadiRuntimeException, UnsupportedOperationException { final NodeCache cursorResetCache = new NodeCache(curatorFramework, resetCursorPath); cursorResetCache.getListenable().addListener(() -> listener.run()); try { cursorResetCache.start(); } catch (final Exception e) { throw new NakadiRuntimeException(e); } return new ZKSubscription() { @Override public void refresh() { throw new UnsupportedOperationException(); } @Override public void cancel() { try { cursorResetCache.getListenable().clear(); cursorResetCache.close(); } catch (final IOException e) { throw new NakadiRuntimeException(e); } } }; }
Source:
public void registerSonarQubeVersion(String sonarqubeVersion) { IAtomicReference<String> sqVersion = hzInstance.getAtomicReference(SONARQUBE_VERSION); if (sqVersion.get() == null) { ILock lock = hzInstance.getLock(SONARQUBE_VERSION); lock.lock(); try { if (sqVersion.get() == null) { sqVersion.set(sonarqubeVersion); } } finally { lock.unlock(); } } String clusterVersion = sqVersion.get(); if (!sqVersion.get().equals(sonarqubeVersion)) { hzInstance.shutdown(); throw new IllegalStateException( String.format("The local version %s is not the same as the cluster %s", sonarqubeVersion, clusterVersion) ); } }

Target:
public void registerSonarQubeVersion(String sonarqubeVersion) { IAtomicReference<String> sqVersion = hzInstance.getAtomicReference(SONARQUBE_VERSION); if (sqVersion.get() == null) { ILock lock = hzInstance.getLock(SONARQUBE_VERSION); lock.lock(); try { if (sqVersion.get() == null) { sqVersion.set(sonarqubeVersion); } } finally { lock.unlock(); } } String clusterVersion = sqVersion.get(); if (!sqVersion.get().equals(sonarqubeVersion)) { throw new IllegalStateException( String.format("The local version %s is not the same as the cluster %s", sonarqubeVersion, clusterVersion) ); } }
Source:
public String getTitle() { return Context.getMessageSourceService().getMessage("emrapi.title"); }

Target:
public String getTitle() { return "emrapi.title"; }
Source:
private void writeTargets(final String fullPath, List<Target> targets) { final String[][] targetValues = new String[targets.size()][NUM_TARGET_COLUMNS]; for (int i = 0; i < targets.size(); i++) { final Target target = targets.get(i); targetValues[i][targetColumnToPoNIndex.get(TargetTableColumn.CONTIG.toString())] = target.getContig(); targetValues[i][targetColumnToPoNIndex.get(TargetTableColumn.START.toString())] = String.valueOf(target.getStart()); targetValues[i][targetColumnToPoNIndex.get(TargetTableColumn.END.toString())] = String.valueOf(target.getEnd()); } file.makeStringMatrix(fullPath, targetValues, NUM_TARGET_COLUMNS_PATH); }

Target:
private void writeTargets(final String fullPath, List<Target> targets) { final String[][] targetValues = new String[targets.size()][NUM_TARGET_COLUMNS]; for (int i = 0; i < targets.size(); i++) { final Target target = targets.get(i); targetValues[i][targetColumnToPoNIndex.get(TargetTableColumn.CONTIG)] = target.getContig(); targetValues[i][targetColumnToPoNIndex.get(TargetTableColumn.START)] = String.valueOf(target.getStart()); targetValues[i][targetColumnToPoNIndex.get(TargetTableColumn.END)] = String.valueOf(target.getEnd()); } file.makeStringMatrix(fullPath, targetValues, NUM_TARGET_COLUMNS_PATH); }
Source:
public static Iterable<ITmfEventAspect<?>> getEventAspects(ITmfTrace trace, Class<? extends ITmfEventAspect<?>> aspectClass) { return Lists.newArrayList(Iterables.filter(Iterables.concat(trace.getEventAspects(), EXTRA_ASPECTS), aspect -> aspectClass.isAssignableFrom(aspect.getClass()))); }

Target:
public static Iterable<ITmfEventAspect<?>> getEventAspects(ITmfTrace trace, Class<? extends ITmfEventAspect<?>> aspectClass) { return Iterables.filter(Iterables.concat(trace.getEventAspects(), EXTRA_ASPECTS), aspect -> aspectClass.isAssignableFrom(aspect.getClass())); }
Source:
protected void startRemain() { if (checkpointPeriod != 0) { checkpointResult = scheduler.scheduleAtFixedRate(new Runnable() { public void run() { final long checkpointTimestamp = getCurrentTimestamp() - expectedDelay; outputEmitter.emitWatermark( new MistWatermarkEvent(checkpointTimestamp, true)); LOG.log(Level.INFO, "checkpoint event being emitted. time is : " + checkpointTimestamp); } }, checkpointPeriod, checkpointPeriod, timeUnit); } else { LOG.log(Level.INFO, "checkpointing is not turned on"); } }

Target:
protected void startRemain() { if (checkpointPeriod != 0) { checkpointResult = scheduler.scheduleAtFixedRate(new Runnable() { public void run() { outputEmitter.emitCheckpoint(new MistCheckpointEvent()); } }, checkpointPeriod, checkpointPeriod, timeUnit); } else { LOG.log(Level.INFO, "checkpointing is not turned on"); } }
Source:
public static boolean filterGitReference(final Path gitRefPath, final Filters filters) { final List<String> branches = filters.getBranches(); final List<String> tags = filters.getTags(); if (branches.isEmpty() && tags.isEmpty()) { return true; } List<String> patterns; if (gitRefPath.startsWith("refs/heads/")) { patterns = branches; } else if (gitRefPath.startsWith("refs/tags/")) { patterns = tags; } else { throw new UnsupportedOperationException("Invalid git reference: " + gitRefPath.toString()); } final Path matchPath = gitRefPath.subpath(2, gitRefPath.getNameCount()); return patterns.stream().anyMatch(pattern -> { String matcherString; if (pattern.matches("^\\/.*\\/$")) { matcherString = "regex:" + pattern.substring(1, pattern.length() - 1); } else { matcherString = "glob:" + pattern; } try { final PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher(matcherString); return pathMatcher.matches(matchPath); } catch (PatternSyntaxException e) { final String msg = ERROR_READING_DOCKSTORE_YML + e.getMessage(); LOG.warn(msg, e); return false; } }); }

Target:
public static boolean filterGitReference(final Path gitRefPath, final Filters filters) { final List<String> branches = filters.getBranches(); final List<String> tags = filters.getTags(); if (branches.isEmpty() && tags.isEmpty()) { return true; } List<String> patterns; if (gitRefPath.startsWith("refs/heads/")) { patterns = branches; } else if (gitRefPath.startsWith("refs/tags/")) { patterns = tags; } else { throw new UnsupportedOperationException("Invalid git reference: " + gitRefPath.toString()); } final Path matchPath = gitRefPath.subpath(2, gitRefPath.getNameCount()); return patterns.stream().anyMatch(pattern -> { String matcherString; if (pattern.matches("^\\/.*\\/$")) { matcherString = "regex:" + pattern.substring(1, pattern.length() - 1); } else { matcherString = "glob:" + pattern; } try { final PathMatcher pathMatcher = FileSystems.getDefault().getPathMatcher(matcherString); return pathMatcher.matches(matchPath); } catch (PatternSyntaxException | UnsupportedOperationException e) { final String msg = ERROR_READING_DOCKSTORE_YML + e.getMessage(); LOG.warn(msg, e); return false; } }); }
Source:
public Retention getObjectRetention(GetObjectRetentionArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("retention", ""); if (args.versionId() != null && !args.versionId().isEmpty()) { queryParamMap.put("versionId", args.versionId()); } try (Response response = executeGet(args.bucketName(), args.objectName(), null, queryParamMap)) { Retention retention = Xml.unmarshal(Retention.class, response.body().charStream()); return retention; } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_OBJECT_LOCK_CONFIGURATION) { throw e; } } return null; }

Target:
public Retention getObjectRetention(GetObjectRetentionArgs args) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { checkArgs(args); Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("retention", ""); if (args.versionId() != null) { queryParamMap.put("versionId", args.versionId()); } try (Response response = executeGet(args.bucket(), args.object(), null, queryParamMap)) { Retention retention = Xml.unmarshal(Retention.class, response.body().charStream()); return retention; } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_OBJECT_LOCK_CONFIGURATION) { throw e; } } return null; }
Source:
public User(int id, String name, String preferred_language, String country, int age, String gender, int dType, String pUnit, String a1cUnit, String weightUnit, String pRange, double minRange, double maxRange) { this.id = id; this.name = name; this.preferred_language = preferred_language; this.country = country; this.age = age; this.gender = gender; this.d_type = dType; this.preferred_unit = pUnit; this.preferred_unit_a1c = a1cUnit; this.preferred_unit_weight = weightUnit; this.preferred_range = pRange; this.custom_range_max = maxRange; this.custom_range_min = minRange; }

Target:
User(int id, String name, String preferred_language, String country, int age, String gender, int dType, String pUnit, String a1cUnit, String weightUnit, String pRange, double minRange, double maxRange) { this.id = id; this.name = name; this.preferred_language = preferred_language; this.country = country; this.age = age; this.gender = gender; this.d_type = dType; this.preferred_unit = pUnit; this.preferred_unit_a1c = a1cUnit; this.preferred_unit_weight = weightUnit; this.preferred_range = pRange; this.custom_range_max = maxRange; this.custom_range_min = minRange; }
Source:
public String getAccumuloUser(){ return get("sc.cloudbase.username"); }

Target:
public String getAccumuloUser(){ return get(CLOUDBASE_USER); }
Source:
public static boolean preValidate(String path) throws CTFException { String metadataPath = path + Utils.SEPARATOR + METADATA_FILENAME; File metadataFile = new File(metadataPath); if (metadataFile.exists() && metadataFile.length() > PREVALIDATION_SIZE) { try (FileChannel fc = FileChannel.open(metadataFile.toPath(), StandardOpenOption.READ)) { ByteBuffer bb = ByteBuffer.allocate(PREVALIDATION_SIZE); fc.read(bb); if (bb.getInt(0) == Utils.TSDL_MAGIC) { return true; } bb.order(ByteOrder.LITTLE_ENDIAN); if (bb.getInt(0) == Utils.TSDL_MAGIC) { return true; } Charset forName = Charset.forName("ASCII"); byte bytes[] = new byte[PREVALIDATION_SIZE]; bb.get(bytes); String text = new String(bytes, forName); return text.startsWith("/* CTF"); } catch (IOException e) { throw new CTFException(e.getMessage(), e); } } return false; }

Target:
public static boolean preValidate(String path) throws CTFException { String metadataPath = path + Utils.SEPARATOR + METADATA_FILENAME; File metadataFile = new File(metadataPath); if (metadataFile.exists() && metadataFile.length() > PREVALIDATION_SIZE) { try (FileChannel fc = FileChannel.open(metadataFile.toPath(), StandardOpenOption.READ)) { ByteBuffer bb = ByteBuffer.allocate(PREVALIDATION_SIZE); fc.read(bb); if (bb.getInt(0) == Utils.TSDL_MAGIC) { return true; } bb.order(ByteOrder.LITTLE_ENDIAN); if (bb.getInt(0) == Utils.TSDL_MAGIC) { return true; } bb.position(0); Charset forName = Charset.forName("ASCII"); byte bytes[] = new byte[PREVALIDATION_SIZE]; bb.get(bytes); String text = new String(bytes, forName); return text.startsWith(TEXT_ONLY_METADATA_HEADER_PREFIX); } catch (IOException e) { throw new CTFException(e.getMessage(), e); } } return false; }
Source:
protected URL getCompleteResourceUrl() throws MalformedURLException { URL requestUrl = null; if (item != null) { requestUrl = getNamespacedUrl(item); } else { requestUrl = getNamespacedUrl(); } if (name != null) { requestUrl = new URL(URLUtils.join(requestUrl.toString(), name)); } else if (item != null && reloadingFromServer) { requestUrl = new URL(URLUtils.join(requestUrl.toString(), checkName(item))); } return requestUrl; }

Target:
private URL getCompleteResourceUrl() throws MalformedURLException { URL requestUrl = null; if (item != null) { requestUrl = getNamespacedUrl(item); } else { requestUrl = getNamespacedUrl(); } if (name != null) { requestUrl = new URL(URLUtils.join(requestUrl.toString(), name)); } else if (item != null && reloadingFromServer) { requestUrl = new URL(URLUtils.join(requestUrl.toString(), checkName(item))); } return requestUrl; }
Source:
public static void sendMail(String host, String port, String from, String to, String cc, String subject, String mailMessage, int mailSmtpTimeout, int mailSmtpConnectionTimeout) { Properties props = System.getProperties(); props.put("mail.smtp.host", host); props.put("mail.smtp.port", port); props.put("mail.smtp.timeout", mailSmtpTimeout); props.put("mail.smtp.connectiontimeout", mailSmtpConnectionTimeout); Session session = Session.getDefaultInstance(props, null); try { MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.setRecipient(Message.RecipientType.TO, new InternetAddress( to)); message.setRecipient(Message.RecipientType.CC, new InternetAddress( cc)); message.setSubject(subject); message.setSentDate(new Date()); MimeBodyPart messagePart = new MimeBodyPart(); messagePart.setText(mailMessage); Multipart multipart = new MimeMultipart(); multipart.addBodyPart(messagePart); message.setContent(multipart); Transport.send(message); } catch (Exception e) { LOG.error("Error sending query end email", e); } }

Target:
public static void sendMail(String host, String port, String from, String to, String cc, String subject, String mailMessage, int mailSmtpTimeout, int mailSmtpConnectionTimeout) { Properties props = System.getProperties(); props.put("mail.smtp.host", host); props.put("mail.smtp.port", port); props.put("mail.smtp.timeout", mailSmtpTimeout); props.put("mail.smtp.connectiontimeout", mailSmtpConnectionTimeout); Session session = Session.getDefaultInstance(props, null); try { MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(from)); message.setRecipient(Message.RecipientType.TO, new InternetAddress( to)); if(cc != null && cc.length() > 0){ message.setRecipient(Message.RecipientType.CC, new InternetAddress( cc)); } message.setSubject(subject); message.setSentDate(new Date()); MimeBodyPart messagePart = new MimeBodyPart(); messagePart.setText(mailMessage); Multipart multipart = new MimeMultipart(); multipart.addBodyPart(messagePart); message.setContent(multipart); Transport.send(message); } catch (Exception e) { LOG.error("Error sending query end email", e); } }
Source:
public void Test_Fields_without_contenttype_on_saving() throws Exception { ContentTypeAPI ctApi = APILocator.getContentTypeAPI(APILocator.systemUser()); ImmutableSimpleContentType.Builder builder = ImmutableSimpleContentType.builder(); ContentType movie = builder.name("Movie").folder(APILocator.systemHost().getFolder()).build(); movie = ctApi.save(movie); ImmutableTextField imdbid = ImmutableTextField.builder().name("imdbid").required(true).unique(true).build(); ImmutableTextField title = ImmutableTextField.builder().name("Title").indexed(true).required(true).build(); ImmutableDateField releaseDate = ImmutableDateField.builder().name("Release Date").variable("releaseDate").build(); ImmutableTextField poster = ImmutableTextField.builder().name("Poster").build(); ImmutableTextField runtime = ImmutableTextField.builder().name("Runtime").build(); ImmutableTextAreaField plot = ImmutableTextAreaField.builder().name("Plot").build(); ImmutableTextField boxOffice = ImmutableTextField.builder().name("Box Office").variable("boxOffice").build(); List<Field> fieldList = new ArrayList<>(); fieldList.add(imdbid); fieldList.add(title); fieldList.add(releaseDate); fieldList.add(poster); fieldList.add(runtime); fieldList.add(plot); fieldList.add(boxOffice); try { ctApi.save(movie, fieldList); final List<Field> fieldsRecovery = APILocator.getContentTypeFieldAPI().byContentTypeId(movie.id()); for (final Field field : fieldsRecovery) { assertEquals(movie.id(), field.contentTypeId()); } } catch (Exception e) { fail("Should work"); } }

Target:
public void Test_Fields_without_contenttype_on_saving() throws Exception { ContentTypeAPI ctApi = APILocator.getContentTypeAPI(APILocator.systemUser()); ImmutableSimpleContentType.Builder builder = ImmutableSimpleContentType.builder(); ContentType movie = builder.name("Movie").folder(APILocator.systemHost().getFolder()).build(); try { movie = ctApi.save(movie); ImmutableTextField imdbid = ImmutableTextField.builder().name("imdbid").required(true).unique(true).build(); ImmutableTextField title = ImmutableTextField.builder().name("Title").indexed(true).required(true).build(); ImmutableDateField releaseDate = ImmutableDateField.builder().name("Release Date").variable("releaseDate").build(); ImmutableTextField poster = ImmutableTextField.builder().name("Poster").build(); ImmutableTextField runtime = ImmutableTextField.builder().name("Runtime").build(); ImmutableTextAreaField plot = ImmutableTextAreaField.builder().name("Plot").build(); ImmutableTextField boxOffice = ImmutableTextField.builder().name("Box Office").variable("boxOffice").build(); List<Field> fieldList = new ArrayList<>(); fieldList.add(imdbid); fieldList.add(title); fieldList.add(releaseDate); fieldList.add(poster); fieldList.add(runtime); fieldList.add(plot); fieldList.add(boxOffice); ctApi.save(movie, fieldList); final List<Field> fieldsRecovery = APILocator.getContentTypeFieldAPI().byContentTypeId(movie.id()); for (final Field field : fieldsRecovery) { assertEquals(movie.id(), field.contentTypeId()); } } catch (Exception e) { fail("Should work"); } finally { ctApi.delete(movie); } }
Source:
public NormalizeTableFilterParams( final List<TableName> tableNames, final String regex, final String namespace ) { this.tableNames = tableNames; this.regex = regex; this.namespace = namespace; }

Target:
private NormalizeTableFilterParams(final List<TableName> tableNames, final String regex, final String namespace) { this.tableNames = tableNames; this.regex = regex; this.namespace = namespace; }
Source:
private static void testStateSystemExplorer() { SWTWorkbenchBot bot = new SWTWorkbenchBot(); List<String> expectedAnalyses = new ArrayList<>(); expectedAnalyses.addAll(EXPECTED_ANALYSES); expectedAnalyses.sort(null); SWTBotUtils.openView(TmfStateSystemExplorer.ID); SWTBotView sseBot = bot.viewByTitle("State System Explorer"); sseBot.show(); SWTBotTree tree = sseBot.bot().tree(); bot.waitWhile(treeHasRows(tree, 0)); tree.getAllItems()[0].expand(); List<String> actual = sseBot.bot().tree().getAllItems()[0].getNodes(); assertTrue("State systems are not what expected : " + EXPECTED_ANALYSES + " instead " + actual, actual.containsAll(EXPECTED_ANALYSES)); sseBot.close(); SWTBotUtils.openView(TmfStateSystemExplorer.ID); sseBot = bot.viewByTitle("State System Explorer"); sseBot.show(); tree = sseBot.bot().tree(); bot.waitWhile(treeHasRows(tree, 0)); tree.getAllItems()[0].expand(); actual.clear(); actual.addAll(sseBot.bot().tree().getAllItems()[0].getNodes()); assertTrue("State systems are not what expected : " + EXPECTED_ANALYSES + " instead " + actual, actual.containsAll(EXPECTED_ANALYSES)); }

Target:
private void testStateSystemExplorer() { SWTWorkbenchBot bot = new SWTWorkbenchBot(); List<String> expectedAnalyses = new ArrayList<>(); expectedAnalyses.addAll(EXPECTED_ANALYSES); SWTBotUtils.openView(TmfStateSystemExplorer.ID); SWTBotView sseBot = bot.viewByTitle("State System Explorer"); sseBot.show(); List<String> actual = getSSNames(sseBot); assertTrue("State systems are not what expected : " + EXPECTED_ANALYSES + " instead " + actual, actual.containsAll(EXPECTED_ANALYSES)); sseBot.close(); SWTBotUtils.openView(TmfStateSystemExplorer.ID); sseBot = bot.viewByTitle("State System Explorer"); sseBot.show(); List<String> secondOpen = getSSNames(sseBot); assertEquals("Test reopen view", actual, secondOpen); bot.closeAllEditors(); bot.waitUntil(treeHasRows(sseBot.bot().tree(), 0)); before(); secondOpen = getSSNames(sseBot); assertEquals("Test reopen trace", actual, secondOpen); sseBot.close(); }
Source:
private void populateIdpList(List<IdpConfig> providers) { mProviders = new ArrayList<>(); for (IdpConfig idpConfig : providers) { switch (idpConfig.getProviderId()) { case AuthUI.GOOGLE_PROVIDER: mProviders.add(new GoogleProvider(this, idpConfig)); break; case AuthUI.FACEBOOK_PROVIDER: mProviders.add(new FacebookProvider( idpConfig, getFlowParams().themeId)); break; case AuthUI.TWITTER_PROVIDER: mProviders.add(new TwitterProvider(this)); break; case AuthUI.EMAIL_PROVIDER: mProviders.add(new EmailProvider(this, getFlowParams())); break; case AuthUI.PHONE_VERIFICATION_PROVIDER: PhoneIdpConfig phoneIdpConfig = (PhoneIdpConfig) idpConfig; mProviders.add(new PhoneProvider(this, getFlowParams(), phoneIdpConfig)); break; default: Log.e(TAG, "Encountered unknown provider parcel with type: " + idpConfig.getProviderId()); } } ViewGroup btnHolder = findViewById(R.id.btn_holder); for (final Provider provider : mProviders) { View loginButton = getLayoutInflater() .inflate(provider.getButtonLayout(), btnHolder, false); loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (provider instanceof IdpProvider) { getDialogHolder().showLoadingDialog(R.string.fui_progress_dialog_loading); } provider.startLogin(AuthMethodPickerActivity.this); } }); if (provider instanceof IdpProvider) { ((IdpProvider) provider).setAuthenticationCallback(this); } btnHolder.addView(loginButton); } }

Target:
private void populateIdpList(List<IdpConfig> providers) { mProviders = new ArrayList<>(); for (IdpConfig idpConfig : providers) { switch (idpConfig.getProviderId()) { case AuthUI.GOOGLE_PROVIDER: mProviders.add(new GoogleProvider(this, idpConfig)); break; case AuthUI.FACEBOOK_PROVIDER: mProviders.add(new FacebookProvider( idpConfig, getFlowParams().themeId)); break; case AuthUI.TWITTER_PROVIDER: mProviders.add(new TwitterProvider(this)); break; case AuthUI.EMAIL_PROVIDER: mProviders.add(new EmailProvider(this, getFlowParams())); break; case AuthUI.PHONE_VERIFICATION_PROVIDER: mProviders.add(new PhoneProvider(this, getFlowParams())); break; default: Log.e(TAG, "Encountered unknown provider parcel with type: " + idpConfig.getProviderId()); } } ViewGroup btnHolder = findViewById(R.id.btn_holder); for (final Provider provider : mProviders) { View loginButton = getLayoutInflater() .inflate(provider.getButtonLayout(), btnHolder, false); loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (provider instanceof IdpProvider) { getDialogHolder().showLoadingDialog(R.string.fui_progress_dialog_loading); } provider.startLogin(AuthMethodPickerActivity.this); } }); if (provider instanceof IdpProvider) { ((IdpProvider) provider).setAuthenticationCallback(this); } btnHolder.addView(loginButton); } }
Source:
public void onReloadPlugin(Plugin oldPlugin, Plugin newPlugin) { if (hasAvatarProvider(newPlugin)) { avatarSupport = true; } else { if (avatarSupport && hasAvatarProvider(oldPlugin)) { avatarSupport = false; } } }

Target:
public void onReloadPlugin(Plugin oldPlugin, Plugin newPlugin) { update(); }
Source:
public String getId() { if (!isNullOrEmpty(id)) { return id; } else if (!isNullOrEmpty(publisher) && !isNullOrEmpty(name) && !isNullOrEmpty(version)) { return String.format("%s/%s/%s", publisher, name, version); } else { return null; } }

Target:
public String getId() { return id; }
Source:
public void setup() { commonOptions = PipelineOptionsFactory.as(HBaseImportOptions.class); String projectId = checkNotNull(System.getProperty(BigtableOptionsFactory.PROJECT_ID_KEY), "Project Id"); commonOptions.setBigtableProjectId(projectId); commonOptions.setBigtableClusterId( checkNotNull(System.getProperty(BigtableOptionsFactory.CLUSTER_KEY), "Cluster Id")); commonOptions.setBigtableZoneId( checkNotNull(System.getProperty(BigtableOptionsFactory.ZONE_KEY), "Zone Id")); commonOptions.setStagingLocation( checkNotNull(System.getProperty("google.dataflow.stagingLocation"), "Staging Location")); cloudTestDataFolder = checkNotNull(System.getProperty(CLOUD_TEST_DATA_FOLDER), CLOUD_TEST_DATA_FOLDER); if (!cloudTestDataFolder.endsWith(File.separator)) { cloudTestDataFolder = cloudTestDataFolder + File.separator; } }

Target:
public void setup() throws Exception { commonOptions = PipelineOptionsFactory.as(HBaseImportOptions.class); commonOptions.setBigtableProjectId( checkNotNull(System.getProperty(BigtableOptionsFactory.PROJECT_ID_KEY), "Required property missing: " + BigtableOptionsFactory.PROJECT_ID_KEY)); commonOptions.setBigtableClusterId( checkNotNull(System.getProperty(BigtableOptionsFactory.CLUSTER_KEY), "Required property missing: " + BigtableOptionsFactory.CLUSTER_KEY)); commonOptions.setBigtableZoneId( checkNotNull(System.getProperty(BigtableOptionsFactory.ZONE_KEY), "Required property missing: " + BigtableOptionsFactory.ZONE_KEY)); commonOptions.setStagingLocation( checkNotNull(System.getProperty(GOOGLE_DATAFLOW_STAGING_LOCATION), "Required property missing: " + GOOGLE_DATAFLOW_STAGING_LOCATION)); commonOptions.setMaxNumWorkers(1); cloudTestDataFolder = checkNotNull(System.getProperty(CLOUD_TEST_DATA_FOLDER), CLOUD_TEST_DATA_FOLDER); if (!cloudTestDataFolder.endsWith(File.separator)) { cloudTestDataFolder = cloudTestDataFolder + File.separator; } tableUtilsFactory = BigtableTableUtilsFactory.from(commonOptions); }
Source:
public Object createModule(String name) throws CheckstyleException { Object instance = null; if (!name.contains(PACKAGE_SEPARATOR)) { instance = createFromExistingName(name); if (instance == null) { if (thirdPartyNameToFullModuleNames == null) { thirdPartyNameToFullModuleNames = generateThirdPartyNameToFullModuleName(moduleClassLoader); } instance = createObjectFromMap(name, thirdPartyNameToFullModuleNames); } } if (instance == null) { instance = createObject(name); } if (instance == null && useBruteForceModuleLoading) { instance = createModuleByBruteForce(name); } if (instance == null) { String attemptedNames = null; if (!name.contains(PACKAGE_SEPARATOR)) { final String nameCheck = name + CHECK_SUFFIX; attemptedNames = joinPackageNamesWithClassName(name, packages) + STRING_SEPARATOR + nameCheck + STRING_SEPARATOR + joinPackageNamesWithClassName(nameCheck, packages); } final LocalizedMessage exceptionMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, UNABLE_TO_INSTANTIATE_EXCEPTION_MESSAGE, new String[] {name, attemptedNames}, null, getClass(), null); throw new CheckstyleException(exceptionMessage.getMessage()); } return instance; }

Target:
public Object createModule(String name) throws CheckstyleException { Object instance = null; if (!name.contains(PACKAGE_SEPARATOR)) { instance = createFromStandardCheckSet(name); if (instance == null) { if (thirdPartyNameToFullModuleNames == null) { thirdPartyNameToFullModuleNames = generateThirdPartyNameToFullModuleName(moduleClassLoader); } instance = createObjectFromMap(name, thirdPartyNameToFullModuleNames); } } if (instance == null) { instance = createObject(name); } if (instance == null && moduleLoadOption == ModuleLoadOption.TRY_IN_ALL_REGISTERED_PACKAGES) { instance = createModuleByTryInEachPackage(name); } if (instance == null) { String attemptedNames = null; if (!name.contains(PACKAGE_SEPARATOR)) { final String nameCheck = name + CHECK_SUFFIX; attemptedNames = joinPackageNamesWithClassName(name, packages) + STRING_SEPARATOR + nameCheck + STRING_SEPARATOR + joinPackageNamesWithClassName(nameCheck, packages); } final LocalizedMessage exceptionMessage = new LocalizedMessage(0, Definitions.CHECKSTYLE_BUNDLE, UNABLE_TO_INSTANTIATE_EXCEPTION_MESSAGE, new String[] {name, attemptedNames}, null, getClass(), null); throw new CheckstyleException(exceptionMessage.getMessage()); } return instance; }
Source:
public void testGetProducerConfigs() { final Map<String, Object> returnedProps = streamsConfig.getProducerConfigs(clientId); assertThat(returnedProps.get(ProducerConfig.CLIENT_ID_CONFIG), equalTo(clientId)); assertThat(returnedProps.get(ProducerConfig.LINGER_MS_CONFIG), equalTo("100")); assertThat(returnedProps.get(ProducerConfig.TRANSACTION_TIMEOUT_CONFIG), equalTo("10000")); }

Target:
public void testGetProducerConfigs() { final Map<String, Object> returnedProps = streamsConfig.getProducerConfigs(clientId); assertThat(returnedProps.get(ProducerConfig.CLIENT_ID_CONFIG), equalTo(clientId)); assertThat(returnedProps.get(ProducerConfig.LINGER_MS_CONFIG), equalTo("100")); assertThat(returnedProps.get(ProducerConfig.TRANSACTION_TIMEOUT_CONFIG), equalTo(10000)); }
Source:
public void testCanvasCommandExecuteInsertBelow() { final DecisionRule existingRule = new DecisionRule(); final DMNGridRow existingUiRow = new DMNGridRow(); dtable.getRule().add(existingRule); uiModel.appendRow(existingUiRow); makeCommand(1); uiModel.appendColumn(uiInputClauseColumn); uiModel.appendColumn(uiOutputClauseColumn); uiModel.appendColumn(uiDescriptionColumn); final Command<GraphCommandExecutionContext, RuleViolation> graphCommand = command.newGraphCommand(canvasHandler); final Command<AbstractCanvasHandler, CanvasViolation> canvasCommand = command.newCanvasCommand(canvasHandler); graphCommand.execute(graphCommandExecutionContext); canvasCommand.execute(canvasHandler); assertEquals(2, uiModel.getRowCount()); assertEquals(existingUiRow, uiModel.getRow(0)); assertEquals(uiModelRow, uiModel.getRow(1)); verify(command).updateRowNumbers(); verify(command).updateParentInformation(); }

Target:
public void testCanvasCommandExecuteInsertBelow() { final DecisionRule existingRule = new DecisionRule(); final DMNGridRow existingUiRow = new DMNGridRow(); dtable.getRule().add(existingRule); uiModel.appendRow(existingUiRow); dtable.getInput().add(new InputClause()); dtable.getOutput().add(new OutputClause()); makeCommand(1); uiModel.appendColumn(uiInputClauseColumn); uiModel.appendColumn(uiOutputClauseColumn); uiModel.appendColumn(uiDescriptionColumn); final Command<GraphCommandExecutionContext, RuleViolation> graphCommand = command.newGraphCommand(canvasHandler); final Command<AbstractCanvasHandler, CanvasViolation> canvasCommand = command.newCanvasCommand(canvasHandler); graphCommand.execute(graphCommandExecutionContext); canvasCommand.execute(canvasHandler); assertEquals(2, uiModel.getRowCount()); assertEquals(existingUiRow, uiModel.getRow(0)); assertEquals(uiModelRow, uiModel.getRow(1)); assertDefaultUiRowValues(1); verify(command).updateRowNumbers(); verify(command).updateParentInformation(); }