auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void provision(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { if (!parseBoolean(osEnv.getAttributes().get(ASYNC_PERSIST_ATTRIBUTE))) { return; } if (parseBoolean(osEnv.getAttributes().get(ASYNC_PERSIST_ATTRIBUTE)) && !COMMON_STRATEGY.equals(strategy)) { String message = format( "Workspace configuration not valid: Asynchronous storage available only for 'common' PVC strategy, but got %s", strategy); LOG.warn(message); osEnv.addWarning(new WarningImpl(4200, message)); throw new InfrastructureException(message); } if (parseBoolean(osEnv.getAttributes().get(ASYNC_PERSIST_ATTRIBUTE)) && !isEphemeral(osEnv.getAttributes())) { String message = format( "Workspace configuration not valid: Asynchronous storage available only if '%s' attribute set to false", ASYNC_PERSIST_ATTRIBUTE); LOG.warn(message); osEnv.addWarning(new WarningImpl(4200, message)); throw new InfrastructureException(message); } String namespace = identity.getInfrastructureNamespace(); String userId = identity.getOwnerId(); KubernetesClient oc = clientFactory.create(identity.getWorkspaceId()); String configMapName = namespace + ASYNC_STORAGE_CONFIG; createPvcIfNotExist(oc, namespace, userId); createConfigMapIfNotExist(oc, namespace, configMapName, userId, osEnv); createAsyncStoragePodIfNotExist(oc, namespace, configMapName, userId); createStorageServiceIfNotExist(oc, namespace, userId); }

Target:
public void provision(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { if (!parseBoolean(osEnv.getAttributes().get(ASYNC_PERSIST_ATTRIBUTE))) { return; } if (!COMMON_STRATEGY.equals(pvcStrategy)) { String message = format( "Workspace configuration not valid: Asynchronous storage available only for 'common' PVC strategy, but got %s", pvcStrategy); LOG.warn(message); osEnv.addWarning(new WarningImpl(4200, message)); throw new InfrastructureException(message); } if (!isEphemeral(osEnv.getAttributes())) { String message = format( "Workspace configuration not valid: Asynchronous storage available only if '%s' attribute set to false", ASYNC_PERSIST_ATTRIBUTE); LOG.warn(message); osEnv.addWarning(new WarningImpl(4200, message)); throw new InfrastructureException(message); } String namespace = identity.getInfrastructureNamespace(); String userId = identity.getOwnerId(); KubernetesClient oc = clientFactory.create(identity.getWorkspaceId()); String configMapName = namespace + ASYNC_STORAGE_CONFIG; createPvcIfNotExist(oc, namespace, userId); createConfigMapIfNotExist(oc, namespace, configMapName, userId, osEnv); createAsyncStoragePodIfNotExist(oc, namespace, configMapName, userId); createStorageServiceIfNotExist(oc, namespace, userId); }
Source:
public void parseRemote(String remoteFilePath) { String[] elements = remoteFilePath.split(String.valueOf(S3BackupPath.PATH_SEP)); List<String> pieces = Lists.newArrayList(); for (String ele : elements) { if (ele.equals("")) continue; pieces.add(ele); } assert pieces.size() >= 7 : "Too few elements in path " + remoteFilePath; if (pieces.size() == NUM_PATH_ELEMENTS_CASS_1_0) setCassandra1_0(true); baseDir = pieces.get(0); region = pieces.get(1); clusterName = pieces.get(2); token = pieces.get(3); time = parseDate(pieces.get(4)); type = BackupFileType.valueOf(pieces.get(5)); if (type != BackupFileType.META && type != BackupFileType.META_V2 && type != BackupFileType.CL) { keyspace = pieces.get(6); if (!isCassandra1_0) columnFamily = pieces.get(7); } fileName = pieces.get(pieces.size() - 1); }

Target:
public void parseRemote(String remoteFilePath) { String[] elements = remoteFilePath.split(String.valueOf(S3BackupPath.PATH_SEP)); List<String> pieces = Lists.newArrayList(); for (String ele : elements) { if (ele.equals("")) continue; pieces.add(ele); } assert pieces.size() >= 7 : "Too few elements in path " + remoteFilePath; if (pieces.size() == NUM_PATH_ELEMENTS_CASS_1_0) setCassandra1_0(true); baseDir = pieces.get(0); region = pieces.get(1); clusterName = pieces.get(2); token = pieces.get(3); time = parseDate(pieces.get(4)); type = BackupFileType.valueOf(pieces.get(5)); if (BackupFileType.isDataFile(type)) { keyspace = pieces.get(6); if (!isCassandra1_0) columnFamily = pieces.get(7); } fileName = pieces.get(pieces.size() - 1); }
Source:
protected RecordedRequest assertSent(MockWebServer server, String method, String path) throws InterruptedException { RecordedRequest request = server.takeRequest(); assertEquals(request.getMethod(), method); assertEquals(request.getPath(), path); assertEquals(request.getHeader("Accept"), "application/json"); assertEquals(request.getHeader("Authorization"), "Bearer " + MOCK_BEARER_TOKEN); return request; }

Target:
protected RecordedRequest assertSent(MockWebServer server, String method, String path) throws InterruptedException { RecordedRequest request = server.takeRequest(); assertEquals(request.getMethod(), method); assertEquals(request.getPath(), path); assertEquals(request.getHeader("Authorization"), authHeader); return request; }
Source:
private @Nullable ITmfFilter extractSearchFilter(VirtualTableQueryFilter queryFilter) { if (queryFilter instanceof EventTableQueryFilter) { EventTableQueryFilter eventTableQueryFilter = (EventTableQueryFilter) queryFilter; Map<Long, String> searchMap = eventTableQueryFilter.getSearchFilter(); if (searchMap == null || searchMap.isEmpty()) { return null; } TmfFilterRootNode rootFilter = new TmfFilterRootNode(); for (Entry<Long, String> searchEntry : searchMap.entrySet()) { TmfFilterMatchesNode searchNode = new TmfFilterMatchesNode(null); searchNode.setEventAspect(fAspectMap.get(searchEntry.getKey())); searchNode.setRegex(searchEntry.getValue()); rootFilter.addChild(searchNode); } return rootFilter; } return null; }

Target:
private static @Nullable ITmfFilter extractSearchFilter(VirtualTableQueryFilter queryFilter) { if (queryFilter instanceof EventTableQueryFilter) { EventTableQueryFilter eventTableQueryFilter = (EventTableQueryFilter) queryFilter; Map<Long, String> searchMap = eventTableQueryFilter.getSearchFilter(); if (searchMap == null || searchMap.isEmpty()) { return null; } TmfFilterRootNode rootFilter = new TmfFilterRootNode(); for (Entry<Long, String> searchEntry : searchMap.entrySet()) { TmfFilterMatchesNode searchNode = new TmfFilterMatchesNode(rootFilter); ITmfEventAspect<?> aspect = fAspectMap.get(searchEntry.getKey()); if (aspect == null) { return null; } searchNode.setEventAspect(aspect); searchNode.setRegex(searchEntry.getValue()); } return rootFilter; } return null; }
Source:
protected List<HostConfigEntry> reloadHostConfigEntries(Path path, String host, int port, String username) throws IOException { if (isStrict()) { if (log.isDebugEnabled()) { log.debug("reloadHostConfigEntries({}@{}:{}) check permissions of {}", username, host, port, path); } PosixFilePermission violation = validateStrictConfigFilePermissions(path); if (violation != null) { throw new IOException("String permission violation (" + violation + ") for " + path); } String ownerViolation = validateStrictConfigFileOwner(path); if (ownerViolation != null) { throw new IOException("String owner violation (" + ownerViolation + ") for " + path); } } return super.reloadHostConfigEntries(path, host, port, username); }

Target:
protected List<HostConfigEntry> reloadHostConfigEntries(Path path, String host, int port, String username) throws IOException { if (isStrict()) { if (log.isDebugEnabled()) { log.debug("reloadHostConfigEntries({}@{}:{}) check permissions of {}", username, host, port, path); } Pair<String, Object> violation = validateStrictConfigFilePermissions(path); if (violation != null) { throw new IOException(String.format("%s for %s", violation.getFirst(), path)); } } return super.reloadHostConfigEntries(path, host, port, username); }
Source:
Image getDragSourceImage(DragSourceEvent event) { if (dragSourceImage != null) dragSourceImage.dispose(); dragSourceImage = null; NSPoint point = new NSPoint(); long ptr = OS.malloc(NSPoint.sizeof); OS.memmove(ptr, point, NSPoint.sizeof); NSEvent nsEvent = NSApplication.sharedApplication().currentEvent(); NSTableView widget = (NSTableView)control.view; NSImage nsImage = widget.dragImageForRowsWithIndexes(widget.selectedRowIndexes(), widget.tableColumns(), nsEvent, ptr); if(nsImage==null) return null; OS.memmove(point, ptr, NSPoint.sizeof); OS.free(ptr); Image image = Image.cocoa_new(control.getDisplay(), SWT.BITMAP, nsImage); dragSourceImage = image; nsImage.retain(); event.offsetX = (int)point.x; event.offsetY = (int)point.y; return image; }

Target:
Image getDragSourceImage(DragSourceEvent event) { if (dragSourceImage != null) dragSourceImage.dispose(); dragSourceImage = null; NSPoint point = new NSPoint(); long ptr = OS.malloc(NSPoint.sizeof); OS.memmove(ptr, point, NSPoint.sizeof); NSEvent nsEvent = NSApplication.sharedApplication().currentEvent(); NSTableView widget = (NSTableView)control.view; NSImage nsImage = widget.dragImageForRowsWithIndexes(widget.selectedRowIndexes(), widget.tableColumns(), nsEvent, ptr); OS.memmove(point, ptr, NSPoint.sizeof); OS.free(ptr); if (nsImage == null) return null; Image image = Image.cocoa_new(control.getDisplay(), SWT.BITMAP, nsImage); dragSourceImage = image; nsImage.retain(); event.offsetX = (int)point.x; event.offsetY = (int)point.y; return image; }
Source:
public FilesWatcher(long pollTime) { watchers = new ConcurrentHashMap<>(); executorPollTime = pollTime; init(); }

Target:
public FilesWatcher(long pollTime) { executorPollTime = pollTime; init(); }
Source:
private boolean isNoNewlineAtEndOfFile(FileHeader fh) { if (fh.getHunks() != null && fh.getHunks().size() > 0) { HunkHeader lastHunk = fh.getHunks().get(fh.getHunks().size() - 1); RawText lhrt = new RawText(lastHunk.getBuffer()); return lhrt.getString(lhrt.size() - 1) .equals("\\ No newline at end of file"); } return false; }

Target:
private boolean isNoNewlineAtEndOfFile(FileHeader fh) { List<? extends HunkHeader> hunks = fh.getHunks(); if (hunks == null || hunks.isEmpty()) { return false; } HunkHeader lastHunk = hunks.get(hunks.size() - 1); RawText lhrt = new RawText(lastHunk.getBuffer()); return lhrt.getString(lhrt.size() - 1) .equals("\\ No newline at end of file"); }
Source:
private PrimaryKey dbTablePK(DatabaseMetaData meta, String tableName) throws SQLException { if (meta.storesUpperCaseIdentifiers()) { tableName = tableName.toUpperCase(); } else if (meta.storesLowerCaseIdentifiers()) { tableName = tableName.toLowerCase(); } ResultSet cols = meta.getPrimaryKeys(null, null, tableName); try { PrimaryKey pk = new PrimaryKey(); Map<Short, String> seqToName = new TreeMap<>(); while (cols.next()) { seqToName.put(cols.getShort("KEY_SEQ"), cols.getString("COLUMN_NAME")); if (pk.oldNameInDb == null) { pk.oldNameInDb = cols.getString("PK_NAME"); } } pk.cols = new ArrayList<>(seqToName.size()); for (String name : seqToName.values()) { pk.cols.add(name.toLowerCase(Locale.US)); } return pk; } finally { cols.close(); } }

Target:
private PrimaryKey dbTablePK(DatabaseMetaData meta, String tableName) throws SQLException { if (meta.storesUpperCaseIdentifiers()) { tableName = tableName.toUpperCase(); } else if (meta.storesLowerCaseIdentifiers()) { tableName = tableName.toLowerCase(); } ResultSet cols = meta.getPrimaryKeys(null, null, tableName); try { PrimaryKey pk = new PrimaryKey(); Map<Short, String> seqToName = new TreeMap<>(); while (cols.next()) { seqToName.put(cols.getShort("KEY_SEQ"), cols.getString("COLUMN_NAME")); if (dialect instanceof DialectPostgreSQL && pk.oldNameInDb == null) { pk.oldNameInDb = cols.getString("PK_NAME"); } } pk.cols = new ArrayList<>(seqToName.size()); for (String name : seqToName.values()) { pk.cols.add(name.toLowerCase(Locale.US)); } return pk; } finally { cols.close(); } }
Source:
private void updateMemoryBrowserView(final Object context, final IMemoryBlockRetrieval retrieval, final ILaunch launch) { if (retrieval != null && launch != null && !launch.isTerminated()) { if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) { boolean suspended = false; if(context instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) context; IDMContext dmc = (IDMContext) adaptable.getAdapter(IDMContext.class); if (dmc != null) { IExecutionDMContext edmc = DMContexts.getAncestorOfType(dmc, IExecutionDMContext.class); if (edmc != null) { DsfServicesTracker tracker = new DsfServicesTracker(MemoryBrowserPlugin.getBundleContext(), dmc.getSessionId()); IRunControl rc = (IRunControl) tracker.getService(IRunControl.class); if (rc != null && rc.isSuspended(edmc)) { suspended = true; } tracker.dispose(); } } } boolean launching = false; if (suspended) { try { launching = launch.getLaunchConfiguration().getAttribute(ATTR_LAUNCHING, false); } catch (CoreException e1) { MemoryBrowserPlugin.getDefault().getLog().log(new Status(Status.ERROR, MemoryBrowserPlugin.PLUGIN_ID, "Could not get the launching attribute", e1)); } } if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) { final boolean finalLaunching = launching; ((IMemorySpaceAwareMemoryBlockRetrieval)retrieval).getMemorySpaces(context, new GetMemorySpacesRequest() { public void done() { updateTab(retrieval, context, isSuccess() ? getMemorySpaces() : new String[0]); if (finalLaunching && launch != null) { loadMemoryTabs(launch, context); } } }); } else { updateTab(retrieval, context, new String[0]); if (launching && launch != null) { loadMemoryTabs(launch, context); } } } else { updateTab(retrieval, context, new String[0]); } } else { fUnsupportedLabel.setText(""); handleUnsupportedSelection(); } }

