auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ColumnWriterV1(ColumnDescriptor path, PageWriter pageWriter, BloomFilterWriter bloomFilterWriter, ParquetProperties props) { this(path, pageWriter, props); if (path.getPath().length == 1) { this.bloomFilterWriter = bloomFilterWriter; HashMap<String, Long> bloomFilterInfo = props.getBloomFilterInfo(); String column = path.getPath()[0]; if (bloomFilterInfo.keySet().contains(column)) { this.bloomFilter = new BloomFilter(bloomFilterInfo.get(column).intValue()); } } }

Target:
public ColumnWriterV1(ColumnDescriptor path, PageWriter pageWriter, BloomFilterWriter bloomFilterWriter, ParquetProperties props) { super(path, pageWriter, bloomFilterWriter, props); }
Source:
public void testAcceptWhenIsExpectedClass() { when(rule.getId()).thenReturn(definition.getClass().getName()); boolean actual = check.accepts(rule, context); assertTrue(actual); }

Target:
public void testAcceptWhenIsExpectedClass() { when(rule.getId()).thenReturn(definition.getClass().getName()); final boolean actual = check.accepts(rule, context); assertTrue(actual); }
Source:
public void support_short_form_subscriber_methods() { final ShortFormSubscriber subscriber = new ShortFormSubscriber(); checkFailure(subscriber); }

Target:
public void support_short_form_subscriber_methods() { final FailureMessageSubscriber subscriber = new FailureMessageSubscriber(); checkFailure(subscriber); }
Source:
private List<Guid> performVmCheckpointsOperation(VDSCommandType vdsCommandType, VdsAndVmIDVDSParametersBase params) { VDSReturnValue vdsRetVal; try { vdsRetVal = runVdsCommand(vdsCommandType, params); if (!vdsRetVal.getSucceeded()) { EngineException engineException = new EngineException(); engineException.setVdsError(vdsRetVal.getVdsError()); throw engineException; } } catch (EngineException e) { log.error("Failed to execute '{}': {}", vdsCommandType, e); throw e; } return (List<Guid>) vdsRetVal.getReturnValue(); }

Target:
private VDSReturnValue performVmCheckpointsOperation(VDSCommandType vdsCommandType, VdsAndVmIDVDSParametersBase params) { VDSReturnValue vdsRetVal; try { vdsRetVal = runVdsCommand(vdsCommandType, params); if (!vdsRetVal.getSucceeded()) { EngineException engineException = new EngineException(); engineException.setVdsError(vdsRetVal.getVdsError()); engineException.setVdsReturnValue(vdsRetVal); throw engineException; } } catch (EngineException e) { log.error("Failed to execute '{}': {}", vdsCommandType, e); throw e; } return vdsRetVal; }
Source:
public void setCallback(ReportProblemFragmentCallback callback) { this.mCallback = callback; }

Target:
public void setCallback(ReportProblemFragmentCallback callback) { mCallback = callback; }
Source:
public void setup() { Request request1 = preparePost() .setUri(uriBuilderFrom(server.getBaseUrl()).replacePath("/v1/statement").build()) .setBodyGenerator(createStaticBodyGenerator(LONG_LASTING_QUERY, UTF_8)) .setHeader(PRESTO_USER, "user1") .build(); queryResults = client.execute(request1, createJsonResponseHandler(QUERY_RESULTS_JSON_CODEC)); client.execute(prepareGet().setUri(queryResults.getNextUri()).build(), createJsonResponseHandler(QUERY_RESULTS_JSON_CODEC)); Request request2 = preparePost() .setUri(uriBuilderFrom(server.getBaseUrl()).replacePath("/v1/statement").build()) .setBodyGenerator(createStaticBodyGenerator(LONG_LASTING_QUERY, UTF_8)) .setHeader(PRESTO_USER, "user2") .build(); QueryResults queryResults2 = client.execute(request2, createJsonResponseHandler(jsonCodec(QueryResults.class))); client.execute(prepareGet().setUri(queryResults2.getNextUri()).build(), createJsonResponseHandler(QUERY_RESULTS_JSON_CODEC)); int queryCount = 0; boolean queued = true; while (queued && queryCount != 2) { queued = false; List<BasicQueryInfo> queryInfos = client.execute( prepareGet().setUri(uriBuilderFrom(server.getBaseUrl()).replacePath("/v1/query").build()).build(), createJsonResponseHandler(listJsonCodec(BasicQueryInfo.class))); queryCount = queryInfos.size(); for (BasicQueryInfo queryInfo : queryInfos) { queued = queued || queryInfo.getState() == QUEUED; } } }

Target:
public void setup() { Request request1 = preparePost() .setUri(uriBuilderFrom(server.getBaseUrl()).replacePath("/v1/statement").build()) .setBodyGenerator(createStaticBodyGenerator(LONG_LASTING_QUERY, UTF_8)) .setHeader(PRESTO_USER, "user1") .build(); queryResults = client.execute(request1, createJsonResponseHandler(QUERY_RESULTS_JSON_CODEC)); client.execute(prepareGet().setUri(queryResults.getNextUri()).build(), createJsonResponseHandler(QUERY_RESULTS_JSON_CODEC)); Request request2 = preparePost() .setUri(uriBuilderFrom(server.getBaseUrl()).replacePath("/v1/statement").build()) .setBodyGenerator(createStaticBodyGenerator(LONG_LASTING_QUERY, UTF_8)) .setHeader(PRESTO_USER, "user2") .build(); QueryResults queryResults2 = client.execute(request2, createJsonResponseHandler(jsonCodec(QueryResults.class))); client.execute(prepareGet().setUri(queryResults2.getNextUri()).build(), createJsonResponseHandler(QUERY_RESULTS_JSON_CODEC)); while (true) { List<BasicQueryInfo> queryInfos = client.execute( prepareGet().setUri(uriBuilderFrom(server.getBaseUrl()).replacePath("/v1/query").build()).build(), createJsonResponseHandler(listJsonCodec(BasicQueryInfo.class))); if ((queryInfos.size() == 2) && queryInfos.stream().noneMatch(info -> info.getState() == QUEUED)) { break; } } }
Source:
private SseEventSourceImpl(final WebTarget target, final String name, final long reconnectDelay, final boolean open, final ScheduledExecutorService executor) { if (target == null) { throw new IllegalArgumentException(Messages.MESSAGES.webTargetIsNotSetForEventSource()); } this.target = target; this.reconnectDelay = reconnectDelay; this.alwaysReconnect = true; if (executor == null) { ScheduledExecutorService scheduledExecutor = null; if (target instanceof ResteasyWebTarget) { scheduledExecutor = ((ResteasyWebTarget) target).getResteasyClient().getScheduledExecutor(); } if (name != null) { this.sseEventSourceScheduler = new SseEventSourceScheduler(executor, name); } else { this.sseEventSourceScheduler = new SseEventSourceScheduler(executor, String.format("sse-event-source(%s)", target.getUri())); } } else { if (name != null) { this.sseEventSourceScheduler = new SseEventSourceScheduler(executor, name); } else { this.sseEventSourceScheduler = new SseEventSourceScheduler(executor, String.format("sse-event-source(%s)", target.getUri())); } } if (open) { open(); } }