Target:
private void updateMemoryBrowserView(final Object context, final IMemoryBlockRetrieval retrieval, final ILaunch launch) { if(retrieval != null && launch != null && !launch.isTerminated()) { if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) { boolean suspended = false; if(context instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) context; ISuspendResume targetElement = (ISuspendResume) adaptable.getAdapter(ISuspendResume.class); if (targetElement != null && targetElement.isSuspended()) { suspended = true; } } boolean launching = false; if (suspended) { launching = Boolean.valueOf(launch.getAttribute(ATTR_LAUNCHING)); } if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) { final boolean finalLaunching = launching; ((IMemorySpaceAwareMemoryBlockRetrieval)retrieval).getMemorySpaces(context, new GetMemorySpacesRequest() { public void done() { updateTab(retrieval, context, isSuccess() ? getMemorySpaces() : new String[0]); if (finalLaunching && launch != null) { loadMemoryTabs(launch, context); } } }); } else { updateTab(retrieval, context, new String[0]); if (launching && launch != null) { loadMemoryTabs(launch, context); } } } else { updateTab(retrieval, context, new String[0]); } } else { fUnsupportedLabel.setText(""); handleUnsupportedSelection(); } }
Source:
private void validateRoutingTypes(SimpleString addressName, Collection<RoutingType> routingTypes) { final Bindings bindings = this.mappings.get(addressName); if (bindings != null) { for (Binding binding : bindings.getBindings()) { if (binding instanceof QueueBinding) { final QueueBinding queueBinding = (QueueBinding) binding; final RoutingType routingType = queueBinding.getQueue().getRoutingType(); System.out.println("got a queue binding........... " + queueBinding.getQueue().getName() + " rt: " + routingType); if (!routingTypes.contains(routingType) && binding.getAddress().equals(addressName)) { throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeDelete(routingType, addressName.toString()); } } } } }

Target:
private void validateRoutingTypes(SimpleString addressName, Collection<RoutingType> routingTypes) { final Bindings bindings = this.mappings.get(addressName); if (bindings != null) { for (Binding binding : bindings.getBindings()) { if (binding instanceof QueueBinding) { final QueueBinding queueBinding = (QueueBinding) binding; final RoutingType routingType = queueBinding.getQueue().getRoutingType(); if (!routingTypes.contains(routingType) && binding.getAddress().equals(addressName)) { throw ActiveMQMessageBundle.BUNDLE.invalidRoutingTypeDelete(routingType, addressName.toString()); } } } } }
Source:
public static org.kie.dmn.model.api.OutputClause dmnFromWB(final OutputClause wb) { org.kie.dmn.model.api.OutputClause result = new org.kie.dmn.model.v1_2.TOutputClause(); result.setId(wb.getId().getValue()); result.setName(wb.getName()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); UnaryTests outputValues = UnaryTestsPropertyConverter.dmnFromWB(wb.getOutputValues()); if (outputValues != null && !outputValues.getText().isEmpty()) { outputValues.setParent(result); result.setOutputValues(outputValues); } LiteralExpression defaultOutputEntry = LiteralExpressionPropertyConverter.dmnFromWB(wb.getDefaultOutputEntry()); if (defaultOutputEntry != null && !defaultOutputEntry.getText().isEmpty()) { defaultOutputEntry.setParent(result); result.setDefaultOutputEntry(defaultOutputEntry); } QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); return result; }

Target:
public static org.kie.dmn.model.api.OutputClause dmnFromWB(final OutputClause wb) { org.kie.dmn.model.api.OutputClause result = new org.kie.dmn.model.v1_2.TOutputClause(); result.setId(wb.getId().getValue()); result.setName(wb.getName()); result.setDescription(DescriptionPropertyConverter.dmnFromWB(wb.getDescription())); UnaryTests outputValues = UnaryTestsPropertyConverter.dmnFromWB(wb.getOutputValues()); if (outputValues != null && StringUtils.nonEmpty(outputValues.getText())) { outputValues.setParent(result); result.setOutputValues(outputValues); } LiteralExpression defaultOutputEntry = LiteralExpressionPropertyConverter.dmnFromWB(wb.getDefaultOutputEntry()); if (defaultOutputEntry != null && StringUtils.nonEmpty(defaultOutputEntry.getText())) { defaultOutputEntry.setParent(result); result.setDefaultOutputEntry(defaultOutputEntry); } QNamePropertyConverter.setDMNfromWB(wb.getTypeRef(), result::setTypeRef); return result; }
Source:
private ExactPredicate[] getAllPropertyValues( KernelStatement state, SchemaDescriptor schema, NodeItem node ) { int[] propertyIds = schema.getPropertyIds(); ExactPredicate[] values = new ExactPredicate[propertyIds.length]; for ( int i = 0; i < values.length; i++ ) { Object value = nodeGetProperty( state, node, propertyIds[i] ); if ( value == null ) { return null; } values[i] = IndexQuery.exact( propertyIds[i], value ); } return values; }