Target:
private SseEventSourceImpl(final WebTarget target, final String name, final long reconnectDelay, final boolean open, final ScheduledExecutorService executor) { if (target == null) { throw new IllegalArgumentException(Messages.MESSAGES.webTargetIsNotSetForEventSource()); } this.target = target; this.reconnectDelay = reconnectDelay; this.alwaysReconnect = true; if (executor == null) { ScheduledExecutorService scheduledExecutor = null; if (target instanceof ResteasyWebTarget) { scheduledExecutor = ((ResteasyWebTarget) target).getResteasyClient().getScheduledExecutor(); } if (name != null) { this.sseEventSourceScheduler = new SseEventSourceScheduler(scheduledExecutor, name); } else { this.sseEventSourceScheduler = new SseEventSourceScheduler(scheduledExecutor, String.format("sse-event-source(%s)", target.getUri())); } } else { if (name != null) { this.sseEventSourceScheduler = new SseEventSourceScheduler(executor, name); } else { this.sseEventSourceScheduler = new SseEventSourceScheduler(executor, String.format("sse-event-source(%s)", target.getUri())); } } if (open) { open(); } }
Source:
public void testMultiSliceAggregationOutput(boolean hashEnabled) { int fixedWidthSize = SIZE_OF_LONG + SIZE_OF_DOUBLE + SIZE_OF_DOUBLE; int multiSlicePositionCount = (int) (1.3 * DEFAULT_MAX_PAGE_SIZE_IN_BYTES / fixedWidthSize); List<Integer> hashChannels = Ints.asList(1); RowPagesBuilder rowPagesBuilder = rowPagesBuilder(hashEnabled, hashChannels, BIGINT, BIGINT); List<Page> input = rowPagesBuilder .addSequencePage(multiSlicePositionCount, 0, 0) .build(); HashAggregationOperatorFactory operatorFactory = new HashAggregationOperatorFactory( 0, new PlanNodeId("test"), ImmutableList.of(BIGINT), hashChannels, ImmutableList.of(), Step.SINGLE, ImmutableList.of(COUNT.bind(ImmutableList.of(0), Optional.empty()), LONG_AVERAGE.bind(ImmutableList.of(1), Optional.empty())), rowPagesBuilder.getHashChannel(), Optional.empty(), 100_000, new DataSize(16, MEGABYTE), joinCompiler); assertEquals(toPages(operatorFactory, createDriverContext(), input).size(), 2); }

Target:
public void testMultiSliceAggregationOutput(boolean hashEnabled) { int fixedWidthSize = SIZE_OF_LONG + SIZE_OF_LONG + SIZE_OF_LONG + SIZE_OF_DOUBLE; int multiSlicePositionCount = (int) (1.5 * PageBuilderStatus.DEFAULT_MAX_PAGE_SIZE_IN_BYTES / fixedWidthSize); List<Integer> hashChannels = Ints.asList(1); RowPagesBuilder rowPagesBuilder = rowPagesBuilder(hashEnabled, hashChannels, BIGINT, BIGINT); List<Page> input = rowPagesBuilder .addSequencePage(multiSlicePositionCount, 0, 0) .build(); HashAggregationOperatorFactory operatorFactory = new HashAggregationOperatorFactory( 0, new PlanNodeId("test"), ImmutableList.of(BIGINT), hashChannels, ImmutableList.of(), Step.SINGLE, ImmutableList.of(COUNT.bind(ImmutableList.of(0), Optional.empty()), LONG_AVERAGE.bind(ImmutableList.of(1), Optional.empty())), rowPagesBuilder.getHashChannel(), Optional.empty(), 100_000, new DataSize(16, MEGABYTE), joinCompiler); assertEquals(toPages(operatorFactory, createDriverContext(), input).size(), 2); }
Source:
public void onEvent(SensorEvent<Boolean> event) { final MySqlNode node = (MySqlNode) event.getSource(); if (Boolean.TRUE.equals(event.getValue()) && Boolean.FALSE.equals(node.getAttribute(MySqlNode.SERVICE_UP)) && !Boolean.TRUE.equals(node.getAttribute(NODE_REPLICATION_INITIALIZED))) { if (Boolean.TRUE.equals(node.getAttribute(NODE_REPLICATION_INITIALIZED))) { return; } ((EntityLocal)node).setAttribute(NODE_REPLICATION_INITIALIZED, Boolean.TRUE); DynamicTasks.queueIfPossible(TaskBuilder.builder() .name("Configure master-slave replication on node") .body(new InitReplicationTask(cluster, node)) .build()) .orSubmitAsync(node); } }

Target:
public void onEvent(SensorEvent<Boolean> event) { final MySqlNode node = (MySqlNode) event.getSource(); if (Boolean.TRUE.equals(event.getValue()) && Boolean.FALSE.equals(node.getAttribute(MySqlNode.SERVICE_UP)) && !Boolean.TRUE.equals(node.getAttribute(NODE_REPLICATION_INITIALIZED))) { ((EntityLocal)node).setAttribute(NODE_REPLICATION_INITIALIZED, Boolean.TRUE); DynamicTasks.queueIfPossible(TaskBuilder.builder() .name("Configure master-slave replication on node") .body(new InitReplicationTask(cluster, node)) .build()) .orSubmitAsync(node); } }
Source:
public E first(E defaultValue) { if (size() > 0) { return get(0); } else { return defaultValue; } }

Target:
public E first(E defaultValue) { return firstImpl(false, defaultValue); }
Source:
public void age() { Entity person = new DynamicEntity(personBirthDateMeta); person.set("birthdate", now().atOffset(UTC).toLocalDate()); Bindings bindings = jsMagmaScriptEvaluator.createBindings(person); Object result = jsMagmaScriptEvaluator.eval(bindings, "$('birthdate').age().value()"); assertEquals(result, 0d); Stopwatch sw = Stopwatch.createStarted(); for (int i = 0; i < 10000; i++) { jsMagmaScriptEvaluator.eval(bindings, "$('birthdate').age().value()"); } System.out.println(sw.elapsed(TimeUnit.MILLISECONDS) + " millis passed new"); sw.reset().start(); for (int i = 0; i < 10000; i++) { jsMagmaScriptEvaluator.eval("$('birthdate').age().value()", person); } System.out.println(sw.elapsed(TimeUnit.MILLISECONDS) + " millis passed old"); }