Target:
private ExactPredicate[] getAllPropertyValues( KernelStatement state, SchemaDescriptor schema, NodeItem node ) { int[] propertyIds = schema.getPropertyIds(); ExactPredicate[] values = new ExactPredicate[propertyIds.length]; int nMatched = 0; Cursor<PropertyItem> nodePropertyCursor = nodeGetProperties( state, node ); while ( nodePropertyCursor.next() ) { PropertyItem property = nodePropertyCursor.get(); int k = ArrayUtils.indexOf( propertyIds, property.propertyKeyId() ); if ( k >= 0 ) { values[k] = IndexQuery.exact( property.propertyKeyId(), property.value() ); nMatched++; } } if ( nMatched < values.length ) { return null; } return values; }
Source:
public void baseEventProcessingTest() throws Exception { EmbeddedAgent agent = new EmbeddedAgent("test-flume"); Properties properties = getProperties(System.getProperty(CONFIG_NAME)); String authPath = properties.getProperty(AUTH_PROPERTIES); if (authPath != null) { URL url = Thread.currentThread().getContextClassLoader().getResource(authPath); properties.setProperty(AUTH_PROPERTIES, url.getPath()); } Map propertyMap = new HashMap<String, String>(); for (final String name : properties.stringPropertyNames()) { propertyMap.put(name, properties.getProperty(name)); } agent.configure(propertyMap); agent.start(); long startTime = System.currentTimeMillis(); for (int i = 0; i < eventNumber; i++) { Event event = new SimpleEvent(); event.setBody((EVENT_STR + i).getBytes()); agent.put(event); } Thread.currentThread().sleep(1000); agent.stop(); HttpResponse response = readFromStream(properties, startTime, System.currentTimeMillis()); JSONArray jsonArray = new JSONArray(EntityUtils.toString(response.getEntity())); for (int i = 0; i < eventNumber; i++) { Assert.assertTrue(jsonArray.getJSONObject(i).getString(RESPONSE_EVENT_BODY).equals(EVENT_STR + i)); } }

Target:
public void baseEventProcessingTest() throws Exception { EmbeddedAgent agent = new EmbeddedAgent("test-flume"); Map propertyMap = new HashMap<String, String>(); for (final String name : flumeProperties.stringPropertyNames()) { propertyMap.put(name, flumeProperties.getProperty(name)); } agent.configure(propertyMap); agent.start(); long startTime = System.currentTimeMillis(); writeEvents(agent, 0, EVENT_NUMBER); Thread.sleep(SLEEP_INTERVAL); agent.stop(); checkDeliveredEvents(flumeProperties, startTime, System.currentTimeMillis()); }
Source:
public void testParquetTupleDomainMap() { HiveColumnHandle colHandle = new HiveColumnHandle("my_map", HiveType.valueOf("map<int,int>"), parseTypeSignature(StandardTypes.MAP), 0, REGULAR, Optional.empty()); MapType mapType = new MapType( INTEGER, INTEGER, MethodHandleUtil.methodHandle(TestParquetPredicateUtils.class, "throwUnsupportedOperation"), MethodHandleUtil.methodHandle(TestParquetPredicateUtils.class, "throwUnsupportedOperation"), MethodHandleUtil.methodHandle(TestParquetPredicateUtils.class, "throwUnsupportedOperation")); TupleDomain<HiveColumnHandle> domain = TupleDomain.withColumnDomains(ImmutableMap.of(colHandle, Domain.notNull(mapType))); MessageType fileSchema = new MessageType("hive_schema", new GroupType(OPTIONAL, "my_map", new GroupType(REPEATED, "map", new PrimitiveType(REQUIRED, INT32, "key"), new PrimitiveType(OPTIONAL, INT32, "value")))); TupleDomain<ColumnDescriptor> tupleDomain = getParquetTupleDomain(fileSchema, fileSchema, domain); assertTrue(tupleDomain.getDomains().get().isEmpty()); }

Target:
public void testParquetTupleDomainMap() { HiveColumnHandle columnHandle = new HiveColumnHandle("my_map", HiveType.valueOf("map<int,int>"), parseTypeSignature(StandardTypes.MAP), 0, REGULAR, Optional.empty()); MapType mapType = new MapType( INTEGER, INTEGER, methodHandle(TestParquetPredicateUtils.class, "throwUnsupportedOperationException"), methodHandle(TestParquetPredicateUtils.class, "throwUnsupportedOperationException"), methodHandle(TestParquetPredicateUtils.class, "throwUnsupportedOperationException")); TupleDomain<HiveColumnHandle> domain = TupleDomain.withColumnDomains(ImmutableMap.of(columnHandle, Domain.notNull(mapType))); MessageType fileSchema = new MessageType("hive_schema", new GroupType(OPTIONAL, "my_map", new GroupType(REPEATED, "map", new PrimitiveType(REQUIRED, INT32, "key"), new PrimitiveType(OPTIONAL, INT32, "value")))); TupleDomain<ColumnDescriptor> tupleDomain = getParquetTupleDomain(fileSchema, fileSchema, domain); assertTrue(tupleDomain.getDomains().get().isEmpty()); }
Source:
public boolean removePassenger(Entity passenger) { Preconditions.checkArgument(passenger != this, "Entity cannot ride itself."); if (passenger == null || !passengers.contains(passenger)) return false; if (EventFactory.callEvent(new EntityDismountEvent(passenger, this)).isCancelled()) { return false; } if (!(passenger instanceof GlowEntity)) { return false; } GlowEntity glowPassenger = (GlowEntity) passenger; passengerChanged = true; glowPassenger.vehicle = null; return passengers.remove(passenger); }

Target:
public boolean removePassenger(Entity passenger) { Preconditions.checkArgument(!this.equals(passenger), "Entity cannot ride itself."); if (passenger == null || !passengers.contains(passenger)) return false; if (EventFactory.callEvent(new EntityDismountEvent(passenger, this)).isCancelled()) { return false; } if (!(passenger instanceof GlowEntity)) { return false; } GlowEntity glowPassenger = (GlowEntity) passenger; passengerChanged = true; glowPassenger.vehicle = null; glowPassenger.teleport(getDismountLocation()); return passengers.remove(passenger); }
Source:
public Observable<PersistentResource> export(AsyncQuery query) { Observable<PersistentResource> results = Observable.empty(); UUID requestId = UUID.fromString(query.getRequestId()); try (DataStoreTransaction tx = elide.getDataStore().beginTransaction()) { elide.getTransactionRegistry().addRunningTransaction(requestId, tx); EntityProjection projection = null; RequestScope requestScope = null; if (query.getQueryType().equals(QueryType.GRAPHQL_V1_0)) { projection = graphQLParser.parse(query); requestScope = new GraphQLRequestScope("", tx, user, apiVersion, elide.getElideSettings(), null, requestId); } else { throw new InvalidValueException("QueryType not supported"); } if (projection != null) { results = PersistentResource.loadRecords(projection, Collections.emptyList(), requestScope); } tx.preCommit(); requestScope.runQueuedPreSecurityTriggers(); requestScope.getPermissionExecutor().executeCommitChecks(); tx.flush(requestScope); requestScope.runQueuedPreCommitTriggers(); elide.getAuditLogger().commit(); tx.commit(requestScope); requestScope.runQueuedPostCommitTriggers(); } catch (IOException e) { throw new IllegalStateException(e); } finally { elide.getTransactionRegistry().removeRunningTransaction(requestId); elide.getAuditLogger().clear(); } return results; }

Target:
public Observable<PersistentResource> export(AsyncQuery query) { Observable<PersistentResource> results = Observable.empty(); UUID requestId = UUID.fromString(query.getRequestId()); try (DataStoreTransaction tx = elide.getDataStore().beginTransaction()) { elide.getTransactionRegistry().addRunningTransaction(requestId, tx); EntityProjection projection = null; RequestScope requestScope = null; if (query.getQueryType().equals(QueryType.GRAPHQL_V1_0)) { projection = graphQLParser.parse(query); requestScope = new GraphQLRequestScope("", tx, user, apiVersion, elide.getElideSettings(), null, requestId); } else { throw new InvalidValueException("QueryType not supported"); } if (projection != null) { results = PersistentResource.loadRecords(projection, Collections.emptyList(), requestScope); } tx.preCommit(); requestScope.runQueuedPreSecurityTriggers(); requestScope.getPermissionExecutor().executeCommitChecks(); tx.flush(requestScope); requestScope.runQueuedPreCommitTriggers(); elide.getAuditLogger().commit(); tx.commit(requestScope); requestScope.runQueuedPostCommitTriggers(); } catch (IOException e) { log.error("IOException during TableExport", e); throw new TransactionException(e); } finally { elide.getTransactionRegistry().removeRunningTransaction(requestId); elide.getAuditLogger().clear(); } return results; }
Source:
public abstract void setFlags(List<? extends Message> messages, Set<Flag> flags, boolean value) throws MessagingException; public abstract void setFlags(Set<Flag> flags, boolean value) throws MessagingException; public abstract String getUidFromMessageId(Message message) throws MessagingException; public void expunge(List<Long> knownDeletedUids) throws MessagingException

Target:
public abstract void setFlags(List<? extends Message> messages, Set<Flag> flags, boolean value) throws MessagingException; public abstract void setFlags(Set<Flag> flags, boolean value) throws MessagingException; public abstract String getUidFromMessageId(Message message) throws MessagingException; public void expunge() throws MessagingException
Source:
public boolean canHandleArtifact(T artifact) { try { @SuppressWarnings("rawtypes") Class<?> genericType = ((Class) ((ParameterizedType) this.getClass().getGenericSuperclass()) .getActualTypeArguments()[0]); return genericType.isAssignableFrom(artifact.getClass()); } catch (NoClassDefFoundError e) { return false; } }

Target:
public boolean canHandleArtifact(T artifact) { try { Class<?> genericType = ((Class<?>) ((ParameterizedType) this.getClass().getGenericSuperclass()) .getActualTypeArguments()[0]); return genericType.isAssignableFrom(artifact.getClass()); } catch (NoClassDefFoundError e) { return false; } }
Source:
private void drain() { if (wip.getAndIncrement() == 0) { final Subscriber<? super T> c = child; final Queue<Object> q = queue; do { if (checkTerminated(done, q.isEmpty())) { return; } wip.lazySet(1); long r = get(); long e = 0; while (r != 0) { boolean d = done; Object v = q.poll(); if (checkTerminated(d, v == null)) { return; } else if (v == null) { break; } try { if (v == NULL_SENTINEL) { c.onNext(null); } else { @SuppressWarnings("unchecked") T t = (T)v; c.onNext(t); } } catch (Throwable ex) { Exceptions.throwIfFatal(ex); Throwable ex1 = OnErrorThrowable.addValueAsLastCause(ex, v != NULL_SENTINEL ? v : null); c.onError(ex1); return; } r--; e++; } if (e != 0) { addAndGet(-e); } } while (wip.decrementAndGet() != 0); } }

Target:
private void drain() { if (wip.getAndIncrement() == 0) { final Subscriber<? super T> c = child; final Queue<Object> q = queue; do { if (checkTerminated(done, q.isEmpty())) { return; } wip.lazySet(1); long r = get(); long e = 0; while (r != 0) { boolean d = done; Object v = q.poll(); if (checkTerminated(d, v == null)) { return; } else if (v == null) { break; } try { if (v == NULL_SENTINEL) { c.onNext(null); } else { @SuppressWarnings("unchecked") T t = (T)v; c.onNext(t); } } catch (Throwable ex) { Exceptions.throwIfFatal(ex); Throwable ex1 = OnErrorThrowable.addValueAsLastCause(ex, v != NULL_SENTINEL ? v : null); c.onError(ex1); return; } r--; e++; } if (e != 0 && get() != Long.MAX_VALUE) { addAndGet(-e); } } while (wip.decrementAndGet() != 0); } }
Source:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true); adapter = new RandomAdapter(getActivity(), new ArrayList<PageTitle>()); randomList.setAdapter(adapter); randomList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { PageTitle title = adapter.getItem(position); HistoryEntry newEntry = new HistoryEntry(title, HistoryEntry.SOURCE_RANDOM); ((PageActivity) getActivity()).displayNewPage(title, newEntry); } }); fetchRandomArticles(); }