Target:
public void age() { Entity person = new DynamicEntity(personBirthDateMeta); person.set("birthdate", now().atOffset(UTC).toLocalDate()); Object result = jsMagmaScriptEvaluator.eval("$('birthdate').age().value()", person); assertEquals(result, 0d); }
Source:
public void createCollection(String collection, CloudSolrClient client) throws SolrFactoryException { try { CollectionAdminResponse aliasResponse = new CollectionAdminRequest.ListAliases().process(client); if (aliasResponse != null) { Map<String, String> aliases = aliasResponse.getAliases(); if (aliases != null && aliases.containsKey(collection)) { LOGGER.debug( "Solr({}): Collection exists as an Alias, will not create collection", collection); return; } } CollectionAdminResponse response = new CollectionAdminRequest.List().process(client); if (response.getResponse() == null) { throw new SolrFactoryException("Failed to get a list of existing collections"); } List<String> collections = (List<String>) response.getResponse().get("collections"); if (collections == null) { throw new SolrFactoryException("Failed to get a list of existing collections"); } if (!collections.contains(collection)) { response = CollectionAdminRequest.createCollection(collection, collection, shardCount, shardCount) .setMaxShardsPerNode(maximumShardsPerNode) .setReplicationFactor(replicationFactor) .process(client); if (!response.isSuccess()) { throw new SolrFactoryException( "Failed to create collection [" + collection + "]: " + response.getErrorMessages()); } if (!isCollectionReady(client, collection)) { throw new SolrFactoryException( "Solr collection [" + collection + "] was not ready in time."); } } else { LOGGER.debug("Solr({}): Collection already exists", collection); } } catch (SolrServerException | SolrException | IOException e) { throw new SolrFactoryException("Failed to create collection: " + collection, e); } }

Target:
public void createCollection(String collection, CloudSolrClient client) throws SolrFactoryException { try { if (aliasExists(collection, client)) { LOGGER.debug( "Solr({}): Collection exists as an Alias, will not create collection", collection); return; } if (!collectionExists(collection, client)) { CollectionAdminResponse response = CollectionAdminRequest.createCollection(collection, collection, shardCount, shardCount) .setMaxShardsPerNode(maximumShardsPerNode) .setReplicationFactor(replicationFactor) .process(client); if (!response.isSuccess()) { throw new SolrFactoryException( "Failed to create collection [" + collection + "]: " + response.getErrorMessages()); } if (!isCollectionReady(client, collection)) { throw new SolrFactoryException( "Solr collection [" + collection + "] was not ready in time."); } } else { LOGGER.debug("Solr({}): Collection already exists", collection); } } catch (SolrServerException | SolrException | IOException e) { throw new SolrFactoryException("Failed to create collection: " + collection, e); } }
Source:
public CrossesListDescriptionSheetParser(final T importedList, final UserDataManager userDataManager) { this.importedList = importedList; this.doParseDetails = true; this.doParseConditions = true; this.doParseFactors = true; this.doParseVariates = true; this.userDataManager = userDataManager; this.descriptionSheetIndex = 0; ; }

Target:
public CrossesListDescriptionSheetParser(final T importedList, final UserDataManager userDataManager) { this.importedList = importedList; this.doParseDetails = true; this.doParseConditions = true; this.doParseFactors = true; this.doParseVariates = true; this.userDataManager = userDataManager; this.descriptionSheetIndex = 0; }
Source:
public static SortedKeyValueIterator<Key,Value> createSource(IteratorTestInput input) { return new ColumnFamilySkippingIterator(new SortedMapIterator(Objects.requireNonNull(input).getInput())); }

Target:
public static SortedKeyValueIterator<Key,Value> createSource(IteratorTestInput input) { return new SimpleKVReusingIterator(new ColumnFamilySkippingIterator(new SortedMapIterator(Objects.requireNonNull(input).getInput()))); }
Source:
static public Date lastUpdate(Item item) { if(isDefaultServiceAvailable()) { return lastUpdate(item, defaultService); } else { return null; } }

Target:
static public AbstractInstant lastUpdate(Item item) { if(isDefaultServiceAvailable()) { return lastUpdate(item, defaultService); } else { return null; } }
Source:
public <O> ListenableFuture<O> borrowBatchAsync(int maxSize, Function<List<T>, BorrowResult<T, O>> function) { checkArgument(maxSize >= 0, "maxSize must be at least 0"); ListenableFuture<List<T>> borrowedListFuture; AtomicBoolean borrowerIncremented = new AtomicBoolean(); synchronized (this) { List<T> list = getBatch(maxSize); if (!list.isEmpty()) { borrowedListFuture = immediateFuture(list); borrowerIncremented.set(true); borrowerCount++; } else if (finishing && borrowerCount == 0) { borrowedListFuture = immediateFuture(ImmutableList.of()); } else { borrowedListFuture = Futures.transform(notEmptySignal, ignored -> { synchronized (this) { List<T> batch = getBatch(maxSize); if (!batch.isEmpty()) { borrowerIncremented.set(true); borrowerCount++; } return batch; } }, executor); } } return Futures.transform( borrowedListFuture, elements -> { try { BorrowResult<T, O> borrowResult; borrowResult = function.apply(elements); if (!borrowerIncremented.get()) { checkArgument(borrowResult.getElementsToInsert().isEmpty(), "Function must not insert anything when no element is borrowed"); return borrowResult.getResult(); } for (T element : borrowResult.getElementsToInsert()) { offer(element); } return borrowResult.getResult(); } finally { if (borrowerIncremented.get()) { synchronized (this) { borrowerCount--; signalIfFinishing(); } } } }); }

Target:
public <O> ListenableFuture<O> borrowBatchAsync(int maxSize, Function<List<T>, BorrowResult<T, O>> function) { checkArgument(maxSize >= 0, "maxSize must be at least 0"); ListenableFuture<List<T>> borrowedListFuture; synchronized (this) { List<T> list = getBatch(maxSize); if (!list.isEmpty()) { borrowedListFuture = immediateFuture(list); borrowerCount++; } else if (finishing && borrowerCount == 0) { borrowedListFuture = immediateFuture(ImmutableList.of()); } else { borrowedListFuture = Futures.transform( notEmptySignal, ignored -> { synchronized (this) { List<T> batch = getBatch(maxSize); if (!batch.isEmpty()) { borrowerCount++; } return batch; } }, executor); } } return Futures.transform( borrowedListFuture, elements -> { try { BorrowResult<T, O> borrowResult = function.apply(elements); if (elements.isEmpty()) { checkArgument(borrowResult.getElementsToInsert().isEmpty(), "Function must not insert anything when no element is borrowed"); return borrowResult.getResult(); } for (T element : borrowResult.getElementsToInsert()) { offer(element); } return borrowResult.getResult(); } finally { if (!elements.isEmpty()) { synchronized (this) { borrowerCount--; signalIfFinishing(); } } } }); }
Source:
private static void assertTypeIsBindable(final MetaClass type) { if ((!type.isAnnotationPresent(Bindable.class) && !getConfiguredBindableTypes().contains(type)) || getConfiguredNonBindableTypes().contains(type)) { throw new GenerationException(type.getName() + " must be a @Bindable type when used as @Model"); } }