Target:
public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); setHasOptionsMenu(true); adapter = new RandomAdapter(getActivity(), new ArrayList<RandomPage>()); randomList.setAdapter(adapter); randomList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { PageTitle title = adapter.getItem(position).getPageTitle(); HistoryEntry newEntry = new HistoryEntry(title, HistoryEntry.SOURCE_RANDOM); ((PageActivity) getActivity()).displayNewPage(title, newEntry); } }); fetchRandomArticles(); }
Source:
public void testCreate() throws StripeException { List<String> attributes = new LinkedList<String>(); attributes.add("attr1"); attributes.add("attr2"); Map<String, Object> packageDimensions = new HashMap<String, Object>(); packageDimensions.put("height", 2.234); packageDimensions.put("length", 5.10); packageDimensions.put("width", 6.50); packageDimensions.put("weight", 10); Map<String, Object> params = new HashMap<String, Object>(); params.put("active", true); params.put("name", "Test Name"); params.put("description", "This is a description"); params.put("caption", "This is a caption"); params.put("attributes", attributes); params.put("url", "<LINK_0>"); params.put("shippable", true); params.put("package_dimensions", packageDimensions); params.put("type", "good"); final Product product = Product.create(params); assertNotNull(product); verifyRequest( APIResource.RequestMethod.POST, "/v1/products", params ); }

Target:
public void testCreate() throws StripeException { final List<String> attributes = new LinkedList<String>(); attributes.add("attr1"); attributes.add("attr2"); final Map<String, Object> packageDimensions = new HashMap<String, Object>(); packageDimensions.put("height", 2.234); packageDimensions.put("length", 5.10); packageDimensions.put("width", 6.50); packageDimensions.put("weight", 10); final Map<String, Object> params = new HashMap<String, Object>(); params.put("active", true); params.put("name", "Test Name"); params.put("description", "This is a description"); params.put("caption", "This is a caption"); params.put("attributes", attributes); params.put("url", "<LINK_0>"); params.put("shippable", true); params.put("package_dimensions", packageDimensions); params.put("type", "good"); final Product product = Product.create(params); assertNotNull(product); verifyRequest( APIResource.RequestMethod.POST, "/v1/products", params ); }
Source:
public SSLClient(String host, int port) throws IOException { super(host, port); try { long start = System.currentTimeMillis(); ssle = OPEN_SSL_CTX.createSSLEngine(host, port); ssle.setUseClientMode(true); System.out.println("HS:"+ (System.currentTimeMillis()-start)); doHandShake(); } catch (Exception e) { throw new IOException(SSL_ERROR, e); } super.setReader(this); encryptedReadBuffer = ByteBuffer.allocate(ssle.getSession().getPacketBufferSize()); }

Target:
public SSLClient(String host, int port) throws IOException { this(host, port, OPEN_SSL_CTX.createSSLEngine(host, port)); }
Source:
void onCreate() { if (prefs.getBoolean("first-run-shortcuts", true) && ShortcutUtil.areShortcutsEnabled(mainActivity)) { ShortcutUtil.buildShortcuts(mainActivity); prefs.edit().putBoolean("first-run-shortcuts", false).apply(); } }

Target:
void onCreate() { if (prefs.getBoolean("first-run-shortcuts", true) && ShortcutUtil.areShortcutsEnabled(mainActivity)) { ShortcutUtil.rebuildShortcuts(mainActivity); prefs.edit().putBoolean("first-run-shortcuts", false).apply(); } }
Source:
synchronized void setForumSelection(final String forumSelection) { this.forumSelection = Optional.ofNullable(forumSelection) .filter(Predicate.not(String::isBlank)) .orElse(getForumSelectionOptions().iterator().next()); Postconditions.assertState( this.forumSelection != null && !this.forumSelection.isBlank(), "Forum selection is driven by a drop-down to ensure user can never set it to null, " + "if setting to null from a game properties, we default to the first available " + "selection entry, forum selection should never be null or empty."); forumUsername = this.forumSelection.equals(NodeBbForumPoster.TRIPLEA_FORUM_DISPLAY_NAME) ? ClientSetting.tripleaForumUsername.getValue().map(String::valueOf).orElse("") : ClientSetting.aaForumUsername.getValue().map(String::valueOf).orElse(""); forumPasswordIsSet = false; readyCallback.run(); }

Target:
synchronized void setForumSelection(final String forumSelection) { this.forumSelection = Optional.ofNullable(forumSelection) .filter(Predicate.not(String::isBlank)) .orElse(getForumSelectionOptions().iterator().next()); Postconditions.assertState( this.forumSelection != null && !this.forumSelection.isBlank(), "Forum selection is driven by a drop-down to ensure user can never set it to null, " + "if setting to null from a game properties, we default to the first available " + "selection entry, forum selection should never be null or empty."); forumUsername = this.forumSelection.equals(NodeBbForumPoster.TRIPLEA_FORUM_DISPLAY_NAME) ? ClientSetting.tripleaForumUsername.getValue().map(String::valueOf).orElse("") : ClientSetting.aaForumUsername.getValue().map(String::valueOf).orElse(""); forumTokenExists = getTokenSetting().getValue().map(token -> token.length > 0).orElse(false); readyCallback.run(); }
Source:
private void tryLock(String path) { if (_zkBaseDataAccessor.exists(path + "/" + WRITE_LOCK_KEY, AccessOption.EPHEMERAL)) { throw new HelixException( String.format("There is already a write in progress for path: %s", path)); } }

Target:
private boolean tryLock(String path) { return !_zkBaseDataAccessor.exists(path + "/" + WRITE_LOCK_KEY, AccessOption.EPHEMERAL) && _zkBaseDataAccessor.set(path + "/" + WRITE_LOCK_KEY, new byte[0], AccessOption.EPHEMERAL); }
Source:
public void run() { try { if(prjSave == null) { String remoteServices = fConn.getSshSettings().getRemoteServices(); IRemoteServices services = RemoteServices.getRemoteServices(remoteServices); if (services != null) { IRemoteConnectionManager connMgr = services.getConnectionManager(); if (connMgr != null) { fRemoteConnection = connMgr.getConnection(fConn.getSshSettings().getConnectionName()); } } } else { fRemoteConnection = Util.getRemoteConnection(prjSave); } if (fRemoteConnection != null && !fRemoteConnection.isOpen()) { try { fRemoteConnection.open(null); } catch (RemoteConnectionException e) { Activator.log(e); } } if(fRemoteConnection != null || !fRemoteConnection.isOpen()) { TerminalPlugin plugin = TerminalPlugin.getDefault(); IPreferenceStore preferenceStore = plugin.getPreferenceStore(); final boolean[] done = new boolean[]{false}; fConn.setupHistoryMonitoring(this, preferenceStore,done); try { readDataForever(fConn.getInputStream()); } catch (InterruptedIOException e) { } finally { done[0] = true; } } } catch (IOException e) { fControl.setState(TerminalState.CLOSED); } finally { try { disconnect(); } finally { fControl.setState(TerminalState.CLOSED); } } }

Target:
public void run() { try { if(prjSave == null) { String remoteServices = fConn.getSshSettings().getRemoteServices(); IRemoteServices services = RemoteServices.getRemoteServices(remoteServices); if (services != null) { IRemoteConnectionManager connMgr = services.getConnectionManager(); if (connMgr != null) { fRemoteConnection = connMgr.getConnection(fConn.getSshSettings().getConnectionName()); } } } else { fRemoteConnection = Util.getRemoteConnection(prjSave); } if (fRemoteConnection != null && !fRemoteConnection.isOpen()) { try { fRemoteConnection.open(null); } catch (RemoteConnectionException e) { Activator.log(e); } } if(fRemoteConnection != null && fRemoteConnection.isOpen()) { TerminalPlugin plugin = TerminalPlugin.getDefault(); IPreferenceStore preferenceStore = plugin.getPreferenceStore(); setupHistoryMonitoring(fConn, preferenceStore); try { readDataForever(fConn.getInputStream()); } catch (InterruptedIOException e) { } } } catch (IOException e) { fControl.setState(TerminalState.CLOSED); } finally { try { disconnect(); } finally { fControl.setState(TerminalState.CLOSED); } } }
Source:
public final void initialize(final URL location, final ResourceBundle resources) { listen(Message.OPENED, (controller, args) -> { assert controller instanceof MenuController; final int expectedLength = 3; assert args.length == expectedLength; assert args[2] instanceof File; try { loadTree((File) args[2]); } catch (FileNotFoundException e) { Logging.exception(e); } }); listen(Message.LOADED, (controller, args) -> { if (controller instanceof GraphController) { assert args[0] instanceof Graph; assert (args[1] instanceof Map<?, ?>); sequences = (Map<String, Sequence>) args[1]; repaint(); } }); listen(Message.FILTERED, (controller, args) -> { assert args.length == 1; if (!(args[0] instanceof Set<?>)) { throw new IllegalArgumentException( "Argument not of type Set<Sequence>"); } if (!(controller instanceof TreeController)) { setVisible((Set<Sequence>) args[0]); } }); view.setController(this); }

Target:
public final void initialize(final URL location, final ResourceBundle resources) { listen(Message.OPENED, (controller, args) -> { assert controller instanceof MenuController; final int expectedLength = 3; assert args.length == expectedLength; assert args[2] instanceof File; try { loadTree((File) args[2]); } catch (FileNotFoundException e) { Logging.exception(e); } }); listen(Message.LOADED, (controller, args) -> { if (controller instanceof GraphController) { assert args[0] instanceof Graph; assert (args[1] instanceof Map<?, ?>); sequences = (Map<String, Sequence>) args[1]; repaint(); } }); listen(Message.FILTERED, (controller, args) -> { assert args.length == 1; assert (args[0] instanceof Set<?>); if (!(controller instanceof TreeController)) { setVisible((Set<Sequence>) args[0]); } }); view.setController(this); }
Source:
public static Injector getInjector() { if ( injector == null ) { injector = Guice.createInjector( new GuiceModule( emf ) ); } return injector; }

Target:
public static Injector getInjector() { if ( injector == null ) { injector = Guice.createInjector( new GuiceModule() ); } return injector; }
Source:
public void testsHeaderAvailable() throws IOException { MatcherAssert.assertThat( new RqFake( Arrays.asList( "GET /f?a=3&b-6", "Host: example.com", "Accept: text/xml", "Accept: text/html" ), "" ), new HmRqHeader(Matchers.hasEntry("accept", "text/xml")) ); }

Target:
public void testsHeaderAvailable() throws Exception { MatcherAssert.assertThat( new RqFake( Arrays.asList( "GET /f?a=3&b-6", "Host: example.com", "Accept: text/xml", "Accept: text/html" ), "" ), new HmRqHeader(Matchers.hasEntry("accept", "text/xml")) ); }
Source:
private String getUserAgentFixedPart() { String osName = System.getProperty("os.name"); if (osName == null) { osName = "Unknown"; } osName = osName.replaceAll("\\s", ""); String geteUserAgentFixedPart = UserAgentContainer.AZSDK_USERAGENT_PREFIX + "cosmos" + "/" + HttpConstants.Versions.SDK_VERSION + SPACE + osName + "/" + System.getProperty("os.version") + SPACE + "JRE/" + System.getProperty("java.version"); return geteUserAgentFixedPart; }

Target:
private String getUserAgentFixedPart() { String osName = System.getProperty("os.name"); if (osName == null) { osName = "Unknown"; } osName = osName.replaceAll("\\s", ""); String geteUserAgentFixedPart = "azsdk-java-" + "cosmos" + "/" + HttpConstants.Versions.SDK_VERSION + SPACE + osName + "/" + System.getProperty("os.version") + SPACE + "JRE/" + System.getProperty("java.version"); return geteUserAgentFixedPart; }
Source:
public void testInitialValuesUpdateTestCaseStartedEvent() throws Exception { AnnotationManager annotationManager = setAnnotationManager("simpleMethod"); TestCaseStartedEvent event = new TestCaseStartedEvent("some.uid", "some.name"); annotationManager.update(event); assertThat(event.getTitle(), equalTo("some.title")); Description description = annotationManager.getDescription(); assertThat(description.getValue(), is("some.description")); assertThat(description.getType(), is(DescriptionType.TEXT)); assertTrue(event.getLabels().contains(createStoryLabel("some.story"))); assertTrue(event.getLabels().contains(createFeatureLabel("some.feature"))); assertTrue(event.getLabels().contains(createSeverityLabel(SeverityLevel.BLOCKER))); assertTrue(event.getLabels().contains(createIssueLabel("some.simple.issue"))); assertTrue(event.getLabels().contains(createIssueLabel("some.nested.issue.1"))); assertTrue(event.getLabels().contains(createIssueLabel("some.nested.issue.2"))); }