Target:
private static void assertTypeIsBindable(final MetaClass type) { if (!isBindableType(type)) { throw new GenerationException(type.getName() + " must be a @Bindable type when used as @Model"); } }
Source:
public String[] getSubpictureStreamSelectionDescriptors(String formatMatch) { SubpictureFormat[] afs = getSubpictureFormats(formatMatch); String[] rv = new String[afs.length]; for (int i = 0; i < afs.length; i++) { rv[i] = "# " + (i + 1); String lang = afs[i].getLanguage(); if (lang != null && lang.length() > 0) rv[i] += " " + lang + (afs[i].getForced() ? " [Forced]" : ""); } return rv; }

Target:
public String[] getSubpictureStreamSelectionDescriptors(String formatMatch) { SubpictureFormat[] afs = getSubpictureFormats(formatMatch); String[] rv = new String[afs.length]; for (int i = 0; i < afs.length; i++) { rv[i] = "# " + (i + 1); String lang = afs[i].getLanguage(); if (lang != null && lang.length() > 0) rv[i] += " " + lang + (afs[i].getForced() ? " [" + sage.Sage.rez("Forced") + "]" : ""); } return rv; }
Source:
private LRNLayer(@Parameter(LayerIndex.class) final int index, @Parameter(LayerInputShape.class) final String inputShape, @Parameter(LocalSize.class) final int localSize, @Parameter(Alpha.class) final float alpha, @Parameter(Beta.class) final float beta, @Parameter(K.class) final float k, final MatrixFactory matrixFactory) { super(index, inputShape); this.localSize = localSize; this.alpha = alpha; this.beta = beta; this.k = k; this.matrixFactory = matrixFactory; this.padSize = (localSize - 1) / 2; if (getInputShape().length == 3) { this.channelSize = getInputShape()[1] * getInputShape()[2]; } else { this.channelSize = getInputShape()[0] * getInputShape()[1]; } }

Target:
private LRNLayer(@Parameter(LayerIndex.class) final int index, @Parameter(LayerInputShape.class) final String inputShape, @Parameter(LocalSize.class) final int localSize, @Parameter(Alpha.class) final float alpha, @Parameter(Beta.class) final float beta, @Parameter(K.class) final float k, final MatrixFactory matrixFactory) { super(index, inputShape); this.localSize = localSize; this.alpha = alpha; this.beta = beta; this.k = k; this.paddingSize = (localSize - 1) / 2; this.matrixFactory = matrixFactory; if (getInputShape().length == 2) { this.inputChannel = 1; this.inputSize = getInputShape()[0] * getInputShape()[1]; } else { this.inputChannel = getInputShape()[0]; this.inputSize = getInputShape()[1] * getInputShape()[2]; } }
Source:
public void waitRemoveItemsByPath(String pathToItem) { loadPageTimeout.until( ExpectedConditions.not( ExpectedConditions.presenceOfAllElementsLocatedBy( By.xpath(String.format(" }

Target:
public void waitRemoveItemsByPath(String pathToItem) { loadPageTimeout.until( not( presenceOfAllElementsLocatedBy( By.xpath(String.format(" }
Source:
private boolean hasNoSecurityConstraint(XmlFile file) { NodeList nodeList = evaluate(securityConstraintExpression, file.getNamespaceUnawareDocument()); return (nodeList.getLength() == 0); }

Target:
private boolean hasNoSecurityConstraint(XmlFile file) { NodeList nodeList = evaluate(securityConstraintExpression, file.getNamespaceUnawareDocument()); return nodeList.getLength() == 0; }
Source:
private InsertOptions buildInsertOptions() { final InsertOptions options = InsertOptions.insertOptions(); if (persistTo != PersistTo.NONE || replicateTo != ReplicateTo.NONE) { options.durability(persistTo, replicateTo); } else if (durabilityLevel != DurabilityLevel.NONE) { options.durability(durabilityLevel); } if (expiry != null && !expiry.equals(Duration.ofSeconds(0))) { options.expiry(expiry); } else if (domainType.isAnnotationPresent(Document.class)) { Document documentAnn = domainType.getAnnotation(Document.class); long durationSeconds = documentAnn.expiryUnit().toSeconds(documentAnn.expiry()); options.expiry(Duration.ofSeconds(durationSeconds)); } return options; }

Target:
private InsertOptions buildInsertOptions() { final InsertOptions options = InsertOptions.insertOptions(); if (persistTo != PersistTo.NONE || replicateTo != ReplicateTo.NONE) { options.durability(persistTo, replicateTo); } else if (durabilityLevel != DurabilityLevel.NONE) { options.durability(durabilityLevel); } if (expiry != null && ! expiry.isZero()) { options.expiry(expiry); } else if (domainType.isAnnotationPresent(Document.class)) { Document documentAnn = domainType.getAnnotation(Document.class); long durationSeconds = documentAnn.expiryUnit().toSeconds(documentAnn.expiry()); options.expiry(Duration.ofSeconds(durationSeconds)); } return options; }
Source:
public Object getProperty(String key, Object defaultValue) { Object value = null; if (StringUtils.isNotEmpty(prefix) && StringUtils.isNotEmpty(id)) { value = getInternalProperty(prefix + id + "." + key); } if (value == null && StringUtils.isNotEmpty(prefix)) { value = getInternalProperty(prefix + key); } if (value == null) { value = getInternalProperty(key); if (value == null) { value = defaultValue; } } return value; }

Target:
public Object getProperty(String key, Object defaultValue) { Object value = null; if (StringUtils.isNotEmpty(prefix) && StringUtils.isNotEmpty(id)) { value = getInternalProperty(prefix + id + "." + key); } if (value == null && StringUtils.isNotEmpty(prefix)) { value = getInternalProperty(prefix + key); } if (value == null) { value = getInternalProperty(key); } return value != null ? value : defaultValue; }
Source:
public Set<Integer> extractVariableIdsFromDataset(final Integer studyId, final Integer datasetId) { final Set<Integer> variableIds = new HashSet<>(); boolean isPlotDataset = false; final List<DmsProject> projects = this.daoFactory.getDmsProjectDAO().getDatasetsByStudy(studyId); final List<Integer> projectIds = new ArrayList<>(); for (final DmsProject dmsProject : projects) { projectIds.add(dmsProject.getProjectId()); if (dmsProject.getProjectId().equals(datasetId) && dmsProject.getDatasetType().getDatasetTypeId().intValue() == DatasetTypeEnum.PLOT_DATA.getId()) { isPlotDataset = true; } } final List<MeasurementVariable> measurementVariables; if (isPlotDataset) { measurementVariables = this.daoFactory.getDmsProjectDAO().getObservationSetVariables(projectIds, Arrays .asList(VariableType.TRAIT.getId(), VariableType.ENVIRONMENT_DETAIL.getId(), VariableType.STUDY_CONDITION.getId())); } else { measurementVariables = this.daoFactory.getDmsProjectDAO().getObservationSetVariables(Arrays.asList(datasetId), Arrays .asList(VariableType.TRAIT.getId())); } for (final MeasurementVariable measurementVariable : measurementVariables) { variableIds.add(measurementVariable.getTermId()); } return variableIds; }

Target:
Set<Integer> extractVariableIdsFromDataset(final Integer studyId, final Integer datasetId) { final Set<Integer> variableIds = new HashSet<>(); boolean isPlotDataset = false; final List<DatasetDTO> projects = this.daoFactory.getDmsProjectDAO().getDatasets(studyId); final List<Integer> projectIds = new ArrayList<>(); for (final DatasetDTO datasetDTO : projects) { projectIds.add(datasetDTO.getDatasetId()); if (datasetDTO.getDatasetId().equals(datasetId) && datasetDTO.getDatasetTypeId().intValue() == DatasetTypeEnum.PLOT_DATA.getId()) { isPlotDataset = true; } } final List<MeasurementVariable> measurementVariables; if (isPlotDataset) { measurementVariables = this.daoFactory.getDmsProjectDAO().getObservationSetVariables(projectIds, CALCULATED_VARIABLE_VARIABLE_TYPES); } else { measurementVariables = this.daoFactory.getDmsProjectDAO().getObservationSetVariables(Collections.singletonList(datasetId), Collections.singletonList(VariableType.TRAIT.getId())); } for (final MeasurementVariable measurementVariable : measurementVariables) { variableIds.add(measurementVariable.getTermId()); } return variableIds; }
Source:
public boolean updatePostContentNewEditor(boolean isAutoSave, String title, String content) { if (mPost == null) { return false; } if (!isAutoSave) { } boolean titleChanged = PostUtils.updatePostTitleIfDifferent(mPost, title); boolean contentChanged = compareCurrentMediaMarkedUploadingToOriginal(content); if (contentChanged) { mPost.setContent(content); } else { if (mEditorFragment instanceof AztecEditorFragment) { contentChanged = ((AztecEditorFragment)mEditorFragment).hasHistory(); if (contentChanged) { mPost.setContent(content); } else if (!((AztecEditorFragment)mEditorFragment).isHistoryEnabled()){ contentChanged = PostUtils.updatePostContentIfDifferent(mPost, content); } } else { contentChanged = PostUtils.updatePostContentIfDifferent(mPost, content); } } if (!mPost.isLocalDraft() && (titleChanged || contentChanged)) { mPost.setIsLocallyChanged(true); mPost.setDateLocallyChanged(DateTimeUtils.iso8601FromTimestamp(System.currentTimeMillis() / 1000)); } return titleChanged || contentChanged; }

Target:
public boolean updatePostContentNewEditor(boolean isAutoSave, String title, String content) { if (mPost == null) { return false; } if (!isAutoSave) { } boolean titleChanged = PostUtils.updatePostTitleIfDifferent(mPost, title); boolean contentChanged; if (compareCurrentMediaMarkedUploadingToOriginal(content)) { contentChanged = true; } else if (mEditorFragment instanceof AztecEditorFragment && ((AztecEditorFragment) mEditorFragment).isHistoryEnabled()) { contentChanged = ((AztecEditorFragment) mEditorFragment).hasHistory(); } else { contentChanged = mPost.getContent().compareTo(content) != 0; } if (contentChanged) { mPost.setContent(content); } if (!mPost.isLocalDraft() && (titleChanged || contentChanged)) { mPost.setIsLocallyChanged(true); mPost.setDateLocallyChanged(DateTimeUtils.iso8601FromTimestamp(System.currentTimeMillis() / 1000)); } return titleChanged || contentChanged; }
Source:
public static double getOrbitalTheta(int orbitalDistance, float solarSize) { double orbitalPeriod = 0; orbitalPeriod = 48D*Math.pow((Math.pow(orbitalDistance, 3)*Math.pow(Math.PI, 2)*10D)/solarSize, 0.5D); return ((AdvancedRocketry.proxy.getWorldTimeUniversal(0) % 24000D*orbitalPeriod)/24000D*orbitalPeriod)*(2D*Math.PI); }

Target:
public static double getOrbitalTheta(int orbitalDistance, float solarSize) { double orbitalPeriod = 48D*Math.pow((Math.pow(orbitalDistance, 3)*Math.pow(Math.PI, 2)*10D)/solarSize, 0.5D); return ((AdvancedRocketry.proxy.getWorldTimeUniversal(0) % 24000D*orbitalPeriod)/24000D*orbitalPeriod)*(2D*Math.PI); }
Source:
private void plugDiskToVmIfNeeded() { if (getVm() != null && getParameters().getPlugDiskToVm() && getVm().getStatus() != VMStatus.Down) { HotPlugDiskToVmParameters params = new HotPlugDiskToVmParameters(getVmId(), getParameters().getDiskInfo().getId()); Backend.getInstance().runInternalAction(VdcActionType.HotPlugDiskToVm, params); } }

Target:
private void plugDiskToVmIfNeeded() { if (Boolean.TRUE.equals(getParameters().getPlugDiskToVm()) && getVm() != null && getVm().getStatus() != VMStatus.Down) { HotPlugDiskToVmParameters params = new HotPlugDiskToVmParameters(getVmId(), getParameters().getDiskInfo().getId()); VdcReturnValueBase returnValue = Backend.getInstance().runInternalAction(VdcActionType.HotPlugDiskToVm, params); if (!returnValue.getSucceeded()) { AuditLogDirector.log(this, AuditLogType.USER_FAILED_HOTPLUG_DISK); } } }
Source:
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { if (args == null) { return Collections.emptyList(); } else if (args.length == 1) { return StringUtil.copyPartialMatches(args[0], SOUNDS, new ArrayList(SOUNDS.size())); } else if (args.length == 2) { return StringUtil.copyPartialMatches(args[1], SOURCES, new ArrayList(SOURCES.size())); } else if (args.length == 3) { return super.tabComplete(sender, alias, args); } else { return Collections.emptyList(); } }

Target:
public List<String> tabComplete(CommandSender sender, String alias, String[] args) throws IllegalArgumentException { if (args == null) { return Collections.emptyList(); } else if (args.length == 1) { String sound = args[0]; if (!sound.startsWith("minecraft:")) { final int colonIndex = sound.indexOf(':'); sound = "minecraft:" + sound.substring(colonIndex == -1 ? 0 : (colonIndex + 1)); } return StringUtil.copyPartialMatches(sound, SOUNDS, new ArrayList(SOUNDS.size())); } else if (args.length == 2) { return StringUtil.copyPartialMatches(args[1], SOURCES, new ArrayList(SOURCES.size())); } else if (args.length == 3) { return super.tabComplete(sender, alias, args); } else { return Collections.emptyList(); } }
Source:
public void setApplicationAttributes(AttributeMap map) { this.applicationId = map.get(LogicalPlan.APPLICATION_ID); getStore().setTableName(applicationId); }

Target:
public void setApplicationAttributes(AttributeMap map) { this.applicationId = map.get(DAGContext.APPLICATION_ID); getStore().setTableName(applicationId); }
Source:
private void suggestBranchName(String ref) { if (nameText.getText().length() == 0 || nameIsSuggestion) { int indexOfLastSlash = ref.lastIndexOf("/"); String branchNameSuggestion = indexOfLastSlash != -1 ? ref.substring(indexOfLastSlash + 1) : ref; nameText.setText(branchNameSuggestion); nameIsSuggestion = true; } }

Target:
private void suggestBranchName(String ref) { if (nameText.getText().length() == 0 || nameIsSuggestion) { String branchNameSuggestion = getProposedTargetName(ref); if (branchNameSuggestion != null) { nameText.setText(branchNameSuggestion); nameText.selectAll(); nameIsSuggestion = true; } } }
Source:
public static boolean getUseBMX() { return useBMX; }

Target:
public boolean getUseBMX() { return useBMX; }
Source:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Account account = (Account) o; if (id != account.id) { return false; } if (!name.equals(account.name)) { return false; } if (status != account.status) { return false; } if (snapshotVersion != account.snapshotVersion) { return false; } if (!containerIdToContainerMap.equals(account.containerIdToContainerMap)) { return false; } return containerNameToContainerMap.equals(account.containerNameToContainerMap); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Account account = (Account) o; if (id != account.id) { return false; } if (!name.equals(account.name)) { return false; } if (status != account.status) { return false; } return containerIdToContainerMap.equals(account.containerIdToContainerMap); }
Source:
public void should_send_mail_with_expanded_tokens() { jenkins.restart(); setUpMailer(); FreeStyleJob job = createFreeStyleJob(); P projectAction = createProjectAction(job); job.editPublisher(projectAction.getFreeStyleSettings(), settings -> settings.setBuildFailedTotalAll("0")); String name = projectAction.getUrl().toUpperCase(); String title = "Analysis-Result"; configureEmailNotification(job, String.format("%s: ${%s_RESULT}", title, name), String.format("%s: ${%s_COUNT}-${%s_FIXED}-${%s_NEW}", title, name, name, name)); buildFailingJob(job); verifyReceivedMail(String.format("%s: FAILURE", title), String.format("%s: %d-0-%d", title, getNumberOfWarnings(), getNumberOfWarnings())); }

Target:
public void should_send_mail_with_expanded_tokens() { checkExtensionAreDeployed("hudson.plugins.analysis.tokens.AbstractTokenMacro", Collections.EMPTY_SET); setUpMailer(); FreeStyleJob job = createFreeStyleJob(); P projectAction = createProjectAction(job); job.editPublisher(projectAction.getFreeStyleSettings(), settings -> settings.setBuildFailedTotalAll("0")); String name = projectAction.getUrl().toUpperCase(); String title = "Analysis-Result"; configureEmailNotification(job, String.format("%s: ${%s_RESULT}", title, name), String.format("%s: ${%s_COUNT}-${%s_FIXED}-${%s_NEW}", title, name, name, name)); buildFailingJob(job); verifyReceivedMail(String.format("%s: FAILURE", title), String.format("%s: %d-0-%d", title, getNumberOfWarnings(), getNumberOfWarnings())); }
Source:
public void testVirtualService() throws Exception { List<CSWInfo> infos = GeoServerExtensions.extensions(CSWInfo.class); Catalog catalog = getCatalog(); GeoServer geoServer = getGeoServer(); CSWInfo localCSW = new CSWInfoImpl(); localCSW.setName("localCSW"); localCSW.setWorkspace(catalog.getWorkspaceByName("gs")); localCSW.setAbstract("Local CSW"); CSWInfo globalCSW = geoServer.getService(CSWInfo.class); globalCSW.setAbstract("Global CSW"); geoServer.add(localCSW); geoServer.save(globalCSW); Document dom = getAsDOM(BASEPATH + "?service=csw&version=2.0.2&request=GetCapabilities"); print(dom); checkValidationErrors(dom); assertEquals("Global CSW", xpath.evaluate(" dom = getAsDOM("gs/" + BASEPATH + "?service=csw&version=2.0.2&request=GetCapabilities"); print(dom); checkValidationErrors(dom); assertEquals("Local CSW", xpath.evaluate(" }

Target:
public void testVirtualService() throws Exception { List<CSWInfo> infos = GeoServerExtensions.extensions(CSWInfo.class); Catalog catalog = getCatalog(); GeoServer geoServer = getGeoServer(); CSWInfo localCSW = new CSWInfoImpl(); localCSW.setName("localCSW"); localCSW.setWorkspace(catalog.getWorkspaceByName("gs")); localCSW.setAbstract("Local CSW"); CSWInfo globalCSW = geoServer.getService(CSWInfo.class); globalCSW.setAbstract("Global CSW"); geoServer.add(localCSW); geoServer.save(globalCSW); Document dom = getAsDOM(BASEPATH + "?service=csw&version=2.0.2&request=GetCapabilities"); checkValidationErrors(dom); assertEquals("Global CSW", xpath.evaluate(" dom = getAsDOM("gs/" + BASEPATH + "?service=csw&version=2.0.2&request=GetCapabilities"); checkValidationErrors(dom); assertEquals("Local CSW", xpath.evaluate(" }
Source:
protected void executeCommand() { getParameters().setEntityId(getVmTemplateId()); RemoveVMVDSCommandParameters tempVar = new RemoveVMVDSCommandParameters(getParameters().getStoragePoolId(), getVmTemplateId()); tempVar.setStorageDomainId(getParameters().getStorageDomainId()); Backend.getInstance().getResourceManager().RunVdsCommand(VDSCommandType.RemoveVM, tempVar); List<DiskImage> images = getParameters().getImages(); if (!images.isEmpty()) { for (DiskImage image : images) { ArrayList<Guid> storageIds = new ArrayList<Guid>(); storageIds.add(getParameters().getStorageDomainId()); image.setStorageIds(storageIds); image.setStoragePoolId(getParameters().getStoragePoolId()); } RemoveAllVmImagesParameters tempVar2 = new RemoveAllVmImagesParameters(getVmId(), images); tempVar2.setParentCommand(getActionType()); tempVar2.setEntityId(getParameters().getEntityId()); tempVar2.setForceDelete(true); tempVar2.setParentParameters(getParameters()); VdcReturnValueBase vdcRetValue = Backend.getInstance().runInternalAction(VdcActionType.RemoveAllVmImages, tempVar2, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); if (vdcRetValue.getSucceeded()) { getReturnValue().getTaskIdList().addAll(vdcRetValue.getInternalTaskIdList()); setSucceeded(true); } else { getReturnValue().setFault(vdcRetValue.getFault()); } } EndRemoveTemplate(); }

Target:
protected void executeCommand() { getParameters().setEntityId(getVmTemplateId()); RemoveVMVDSCommandParameters tempVar = new RemoveVMVDSCommandParameters(getParameters().getStoragePoolId(), getVmTemplateId()); tempVar.setStorageDomainId(getParameters().getStorageDomainId()); Backend.getInstance().getResourceManager().RunVdsCommand(VDSCommandType.RemoveVM, tempVar); List<DiskImage> images = getParameters().getImages(); if (!images.isEmpty()) { for (DiskImage image : images) { ArrayList<Guid> storageIds = new ArrayList<Guid>(); storageIds.add(getParameters().getStorageDomainId()); image.setStorageIds(storageIds); image.setStoragePoolId(getParameters().getStoragePoolId()); } RemoveAllVmImagesParameters tempVar2 = new RemoveAllVmImagesParameters(getVmId(), images); tempVar2.setParentCommand(getActionType()); tempVar2.setEntityId(getParameters().getEntityId()); tempVar2.setForceDelete(true); tempVar2.setParentParameters(getParameters()); VdcReturnValueBase vdcRetValue = Backend.getInstance().runInternalAction(VdcActionType.RemoveAllVmImages, tempVar2, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); if (vdcRetValue.getSucceeded()) { getReturnValue().getTaskIdList().addAll(vdcRetValue.getInternalTaskIdList()); setSucceeded(true); } else { getReturnValue().setFault(vdcRetValue.getFault()); } } setCommandShouldBeLogged(false); setSucceeded(true); }
Source:
public void connectLocal() { this.serverConnection = ApiConnection.LOCAL; if (!isServerRouteLoaded()) { return; } this.serverAddress = serverRoute.getLocalAddress(); this.serverApi = buildServerApi(); ServerConnectionDetectingTask.execute(serverRoute); }

Target:
public void connectLocal() { this.serverConnection = ApiConnection.LOCAL; if (!isServerRouteLoaded()) { return; } this.serverAddress = serverRoute.getLocalAddress(); this.serverApi = buildServerApi(); finishServerConnectionDetection(); }
Source:
void remove(I key) { Integer prev = this.identityMap.remove(key); if (prev != null) this.objectList.set(prev, null); }

Target:
void remove(I key) { Integer prev = this.identityMap.remove(key); if (prev != null) { this.objectList.set(prev, null); } }
Source:
public final void cleanExpiredUsersSessions() { Date now = new Date(); Iterator<Entry<String, SessionInfo>> iter = sessionInfoMap.entrySet().iterator(); Set<String> tokens = sessionInfoMap.values().stream() .map(sessionInfo -> (String) sessionInfo.contentOfSession.get(SSO_ACCESS_TOKEN_PARAMETER_NAME)) .collect(Collectors.toSet()); Map<String, Boolean> sessionStatuses = ssoSessionValidator.getSessionStatuses(tokens); while (iter.hasNext()) { Entry<String, SessionInfo> entry = iter.next(); ConcurrentMap<String, Object> sessionMap = entry.getValue().contentOfSession; Date hardLimit = (Date) sessionMap.get(HARD_LIMIT_PARAMETER_NAME); Date softLimit = (Date) sessionMap.get(SOFT_LIMIT_PARAMETER_NAME); boolean sessionValid = sessionStatuses.getOrDefault( sessionMap.get(SSO_ACCESS_TOKEN_PARAMETER_NAME), false); if (((hardLimit != null && hardLimit.before(now)) || (softLimit != null && softLimit.before(now))) || !(boolean) sessionMap.get(SESSION_VALID_PARAMETER_NAME) || !sessionValid) { removeSessionImpl(entry.getKey(), Acct.ReportReason.PRINCIPAL_SESSION_EXPIRED, "Session has expired for principal %1$s", getUserName(entry.getKey())); if (sessionValid) { SsoOAuthServiceUtils.revoke((String) sessionMap.get(SSO_ACCESS_TOKEN_PARAMETER_NAME), ""); } } } }

Target:
public final void cleanExpiredUsersSessions() { Date now = new Date(); Iterator<Entry<String, SessionInfo>> iter = sessionInfoMap.entrySet().iterator(); Set<String> tokens = sessionInfoMap.values().stream() .map(sessionInfo -> (String) sessionInfo.contentOfSession.get(SSO_ACCESS_TOKEN_PARAMETER_NAME)) .collect(Collectors.toSet()); Map<String, Boolean> sessionStatuses = ssoSessionValidator.getSessionStatuses(tokens); while (iter.hasNext()) { Entry<String, SessionInfo> entry = iter.next(); ConcurrentMap<String, Object> sessionMap = entry.getValue().contentOfSession; Date hardLimit = (Date) sessionMap.get(HARD_LIMIT_PARAMETER_NAME); Date softLimit = (Date) sessionMap.get(SOFT_LIMIT_PARAMETER_NAME); String token = (String) sessionMap.get(SSO_ACCESS_TOKEN_PARAMETER_NAME); boolean sessionValid = StringUtils.isEmpty(token) ? false : sessionStatuses.getOrDefault(token, false); if (((hardLimit != null && hardLimit.before(now)) || (softLimit != null && softLimit.before(now))) || !(boolean) sessionMap.get(SESSION_VALID_PARAMETER_NAME) || !sessionValid) { removeSessionImpl(entry.getKey(), Acct.ReportReason.PRINCIPAL_SESSION_EXPIRED, "Session has expired for principal %1$s", getUserName(entry.getKey())); if (sessionValid) { SsoOAuthServiceUtils.revoke((String) sessionMap.get(SSO_ACCESS_TOKEN_PARAMETER_NAME), ""); } } } }
Source:
@Test public void testRowValueExpression() { String expected = "INSERT INTO \"EMPS\"\n" + "VALUES (ROW(1, 'Fred')),\n" + "(ROW(2, 'Eric'))"; sql("insert into emps values ROW(1,'Fred'),ROW(2, 'Eric')") .withDialect(SqlDialect.DatabaseProduct.CALCITE.getDialect()) .ok(expected); expected = "INSERT INTO `emps`\n" + "VALUES (1, 'Fred'),\n" + "(2, 'Eric')"; sql("insert into emps values (1,'Fred'),(2, 'Eric')") .withDialect(SqlDialect.DatabaseProduct.MYSQL.getDialect()) .ok(expected); expected = "INSERT INTO \"EMPS\"\n" + "VALUES (1, 'Fred'),\n" + "(2, 'Eric')"; sql("insert into emps values (1,'Fred'),(2, 'Eric')") .withDialect(SqlDialect.DatabaseProduct.ORACLE.getDialect()) .ok(expected); expected = "INSERT INTO [EMPS]\n" + "VALUES (1, 'Fred'),\n" + "(2, 'Eric')"; sql("insert into [EMPS] values (1,'Fred'),(2, 'Eric')") .withDialect(SqlDialect.DatabaseProduct.MSSQL.getDialect()) .ok(expected); }

Target:
@Test public void testRowValueExpression() { String expected = "INSERT INTO \"EMPS\"\n" + "VALUES (ROW(1, 'Fred')),\n" + "(ROW(2, 'Eric'))"; String sql = "insert into emps values (1,'Fred'),(2, 'Eric')"; sql(sql) .withDialect(SqlDialect.DatabaseProduct.CALCITE.getDialect()) .ok(expected); expected = "INSERT INTO `emps`\n" + "VALUES (1, 'Fred'),\n" + "(2, 'Eric')"; sql(sql) .withDialect(SqlDialect.DatabaseProduct.MYSQL.getDialect()) .ok(expected); expected = "INSERT INTO \"EMPS\"\n" + "VALUES (1, 'Fred'),\n" + "(2, 'Eric')"; sql(sql) .withDialect(SqlDialect.DatabaseProduct.ORACLE.getDialect()) .ok(expected); expected = "INSERT INTO [EMPS]\n" + "VALUES (1, 'Fred'),\n" + "(2, 'Eric')"; sql(sql) .withDialect(SqlDialect.DatabaseProduct.MSSQL.getDialect()) .ok(expected); }
Source:
public void deployUnDeployBPMNPackage() throws Exception { init(); ActivitiRestClient tester = new ActivitiRestClient(bpsServer.getInstance().getPorts().get("http"), bpsServer.getInstance().getHosts().get("default")); String filePath = FrameworkPathUtil.getSystemResourceLocation() + File.separator + BPMNTestConstants.DIR_ARTIFACTS + File.separator + BPMNTestConstants.DIR_BPMN + File.separator + "HelloApprove.bar"; String fileName = "HelloApprove.bar"; String[] deploymentResponse; deploymentResponse = tester.deployBPMNPackage(filePath, fileName); Assert.assertTrue("Deployment Successful", deploymentResponse[0].contains(BPMNTestConstants.CREATED)); String[] deploymentCheckResponse = tester.getDeploymentInfoById(deploymentResponse[1]); Assert.assertTrue("Deployment Present", deploymentCheckResponse[2].contains(fileName)); String status = tester.unDeployBPMNPackage(deploymentResponse[1]); Assert.assertTrue("Package UnDeployed", status.contains(BPMNTestConstants.NO_CONTENT)); }

Target:
public void deployUnDeployBPMNPackage() throws Exception { init(); ActivitiRestClient tester = new ActivitiRestClient(bpsServer.getInstance().getPorts().get("http"), bpsServer.getInstance().getHosts().get("default")); String filePath = FrameworkPathUtil.getSystemResourceLocation() + File.separator + BPMNTestConstants.DIR_ARTIFACTS + File.separator + BPMNTestConstants.DIR_BPMN + File.separator + "HelloApprove.bar"; String fileName = "HelloApprove.bar"; String[] deploymentResponse = {}; String[] deploymentCheckResponse = {}; String deploymentStatus = ""; try { deploymentResponse = tester.deployBPMNPackage(filePath, fileName); Assert.assertTrue("Deployment Successful", deploymentResponse[0].contains(BPMNTestConstants.CREATED)); } catch (Exception exception) { log.error("Failed to Deploy BPMN Package " + fileName, exception); Assert.fail("Failed to Deploy BPMN Package " + fileName); } try { deploymentCheckResponse = tester.getDeploymentInfoById(deploymentResponse[1]); Assert.assertTrue("Deployment Present", deploymentCheckResponse[2].contains(fileName)); } catch (Exception exception) { log.error("Deployed BPMN Package " + fileName + " Not Present", exception); Assert.fail("Deployed BPMN Package " + fileName + " Not Present"); } try { deploymentStatus = tester.unDeployBPMNPackage(deploymentResponse[1]); Assert.assertTrue("Package UnDeployed", deploymentStatus.contains(BPMNTestConstants.NO_CONTENT)); } catch (Exception exception) { log.error("BPMN Package cannot be undeployed " + fileName, exception); Assert.fail("BPMN Package cannot be undeployed " + fileName); } try { String[] unDeployCheck = tester.getDeploymentInfoById(deploymentResponse[1]); Assert.fail("Package Not Present"); } catch (Exception exception) { Assert.assertTrue("BPMN Package " + fileName + " Does Not Exist", BPMNTestConstants.NOT_AVAILABLE.equals(exception.getMessage())); log.error("BPMN Package " + fileName + " Still Exists", exception); } }
Source:
public void testContinousIntegrationCommentsAreRemoved() throws Exception { ChangeDetailXAsResult result = parseFile("testdata/ChangeDetailX_hudson.json"); ChangeDetailX changeDetailX = result.result; assertEquals(1, changeDetailX.getMessages().size()); ChangeMessage lastMessageLeft = changeDetailX.getMessages().get(0); boolean doesNotContainHudsonMessage = !lastMessageLeft.getMessage().contains("hudson.eclipse.org"); assertEquals(true, doesNotContainHudsonMessage); }

Target:
public void testContinousIntegrationCommentsAreRemoved() throws Exception { ChangeDetailXAsResult result = parseFile("testdata/ChangeDetailX_hudson.json"); ChangeDetailX changeDetailX = result.result; assertEquals(1, changeDetailX.getMessages().size()); ChangeMessage lastMessageLeft = changeDetailX.getMessages().get(0); assertFalse(lastMessageLeft.getMessage().contains("hudson.eclipse.org")); }