Target:
public void testInitialValuesUpdateTestCaseStartedEvent() throws Exception { AnnotationManager annotationManager = setAnnotationManager("simpleMethod"); TestCaseStartedEvent event = new TestCaseStartedEvent("some.uid", "some.name"); annotationManager.update(event); assertThat(event.getTitle(), equalTo("some.title")); Description description = annotationManager.getDescription(); assertThat(description.getValue(), is("some.description")); assertThat(description.getType(), is(DescriptionType.TEXT)); assertThat(event.getLabels(), hasItems( createStoryLabel("some.story"), createFeatureLabel("some.feature"), createSeverityLabel(SeverityLevel.BLOCKER), createIssueLabel("some.simple.issue"), createIssueLabel("some.nested.issue.1"), createIssueLabel("some.nested.issue.2") )); }
Source:
public void testJdbcComputePushdownAll() { String table = "test_table"; String schema = "test_schema"; String predicate = "(c1 + c2) - c2"; TypeProvider typeProvider = TypeProvider.copyOf(ImmutableMap.of("c1", BIGINT, "c2", BIGINT)); RowExpression rowExpression = sqlToRowExpressionTranslator.translateAndOptimize(expression(predicate), typeProvider); Set<ColumnHandle> columns = Arrays.asList("c1", "c2").stream().map(TestJdbcComputePushdown::intJdbcColumnHandle).collect(Collectors.toSet()); PlanNode original = filter(jdbcTableScan(schema, table, "c1", "c2"), rowExpression); JdbcTableHandle jdbcTableHandle = new JdbcTableHandle(CONNECTOR_ID, new SchemaTableName(schema, table), CATALOG_NAME, schema, table); JdbcTableLayoutHandle jdbcTableLayoutHandle = new JdbcTableLayoutHandle(jdbcTableHandle, TupleDomain.none(), Optional.of(new JdbcSql("'c1' + 'c2' - 'c2'"))); ConnectorSession session = new TestingConnectorSession(ImmutableList.of()); PlanNode actual = this.jdbcComputePushdown.optimize(original, session, null, ID_ALLOCATOR); assertPlanMatch(actual, PlanMatchPattern.filter( predicate, JdbcTableScanMatcher.jdbcTableScanPattern(jdbcTableLayoutHandle, columns))); }

Target:
public void testJdbcComputePushdownAll() { String table = "test_table"; String schema = "test_schema"; String expression = "(c1 + c2) - c2"; TypeProvider typeProvider = TypeProvider.copyOf(ImmutableMap.of("c1", BIGINT, "c2", BIGINT)); RowExpression rowExpression = sqlToRowExpressionTranslator.translateAndOptimize(expression(expression), typeProvider); Set<ColumnHandle> columns = Stream.of("c1", "c2").map(TestJdbcComputePushdown::integerJdbcColumnHandle).collect(Collectors.toSet()); PlanNode original = filter(jdbcTableScan(schema, table, BIGINT, "c1", "c2"), rowExpression); JdbcTableHandle jdbcTableHandle = new JdbcTableHandle(CONNECTOR_ID, new SchemaTableName(schema, table), CATALOG_NAME, schema, table); JdbcTableLayoutHandle jdbcTableLayoutHandle = new JdbcTableLayoutHandle(jdbcTableHandle, TupleDomain.none(), Optional.of(new JdbcExpression("(('c1' + 'c2') - 'c2')"))); ConnectorSession session = new TestingConnectorSession(ImmutableList.of()); PlanNode actual = this.jdbcComputePushdown.optimize(original, session, null, ID_ALLOCATOR); assertPlanMatch( actual, PlanMatchPattern.filter(expression, JdbcTableScanMatcher.jdbcTableScanPattern(jdbcTableLayoutHandle, columns))); }
Source:
public void setUp() throws Exception { Script script = BrickTestUtils.createProjectAndGetStartScript("WhenBrickTest"); script.addBrick(new PlaceAtBrick()); whenBrickMap.put(R.string.brick_when_started,WhenStartedBrick.class); whenBrickMap.put(R.string.brick_when_becomes_true,WhenConditionBrick.class); whenBrickMap.put(R.string.brick_when_cloned,WhenClonedBrick.class); whenBrickMap.put(R.string.brick_when_background,WhenBackgroundChangesBrick.class); whenBrickMap.put(R.string.brick_when_touched,WhenTouchDownBrick.class); whenBrickMap.put(R.string.brick_broadcast_receive,BroadcastReceiverBrick.class); whenBrickMap.put(R.string.brick_collision_receive,CollisionReceiverBrick.class); whenBrickList.add(R.string.brick_when_started); whenBrickList.add(R.string.brick_when_becomes_true); whenBrickList.add(R.string.brick_when_cloned); whenBrickList.add(R.string.brick_when_background); whenBrickList.add(R.string.brick_when_touched); whenBrickList.add(R.string.brick_broadcast_receive); whenBrickList.add(R.string.brick_collision_receive); baseActivityTestRule.launchActivity(null); }

Target:
public void setUp() throws Exception { Script script = BrickTestUtils.createProjectAndGetStartScript("WhenBrickTest"); if (whenBrickClass.equals(CollisionReceiverBrick.class)) { script.addBrick(new CollisionReceiverBrick("TEST")); } else if (whenBrickClass.equals(BroadcastReceiverBrick.class)) { script.addBrick(new BroadcastReceiverBrick("TEST")); } else { script.addBrick((Brick) whenBrickClass.newInstance()); } script.addBrick(new PlaceAtBrick()); baseActivityTestRule.launchActivity(null); }
Source:
public void testWithConnLevelUCFNoTableLevelUCF() throws Exception { long tableUpdateCacheFrequency = -1; long connUpdateCacheFrequency = 1000; String fullTableName = DEFAULT_SCHEMA_NAME + QueryConstants.NAME_SEPARATOR + generateUniqueName(); setUpTableAndConnections(fullTableName, tableUpdateCacheFrequency, connUpdateCacheFrequency); int numSelectExecutions = 2; int numExpectedGetTableCalls = 1; verifyExpectedGetTableCalls(fullTableName, numSelectExecutions, numExpectedGetTableCalls); Thread.sleep(connUpdateCacheFrequency); verifyExpectedGetTableCalls(fullTableName, numSelectExecutions, numExpectedGetTableCalls); }

Target:
public void testWithConnLevelUCFNoTableLevelUCF() throws Exception { final long connUpdateCacheFrequency = 1000; String fullTableName = DEFAULT_SCHEMA_NAME + QueryConstants.NAME_SEPARATOR + generateUniqueName(); setUpTableAndConnections(fullTableName, null, String.valueOf(connUpdateCacheFrequency)); int numExecutions = 2; int numExpectedGetTableCalls = 1; verifyExpectedGetTableCalls(fullTableName, numExecutions, numExpectedGetTableCalls); Thread.sleep(connUpdateCacheFrequency); verifyExpectedGetTableCalls(fullTableName, numExecutions, numExpectedGetTableCalls); }
Source:
public Set<NamespaceAndUseCase> getAllNamespaceAndUseCaseTuples() { return execute(dao -> dao.getAllNamespaceAndUseCaseTuples()); }

Target:
public Set<NamespaceAndUseCase> getAllNamespaceAndUseCaseTuples() { return execute(Queries::getAllNamespaceAndUseCaseTuples); }