auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testConnectTimeout() throws Exception { PowerMockito.doThrow(new XBeeException(XBeeException.CONNECTION_TIMEOUT)).when(xbeeDevice, "connect"); try { xbeeDevice.connect(); fail("Device shouldn't have connected"); } catch (XBeeException e) { } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } assertEquals(xbeeDevice.getOperatingMode(), XBeeMode.UNKNOWN); }

Target:
public void testConnectTimeout() throws Exception { PowerMockito.doThrow(new XBeeException(XBeeException.CONNECTION_TIMEOUT)).when(xbeeDevice, "open"); try { xbeeDevice.open(); fail("Device shouldn't have connected"); } catch (XBeeException e) { } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } assertFalse(xbeeDevice.isOpen()); assertFalse(dataReader.isRunning()); assertEquals(xbeeDevice.getOperatingMode(), OperatingMode.UNKNOWN); }
Source:
private static byte[] createRequestBody(String query, DruidResultFormat resultFormat, boolean queryHeader) { return format("{\"query\":\"%s\",\"resultFormat" + "\":\"%s\",\"header\": %b }\n", query, resultFormat.getResultFormat(), queryHeader).getBytes(); }

Target:
private static byte[] createRequestBody(String query, DruidResultFormat resultFormat, boolean queryHeader) { return format("{\"query\":\"%s\",\"resultFormat\":\"%s\",\"header\": %b }\n", query, resultFormat.getResultFormat(), queryHeader).getBytes(); }
Source:
public void bindChildView(View view, Context context, Cursor cursor, boolean isLastChild) { final EpisodeViewHolder viewHolder = (EpisodeViewHolder)view.getTag(); viewHolder.episodeId = cursor.getInt(EpisodesListQuery.EPISODEID); viewHolder.episodenumberView.setText( String.format(context.getString(R.string.episode_number), cursor.getInt(EpisodesListQuery.EPISODE))); int runtime = cursor.getInt(EpisodesListQuery.RUNTIME) / 60; String duration = runtime > 0 ? String.format(context.getString(R.string.minutes_abbrev), String.valueOf(runtime)) + " | " + cursor.getString(EpisodesListQuery.FIRSTAIRED) : cursor.getString(EpisodesListQuery.FIRSTAIRED); viewHolder.titleView.setText(cursor.getString(EpisodesListQuery.TITLE)); viewHolder.detailsView.setText(duration); if (cursor.getInt(EpisodesListQuery.PLAYCOUNT) > 0) { viewHolder.episodenumberView.setTextColor(themeAccentColor); viewHolder.titleView.setTextColor(themeAccentColor); viewHolder.contextMenuView.setColorFilter(themeAccentColor); } else { viewHolder.episodenumberView.setTextColor(defaultTextColor); viewHolder.titleView.setTextColor(defaultTextColor); viewHolder.contextMenuView.setColorFilter(themeAccentColor); viewHolder.contextMenuView.clearColorFilter(); } ImageView contextMenu = (ImageView)view.findViewById(R.id.list_context_menu); contextMenu.setTag(viewHolder); contextMenu.setOnClickListener(contextlistItemMenuClickListener); }

Target:
public void bindChildView(View view, Context context, Cursor cursor, boolean isLastChild) { final EpisodeViewHolder viewHolder = (EpisodeViewHolder)view.getTag(); viewHolder.episodeId = cursor.getInt(EpisodesListQuery.EPISODEID); viewHolder.episodenumberView.setText( String.format(context.getString(R.string.episode_number), cursor.getInt(EpisodesListQuery.EPISODE))); int runtime = cursor.getInt(EpisodesListQuery.RUNTIME) / 60; String duration = runtime > 0 ? String.format(context.getString(R.string.minutes_abbrev), String.valueOf(runtime)) + " | " + cursor.getString(EpisodesListQuery.FIRSTAIRED) : cursor.getString(EpisodesListQuery.FIRSTAIRED); viewHolder.titleView.setText(cursor.getString(EpisodesListQuery.TITLE)); viewHolder.detailsView.setText(duration); if (cursor.getInt(EpisodesListQuery.PLAYCOUNT) > 0) { viewHolder.checkmarkView.setVisibility(View.VISIBLE); viewHolder.checkmarkView.setColorFilter(themeAccentColor); } else { viewHolder.checkmarkView.setVisibility(View.INVISIBLE); } ImageView contextMenu = (ImageView)view.findViewById(R.id.list_context_menu); contextMenu.setTag(viewHolder); contextMenu.setOnClickListener(contextlistItemMenuClickListener); }
Source:
public @NonNull String eventKmemPageAlloc() { return "kmem:page_alloc"; }

Target:
public String eventKmemPageAlloc() { return "kmem:page_alloc"; }
Source:
public void run( Parameters params, TopNResultBuilder resultBuilder, DimValSelector dimValSelector ) { boolean hasDimValSelector = (dimValSelector != null); int cardinality = params.getCardinality(); if (cardinality < 0) { cardinality = Integer.MAX_VALUE; } int numProcessed = 0; while (numProcessed < cardinality) { final int numToProcess; int maxNumToProcess = Math.min(params.getNumValuesPerPass(), cardinality - numProcessed); DimValSelector theDimValSelector; if (!hasDimValSelector) { numToProcess = maxNumToProcess; theDimValSelector = makeDimValSelector(params, numProcessed, numToProcess); } else { numToProcess = computeNewLength(dimValSelector, numProcessed, maxNumToProcess); theDimValSelector = updateDimValSelector(dimValSelector, numProcessed, numToProcess); } DimValAggregateStore aggregatesStore = makeDimValAggregateStore(params); scanAndAggregate(params, theDimValSelector, aggregatesStore, numProcessed); updateResults(params, theDimValSelector, aggregatesStore, resultBuilder); closeAggregators(aggregatesStore); numProcessed += numToProcess; params.getCursor().reset(); } }

Target:
public void run( Parameters params, TopNResultBuilder resultBuilder, DimValSelector dimValSelector ) { if (params.getCardinality() != TopNColumnSelectorStrategy.CARDINALITY_UNKNOWN) { runWithCardinalityKnown(params, resultBuilder, dimValSelector); } else { runWithCardinalityUnknown(params, resultBuilder); } }
Source:
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { configuration.setAttribute(ILaunchConstants.ATTR_ADDITIONAL_DIRS, (String) null); configuration.setAttribute(ILaunchConstants.ATTR_CONNECTION_URI, ""); Preferences prefs = InstanceScope.INSTANCE .getNode(org.eclipse.linuxtools.docker.ui.Activator.PLUGIN_ID); String image = prefs.get(PreferenceConstants.DEFAULT_IMAGE, ""); configuration.setAttribute(ILaunchConstants.ATTR_IMAGE, image); Preferences prefs2 = InstanceScope.INSTANCE .getNode(DockerLaunchUIPlugin.PLUGIN_ID); Boolean keepContainer = prefs2.getBoolean( PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false); configuration.setAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, keepContainer); configuration.setAttribute(ILaunchConstants.ATTR_STDIN_SUPPORT, false); }

Target:
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { configuration.setAttribute(ILaunchConstants.ATTR_ADDITIONAL_DIRS, (String) null); configuration.setAttribute(ILaunchConstants.ATTR_CONNECTION_URI, ""); Preferences prefs = InstanceScope.INSTANCE .getNode(DockerLaunchUIPlugin.PLUGIN_ID); String image = prefs.get(PreferenceConstants.DEFAULT_IMAGE, ""); configuration.setAttribute(ILaunchConstants.ATTR_IMAGE, image); Boolean keepContainer = prefs.getBoolean( PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false); configuration.setAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, keepContainer); configuration.setAttribute(ILaunchConstants.ATTR_STDIN_SUPPORT, false); }
Source:
private void initLMPreparationHandler() { if (lmPreparationHandler.hasLMProfiles()) return; for (LMProfileConfig lmConfig : lmPreparationHandler.getLMProfileConfigs()) { ProfileConfig profile = profilesByName.get(lmConfig.getProfile()); Weighting weighting = createWeighting(profile, new PMap().put("__disable_turn_costs", true)); lmPreparationHandler.addLMProfile(new LMProfile(profile.getName(), weighting)); } }

Target:
private void initLMPreparationHandler() { if (lmPreparationHandler.hasLMProfiles()) return; for (LMProfileConfig lmConfig : lmPreparationHandler.getLMProfileConfigs()) { ProfileConfig profile = profilesByName.get(lmConfig.getProfile()); Weighting weighting = createWeighting(profile, new PMap()); lmPreparationHandler.addLMProfile(new LMProfile(profile.getName(), weighting)); } }
Source:
public void testFinalizerInvoked() throws InterruptedException { BasicTask<?> t = new BasicTask<Void>(new Runnable() { public void run() { }}); final int[] x = new int[1]; t.setFinalizer(new BasicTask.TaskFinalizer() { public void onTaskFinalization(Task<?> t) { synchronized (x) { x[0]++; x.notifyAll(); } } }); t = null; System.gc(); System.gc(); synchronized (x) { if (x[0]==1) return; x.wait(5*1000); if (x[0]==1) return; } Assert.fail("finalizer did not run in time"); }

Target:
public void testFinalizerInvoked() throws InterruptedException { BasicTask<?> t = new BasicTask<Void>(new Runnable() { public void run() { }}); final Semaphore x = new Semaphore(0); t.setFinalizer(new BasicTask.TaskFinalizer() { public void onTaskFinalization(Task<?> t) { synchronized (x) { x.release(); } } }); t = null; Stopwatch watch = new Stopwatch().start(); for (int i=0; i<30; i++) { System.gc(); System.gc(); if (x.tryAcquire(1, TimeUnit.SECONDS)) { log.info("finalizer ran after "+Time.makeTimeStringRounded(watch)); return; } } Assert.fail("finalizer did not run in time"); }
Source:
public boolean validateCert(X509Certificate certToCheck) { String leafIssuerString = certToCheck.getIssuerX500Principal().getName(); LOG.debug("Issue Name for validated Cert {}", leafIssuerString); List<X509Certificate> allCerts = getAllCertByIssuer(certificateManager.getTrustStore(), leafIssuerString); if (isPartChainOfTrust(certToCheck)) { LOG.debug("Cert serial number to verify against our trustStore {}", certToCheck.getSerialNumber().toString(16)); String authorityKeyIdentifier = getAuthorityKeyIdentify(certToCheck.getExtensionValue(AUTHORITY_KEY_ID)); for (X509Certificate cert : allCerts) { String subjectKeyId = getSubjectKeyID(cert.getExtensionValue(SUBJECT_KEY_ID)); if (StringUtils.isNotBlank(subjectKeyId) && StringUtils.isNotBlank(authorityKeyIdentifier) && subjectKeyId.equalsIgnoreCase(authorityKeyIdentifier)) { LOG.debug("Found the match with cert serial number{} ", cert.getSerialNumber().toString(16)); return validateCert(cert); } } } else { LOG.debug("This cert is either self-sign cert or root CA"); for (X509Certificate cert : allCerts) { if (cert.equals(certToCheck)) { LOG.debug("Found the cert in trust store with serial number {}", cert.getSerialNumber() .toString(16)); return true; } } return false; } return false; }

Target:
public boolean validateCert(X509Certificate certToCheck) { String leafIssuerString = certToCheck.getIssuerX500Principal().getName(); LOG.debug("Issue Name for validated Cert " + leafIssuerString); List<X509Certificate> allCerts = getAllCertByIssuer(certificateManager.getTrustStore(), leafIssuerString); if (isPartChainOfTrust(certToCheck)) { LOG.debug("Cert serial number to verify against our trustStore " + getCertSerialNumber(certToCheck)); String authorityKeyIdentifier = getAuthorityKeyIdentify(certToCheck.getExtensionValue(AUTHORITY_KEY_ID)); for (X509Certificate cert : allCerts) { String subjectKeyId = getSubjectKeyID(cert.getExtensionValue(SUBJECT_KEY_ID)); if (StringUtils.isNotBlank(subjectKeyId) && StringUtils.isNotBlank(authorityKeyIdentifier) && subjectKeyId.equalsIgnoreCase(authorityKeyIdentifier)) { LOG.debug("Found the match with cert serial number " + getCertSerialNumber(cert)); return validateCert(cert); } } } else { LOG.debug("This cert is either self-sign cert or root CA"); for (X509Certificate cert : allCerts) { if (cert.equals(certToCheck)) { LOG.debug("Found the cert in trust store with serial number " + getCertSerialNumber(cert)); return true; } } return false; } return false; }
Source:
private void promptForDockerHostIfMissing(DockerHelper dockerHelper, String dockerHost) { if (StringUtils.isBlank(dockerHelper.getDockerHost())) { String host = null; if(SystemUtils.IS_OS_LINUX){ host = promptForValueIfMissingWithDefault("Please specify Docker host URL (either 'tcp://' or 'unix://')", dockerHost, "dockerHost", ""); } else if (SystemUtils.IS_OS_WINDOWS){ showMessage("Checking default Windows Docker host addresses:"); showMessage("Checking \"Docker for Windows\""); if (isDefaultDockerForWindowsPresent()) { host = DockerHelper.DEFAULT_HOST_DOCKER_FOR_WINDOWS; } else { showMessage("Checking \"Docker Toolbox\""); String dockerToolboxHost = getDefaultDockerToolboxHost(); if (dockerToolboxHost != null) { host = dockerToolboxHost; } } if (host == null) { showMessage("Docker Host URL is needed in order to connect to your Docker instance."); host = promptForValueIfMissingWithDefault("Please specify Docker host URL", host, "dockerHost", ""); } } else if (SystemUtils.IS_OS_MAC_OSX) { showMessage("Checking default Docker for Mac host address:"); if (isDefaultDockerForMacPresent()) { host = DockerHelper.DEFAULT_HOST_DOCKER_FOR_MAC; } else { showMessage("Docker Host URL is needed in order to connect to your Docker instance."); host = promptForValueIfMissingWithDefault( "Please specify Docker host URL", dockerHelper.getDockerHost(), "dockerHost", ""); } } dockerHelper.saveDockerHost(host); } }

Target:
private void promptForDockerHostIfMissing(DockerHelper dockerHelper, String dockerHost) { if (StringUtils.isNotEmpty(dockerHost)) { if (dockerHost.equals("true")) { showMessage("Attempting to find default docker host address..."); dockerHelper.saveDockerHost(getDefaultDockerHost()); } else { dockerHelper.saveDockerHost(dockerHost); } } else if (StringUtils.isBlank(dockerHelper.getDockerHost())) { showMessage("-DdockerHost is not specified in batch mode. Attempting to find default docker host address..."); dockerHelper.saveDockerHost(getDefaultDockerHost()); } }
Source:
public void setGameInfoBean(GameInfoBean gameInfoBean) { mapPreview.setImage(mapService.loadSmallPreview(gameInfoBean.getMapTechnicalName())); MapInfoBean mapInfoBean = mapService.getMapInfoBeanFromVaultFromName(gameInfoBean.getMapTechnicalName()); if (gameInfoBean.getTeams().size() > 1) { gameTitleLabel.setText(i18n.get("chat.gameStatus.gameTitle", gameInfoBean.getTitle())); try { mapNameLabel.setText(i18n.get("chat.gameStatus.mapName", mapInfoBean.getDisplayName())); } catch (NullPointerException e) { } featuredModLabel.setText(i18n.get("chat.gameStatus.featuredMod", gameInfoBean.getFeaturedMod())); } else { gameTitleLabel.setText(gameInfoBean.getTitle()); try { mapNameLabel.setText(mapInfoBean.getDisplayName()); } catch (NullPointerException e) { } featuredModLabel.setText(gameInfoBean.getFeaturedMod()); } GameTooltipController gameTooltipController = applicationContext.getBean(GameTooltipController.class); gameTooltipController.setGameInfoBean(gameInfoBean); gameStatusTooltipRoot.getChildren().add(gameTooltipController.getRoot()); }

Target:
public void setGameInfoBean(GameInfoBean gameInfoBean) { mapPreview.setImage(mapService.loadSmallPreview(gameInfoBean.getMapTechnicalName())); MapInfoBean mapInfoBean = mapService.getMapInfoBeanFromVaultByName(gameInfoBean.getMapTechnicalName()); gameTitleLabel.setText(i18n.get("chat.gameStatus.gameTitle", gameInfoBean.getTitle())); featuredModLabel.setText(i18n.get("chat.gameStatus.featuredMod", gameInfoBean.getFeaturedMod())); if (mapInfoBean != null) { mapNameLabel.setText(i18n.get("chat.gameStatus.mapName", mapInfoBean.getDisplayName())); } GameTooltipController gameTooltipController = applicationContext.getBean(GameTooltipController.class); gameTooltipController.setGameInfoBean(gameInfoBean); gameStatusTooltipRoot.getChildren().add(gameTooltipController.getRoot()); gameStatusTooltipRoot.getChildren(); }
Source:
private void updateQuota(Guid storageDomainId, final ListModel<Quota> isItem, final Guid diskQuotaId) { if (getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED && storageDomainId != null) { AsyncDataProvider.getInstance().getAllRelevantQuotasForStorageSorted(new AsyncQuery<>( list -> { if (list == null) { return; } Guid selectedQuota = isItem.getSelectedItem() != null ? isItem.getSelectedItem().getId() : diskQuotaId; isItem.setItems(list); if (selectedQuota != null && list.size() > 1) { for (Quota quota : list) { if (quota.getId().equals(selectedQuota)) { isItem.setSelectedItem(quota); break; } } } }), storageDomainId, null); } }

Target:
private void updateQuota(Guid storageDomainId, final ListModel<Quota> isItem, final Guid diskQuotaId) { if (getQuotaEnforcementType() != QuotaEnforcementTypeEnum.DISABLED && storageDomainId != null) { AsyncDataProvider.getInstance().getAllRelevantQuotasForStorageSorted(new AsyncQuery<>( list -> { if (list == null) { return; } Guid selectedQuota = isItem.getSelectedItem() != null ? isItem.getSelectedItem().getId() : null; selectedQuota = selectedQuota != null ? selectedQuota : diskQuotaId; isItem.setItems(list); if (selectedQuota != null && list.size() > 1) { for (Quota quota : list) { if (quota.getId().equals(selectedQuota)) { isItem.setSelectedItem(quota); break; } } } }), storageDomainId, null); } }
Source:
public InstructorCourseStudentDetailsPageData(AccountAttributes account, StudentAttributes student, StudentProfileAttributes studentProfile, boolean isAbleToAddComment, boolean hasSection, String commentRecipient) { super(account); if (studentProfile != null) { String pictureUrl = studentProfile.pictureKey == null || studentProfile.pictureKey.isEmpty() ? Const.SystemParams.DEFAULT_PROFILE_PICTURE_PATH : Const.ActionURIs.STUDENT_PROFILE_PICTURE + "?" + Const.ParamsNames.BLOB_KEY + "=" + studentProfile.pictureKey + "&" + Const.ParamsNames.USER_ID + "=" + account.googleId; this.studentProfile = new StudentProfile(student.name, studentProfile, pictureUrl); } this.studentInfoTable = new StudentInfoTable(student, isAbleToAddComment, hasSection); this.commentRecipient = commentRecipient; }

Target:
public InstructorCourseStudentDetailsPageData(AccountAttributes account, StudentAttributes student, StudentProfileAttributes studentProfile, boolean isAbleToAddComment, boolean hasSection, String commentRecipient) { super(account); if (studentProfile != null) { String pictureUrl = getPictureUrl(studentProfile.pictureKey); this.studentProfile = new StudentProfile(student.name, studentProfile, pictureUrl); } this.studentInfoTable = new StudentInfoTable(student, isAbleToAddComment, hasSection); this.commentRecipient = commentRecipient; }
Source:
void insert(GroupInfo info) { Comparator<GroupInfo> c = new Comparator<GroupInfo>() { @Override public int compare(GroupInfo a, GroupInfo b) { int cmp = nullToEmpty(a.name()).compareTo(nullToEmpty(b.name())); if (cmp != 0) { return cmp; } return a.getGroupUUID().compareTo(b.getGroupUUID()); } public String nullToEmpty(String str) { return str == null ? "" : str; } }; int insertPosition = table.getRowCount(); int left = 0; int right = table.getRowCount() - 1; while (left <= right) { int middle = (left + right) >>> 1; GroupInfo i = getRowItem(middle); int cmp = c.compare(i, info); if (cmp < 0) { left = middle + 1; } else if (cmp > 0) { right = middle - 1; } else { return; } } insertPosition = left; table.insertRow(insertPosition); applyDataRowStyle(insertPosition); populate(insertPosition, info); }

Target:
void insert(GroupInfo info) { Comparator<GroupInfo> c = new Comparator<GroupInfo>() { @Override public int compare(GroupInfo a, GroupInfo b) { int cmp = nullToEmpty(a.name()).compareTo(nullToEmpty(b.name())); if (cmp != 0) { return cmp; } return a.getGroupUUID().compareTo(b.getGroupUUID()); } public String nullToEmpty(String str) { return str == null ? "" : str; } }; int insertPosition = table.getRowCount(); int left = 1; int right = table.getRowCount() - 1; while (left <= right) { int middle = (left + right) / 2; GroupInfo i = getRowItem(middle); int cmp = c.compare(i, info); if (cmp < 0) { left = middle + 1; } else if (cmp > 0) { right = middle - 1; } else { return; } } insertPosition = left; table.insertRow(insertPosition); applyDataRowStyle(insertPosition); populate(insertPosition, info); }
Source:
public Operation<K, V> decode(ByteBuffer buffer) { OperationCode opCode = OperationCode.valueOf(buffer.get()); buffer.rewind(); return opCode.decode(buffer, keySerializer, valueSerializer); }

Target:
public Operation<K, V> decode(ByteBuffer buffer) { OperationCode opCode = getOperationCode(buffer); return opCode.decode(buffer, keySerializer, valueSerializer); }
Source:
public void testHandleIpConflict() throws Exception { UpstreamNetworkState upstreamNetwork = null; runUsbTethering(upstreamNetwork); final ArgumentCaptor<InterfaceConfigurationParcel> ifaceConfigCaptor = ArgumentCaptor.forClass(InterfaceConfigurationParcel.class); verify(mNetd).interfaceSetCfg(ifaceConfigCaptor.capture()); final String ipv4Address = ifaceConfigCaptor.getValue().ipv4Addr; verify(mDhcpServer, timeout(DHCPSERVER_START_TIMEOUT_MS).times(1)).startWithCallbacks( any(), any()); reset(mNetd, mUsbManager); upstreamNetwork = buildV4WifiUpstreamState(ipv4Address); mTetheringDependencies.mUpstreamNetworkMonitorMasterSM.sendMessage( Tethering.TetherMasterSM.EVENT_UPSTREAM_CALLBACK, UpstreamNetworkMonitor.EVENT_ON_LINKPROPERTIES, 0, upstreamNetwork); mLooper.dispatchAll(); verify(mUsbManager).setCurrentFunctions(UsbManager.FUNCTION_NONE); mTethering.interfaceRemoved(TEST_USB_IFNAME); mLooper.dispatchAll(); verify(mUsbManager).setCurrentFunctions(UsbManager.FUNCTION_RNDIS); }

Target:
public void testHandleIpConflict() throws Exception { UpstreamNetworkState upstreamNetwork = null; runUsbTethering(upstreamNetwork); final ArgumentCaptor<InterfaceConfigurationParcel> ifaceConfigCaptor = ArgumentCaptor.forClass(InterfaceConfigurationParcel.class); verify(mNetd).interfaceSetCfg(ifaceConfigCaptor.capture()); final String ipv4Address = ifaceConfigCaptor.getValue().ipv4Addr; verify(mDhcpServer, timeout(DHCPSERVER_START_TIMEOUT_MS).times(1)).startWithCallbacks( any(), any()); reset(mNetd, mUsbManager); upstreamNetwork = buildV4WifiUpstreamState(ipv4Address, 30); mTetheringDependencies.mUpstreamNetworkMonitorMasterSM.sendMessage( Tethering.TetherMasterSM.EVENT_UPSTREAM_CALLBACK, UpstreamNetworkMonitor.EVENT_ON_LINKPROPERTIES, 0, upstreamNetwork); mLooper.dispatchAll(); verify(mUsbManager).setCurrentFunctions(UsbManager.FUNCTION_NONE); mTethering.interfaceRemoved(TEST_USB_IFNAME); mLooper.dispatchAll(); verify(mUsbManager).setCurrentFunctions(UsbManager.FUNCTION_RNDIS); }
Source:
private void findMethods(Class<?> entityClass) { for (Method m: entityClass.getMethods()) { InjectLink a = m.getAnnotation(InjectLink.class); Class<?> t = m.getReturnType(); if (a != null) { if (t.equals(String.class) || t.equals(URI.class) || Link.class.isAssignableFrom(t)) { if (!linkMethods.containsKey(m.getName())) { linkMethods.put(m.getName(), new InjectLinkMethodDescriptor(m, a, t)); } } else { } } else if (m.isAnnotationPresent(InjectLinks.class)) { if (List.class.isAssignableFrom(t) || t.isArray() && Link.class.isAssignableFrom(t.getComponentType())) { InjectLinks a2 = m.getAnnotation(InjectLinks.class); linkMethods.put(m.getName(), new InjectLinksMethodDescriptor(m, a2, t)); } else { throw new IllegalArgumentException("Can only inject links onto a List<Link> or Link[] object"); } } else { if(((m.getModifiers() & Modifier.STATIC) > 0) || m.getName().startsWith("java.") || m.getName().startsWith("javax.") ) continue; nonLinkMethods.put(m.getName(), new MethodDescriptor(entityClass, m)); } } }

Target:
private void findMethods(Class<?> entityClass) { for (Method m: entityClass.getMethods()) { InjectLink a = m.getAnnotation(InjectLink.class); Class<?> t = m.getReturnType(); if (a != null) { if (t.equals(String.class) || t.equals(URI.class) || Link.class.isAssignableFrom(t)) { if (!linkMethods.containsKey(m.getName())) { linkMethods.put(m.getName(), new InjectLinkMethodDescriptor(m, a, t)); } } else { } } else if (m.isAnnotationPresent(InjectLinks.class)) { if (List.class.isAssignableFrom(t) || t.isArray() && Link.class.isAssignableFrom(t.getComponentType())) { InjectLinks a2 = m.getAnnotation(InjectLinks.class); linkMethods.put(m.getName(), new InjectLinksMethodDescriptor(m, a2, t)); } else { throw new IllegalArgumentException("Can only inject links onto method that returns a List<Link> or Link[] object"); } } else { if(((m.getModifiers() & Modifier.STATIC) > 0) || m.getName().startsWith("java.") || m.getName().startsWith("javax.") ) continue; nonLinkMethods.put(m.getName(), new MethodDescriptor(entityClass, m)); } } }
Source:
public void testGetDIOValueSuccess() throws Exception { ATCommandResponse mockedResponse = Mockito.mock(ATCommandResponse.class); Mockito.when(mockedResponse.getResponseStatus()).thenReturn(ATCommandStatus.OK); Mockito.when(mockedResponse.getResponse()).thenReturn(new byte[0]); Mockito.doReturn(mockedResponse).when(xbeeDevice).sendATCommand((ATCommand)Mockito.any()); HashMap<IOLine, IOValue> dioValues = new HashMap<IOLine, IOValue>(); dioValues.put(IOLine.DIO0_AD0, IOValue.HIGH); IOSample mockedIOSample = Mockito.mock(IOSample.class); Mockito.when(mockedIOSample.hasDigitalValues()).thenReturn(true); Mockito.when(mockedIOSample.getDigitalValues()).thenReturn(dioValues); PowerMockito.whenNew(IOSample.class).withAnyArguments().thenReturn(mockedIOSample); IOValue ioValue = null; try { ioValue = xbeeDevice.getDIOValue(IOLine.DIO0_AD0); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } catch (XBeeException e) { fail("This exception shouldn't be thrown now."); } assertEquals(IOValue.HIGH, ioValue); }

Target:
public void testGetDIOValueSuccess() throws Exception { ATCommandResponse mockedResponse = Mockito.mock(ATCommandResponse.class); Mockito.when(mockedResponse.getResponseStatus()).thenReturn(ATCommandStatus.OK); Mockito.when(mockedResponse.getResponse()).thenReturn(new byte[1]); Mockito.doReturn(mockedResponse).when(xbeeDevice).sendATCommand((ATCommand)Mockito.any()); HashMap<IOLine, IOValue> dioValues = new HashMap<IOLine, IOValue>(); dioValues.put(IOLine.DIO0_AD0, IOValue.HIGH); IOSample mockedIOSample = Mockito.mock(IOSample.class); Mockito.when(mockedIOSample.hasDigitalValues()).thenReturn(true); Mockito.when(mockedIOSample.getDigitalValues()).thenReturn(dioValues); PowerMockito.whenNew(IOSample.class).withAnyArguments().thenReturn(mockedIOSample); IOValue ioValue = xbeeDevice.getDIOValue(IOLine.DIO0_AD0); assertEquals(IOValue.HIGH, ioValue); }
Source:
public void convertSingleToStringWhenMultiValues() throws Exception { ResultSerializer resultSerializer = new DetailedResultSerializer(false); Collection<String> messages = resultSerializer.serialize(dummyServer(), dummyQuery(), numericResult()); assertThat(messages).hasSize(1); String message = messages.iterator().next(); JsonNode jsonNode = new ObjectMapper().readValue(message, JsonNode.class); assertThat(jsonNode.get("host").asText()).isEqualTo("host.example.net"); assertThat(jsonNode.get("source").asText()).isEqualTo("host.example.net"); assertThat(jsonNode.get("port").asInt()).isEqualTo(4321); assertThat(jsonNode.get("attributeName").asText()).isEqualTo("ObjectPendingFinalizationCount"); assertThat(jsonNode.get("className").asText()).isEqualTo("sun.management.MemoryImpl"); assertThat(jsonNode.get("objDomain").asText()).isEqualTo("ObjectDomainName"); assertThat(jsonNode.get("typeName").asText()).isEqualTo("type=Memory"); assertThat(jsonNode.get("typeNameMap").get("type").asText()).isEqualTo("Memory"); assertThat(jsonNode.get("typeNameMap").size()).isEqualTo(1); assertThat(jsonNode.get("values").get("ObjectPendingFinalizationCount").asLong()).isEqualTo(10L); assertThat(jsonNode.get("epoch").asLong()).isEqualTo(0L); assertThat(jsonNode.get("keyAlias").asText()).isEqualTo("MemoryAlias"); }

Target:
public void convertSingleToStringWhenMultiValues() throws Exception { ResultSerializer resultSerializer = new DetailedResultSerializer(false); Collection<String> messages = resultSerializer.serialize(dummyServer(), dummyQuery(), numericResult()); assertThat(messages).hasSize(1); String message = messages.iterator().next(); JsonNode jsonNode = new ObjectMapper().readValue(message, JsonNode.class); assertThat(jsonNode.get("host").asText()).isEqualTo("host.example.net"); assertThat(jsonNode.get("source").asText()).isEqualTo("host.example.net"); assertThat(jsonNode.get("port").asInt()).isEqualTo(4321); assertThat(jsonNode.get("attributeName").asText()).isEqualTo("ObjectPendingFinalizationCount"); assertThat(jsonNode.get("className").asText()).isEqualTo("sun.management.MemoryImpl"); assertThat(jsonNode.get("objDomain").asText()).isEqualTo("ObjectDomainName"); assertThat(jsonNode.get("typeName").asText()).isEqualTo("type=Memory"); assertThat(jsonNode.get("typeNameMap").get("type").asText()).isEqualTo("Memory"); assertThat(jsonNode.get("typeNameMap")).hasSize(1); assertThat(jsonNode.get("values").get("ObjectPendingFinalizationCount").asLong()).isEqualTo(10L); assertThat(jsonNode.get("epoch").asLong()).isEqualTo(0L); assertThat(jsonNode.get("keyAlias").asText()).isEqualTo("MemoryAlias"); }
Source:
public SubchainInfo(DiskImage baseImage, DiskImage topImage) { this.baseImage = baseImage; this.topImage = topImage; }

Target:
public SubchainInfo(DiskImage baseImage, DiskImage topImage) { this.baseImage = baseImage; this.topImage = topImage; this.baseImageId = baseImage.getImageId(); this.topImageId = topImage.getImageId(); this.storageDomainId = baseImage.getStorageIds().get(0); }
Source:
public RsSimple(final Iterable<String> head, final InputStream body) { super( new RsOf( () -> head, () -> body ) ); }

Target:
public RsSimple(final Iterable<String> head, final InputStream body) { super(new ResponseOf(head, body)); }
Source:
public void getChunksReturnsEqualSizedChunks() { HARegionQueue spy = spy(haRegionQueue); addEvents(); eventIDS.add(mock(EventID.class)); eventIDS.add(mock(EventID.class)); Collection<List<EventID>> myChunks = spy.getChunks(eventIDS, 2); assertThat(myChunks.size()).isEqualTo(3); for (List<EventID> chunk : myChunks) { assertThat(chunk.size()).isEqualTo(2); } }

Target:
public void getChunksReturnsEqualSizedChunks() { HARegionQueue spy = spy(haRegionQueue); addEvents(); eventIDs.add(mock(EventID.class)); eventIDs.add(mock(EventID.class)); int maxChunkSize = 2; Collection<List<EventID>> myChunks = spy.getChunks(eventIDs, maxChunkSize); assertThat(myChunks.size()).isEqualTo(eventIDs.size() / maxChunkSize); for (List<EventID> chunk : myChunks) { assertThat(chunk.size()).isEqualTo(maxChunkSize); } }
Source:
private void index(Object entity, Session session, InstanceInitializer sessionInitializer, ConversionContext conversionContext) throws InterruptedException { if ( Thread.currentThread().isInterrupted() ) { throw new InterruptedException(); } Serializable id = session.getIdentifier( entity ); Class<?> clazz = HibernateHelper.getClass( entity ); EntityIndexBinding entityIndexBinding = entityIndexBindings.get( clazz ); if ( entityIndexBinding == null ) { return; } EntityIndexingInterceptor interceptor = entityIndexBinding.getEntityIndexingInterceptor(); if ( interceptor != null ) { IndexingOverride onAdd = interceptor.onAdd( entity ); switch ( onAdd ) { case REMOVE: case SKIP: return; } } DocumentBuilderIndexedEntity docBuilder = entityIndexBinding.getDocumentBuilder(); TwoWayFieldBridge idBridge = docBuilder.getIdBridge(); String idPropertyName = docBuilder.getIdPropertyName(); conversionContext.pushProperty( docBuilder.getIdFieldName() ); String idInString = null; try { idInString = conversionContext .setClass( clazz ) .twoWayConversionContext( idBridge ) .objectToString( id ); } finally { conversionContext.popProperty(); } AddLuceneWork addWork = docBuilder.createAddWork( tenantId, clazz, entity, id, idInString, sessionInitializer, conversionContext ); backend.enqueueAsyncWork( addWork ); }

Target:
private void index(Object entity, Session session, InstanceInitializer sessionInitializer, ConversionContext conversionContext) throws InterruptedException { if ( Thread.currentThread().isInterrupted() ) { throw new InterruptedException(); } Serializable id = session.getIdentifier( entity ); Class<?> clazz = HibernateHelper.getClass( entity ); EntityIndexBinding entityIndexBinding = entityIndexBindings.get( clazz ); if ( entityIndexBinding == null ) { return; } EntityIndexingInterceptor interceptor = entityIndexBinding.getEntityIndexingInterceptor(); if ( interceptor != null ) { IndexingOverride onAdd = interceptor.onAdd( entity ); switch ( onAdd ) { case REMOVE: case SKIP: return; } } DocumentBuilderIndexedEntity docBuilder = entityIndexBinding.getDocumentBuilder(); TwoWayFieldBridge idBridge = docBuilder.getIdBridge(); String idPropertyName = docBuilder.getIdPropertyName(); if ( idPropertyName != null ) { conversionContext.pushProperty( idPropertyName ); } String idInString = null; try { idInString = conversionContext .setClass( clazz ) .twoWayConversionContext( idBridge ) .objectToString( id ); } finally { if ( idPropertyName != null ) { conversionContext.popProperty(); } } AddLuceneWork addWork = docBuilder.createAddWork( tenantId, clazz, entity, id, idInString, sessionInitializer, conversionContext ); backend.enqueueAsyncWork( addWork ); }
Source:
public void init(ICommonActionExtensionSite site) { if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) { final ICommonViewerWorkbenchSite viewSite = (ICommonViewerWorkbenchSite) site.getViewSite(); final ISelectionProvider selectionProvider = viewSite.getSelectionProvider(); CommonViewer viewer = (CommonViewer) selectionProvider; final ReviewExplorer explorer = (ReviewExplorer) viewer.getCommonNavigator(); openAction = new Action() { @Override public void run() { IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection(); if (selection.size() == 1) { IFileItem fileItem = getFileFor(selection.getFirstElement()); if (fileItem != null) { IWorkbenchPart currentPart = ReviewsUiPlugin.getDefault() .getReviewManager() .getCurrentPart(); if (currentPart instanceof TaskEditor) { TaskEditor part = (TaskEditor) currentPart; TaskEditorInput input = (TaskEditorInput) part.getEditorInput(); GerritReviewBehavior behavior = new GerritReviewBehavior(input.getTask()); CompareConfiguration configuration = new CompareConfiguration(); CompareUI.openCompareEditor(new FileItemCompareEditorInput(configuration, fileItem, behavior)); } } } } @Override public boolean isEnabled() { return true; } }; } }

Target:
public void init(ICommonActionExtensionSite site) { if (site.getViewSite() instanceof ICommonViewerWorkbenchSite) { final ICommonViewerWorkbenchSite viewSite = (ICommonViewerWorkbenchSite) site.getViewSite(); final ISelectionProvider selectionProvider = viewSite.getSelectionProvider(); openAction = new Action() { @Override public void run() { IStructuredSelection selection = (IStructuredSelection) selectionProvider.getSelection(); if (selection.size() == 1) { IFileItem fileItem = getFileFor(selection.getFirstElement()); if (fileItem != null) { ActiveReviewManager reviewManager = ReviewsUiPlugin.getDefault().getReviewManager(); if (reviewManager != null) { IWorkbenchPart currentPart = reviewManager.getCurrentPart(); if (currentPart instanceof TaskEditor) { TaskEditor part = (TaskEditor) currentPart; TaskEditorInput input = (TaskEditorInput) part.getEditorInput(); GerritReviewBehavior behavior = new GerritReviewBehavior(input.getTask()); CompareConfiguration configuration = new CompareConfiguration(); CompareUI.openCompareEditor(new FileItemCompareEditorInput(configuration, fileItem, behavior)); } } } } } @Override public boolean isEnabled() { return true; } }; } }
Source:
private boolean validateAccountingLine(ConcurStandardAccountingExtractDetailLine line, ConcurStandardAccountingExtractBatchReportData reportData) { reportErrorsWithOriginalAccountingDetails(line); String overriddenObjectCode = getParameterService().getParameterValueAsString(CUKFSConstants.ParameterNamespaces.CONCUR, CUKFSParameterKeyConstants.ALL_COMPONENTS, ConcurParameterConstants.CONCUR_SAE_PDP_DEFAULT_OBJECT_CODE); ConcurAccountInfo overriddenConcurAccountingInformation = new ConcurAccountInfo(line.getChartOfAccountsCode(), line.getAccountNumber(), line.getSubAccountNumber(), overriddenObjectCode, StringUtils.EMPTY, line.getProjectCode()); ValidationResult overriddenValidationResults = buildValidationResult(overriddenConcurAccountingInformation, true); if (overriddenValidationResults.isNotValid()) { reportData.addValidationErrorFileLine(new ConcurBatchReportLineValidationErrorItem(line.getReportId(), line.getEmployeeId(), line.getEmployeeLastName(), line.getEmployeeFirstName(), line.getEmployeeMiddleInitital(), overriddenValidationResults.getMessages())); } return overriddenValidationResults.isValid(); }

Target:
private boolean validateAccountingLine(ConcurStandardAccountingExtractDetailLine line, ConcurStandardAccountingExtractBatchReportData reportData) { logErrorsWithOriginalAccountingDetails(line); String overriddenObjectCode = getParameterService().getParameterValueAsString(CUKFSConstants.ParameterNamespaces.CONCUR, CUKFSParameterKeyConstants.ALL_COMPONENTS, ConcurParameterConstants.CONCUR_SAE_PDP_DEFAULT_OBJECT_CODE); ConcurAccountInfo overriddenConcurAccountingInformation = new ConcurAccountInfo(line.getChartOfAccountsCode(), line.getAccountNumber(), line.getSubAccountNumber(), overriddenObjectCode, StringUtils.EMPTY, line.getProjectCode()); ValidationResult overriddenValidationResults = buildValidationResult(overriddenConcurAccountingInformation, true); if (overriddenValidationResults.isNotValid()) { reportData.addValidationErrorFileLine(new ConcurBatchReportLineValidationErrorItem(line.getReportId(), line.getEmployeeId(), line.getEmployeeLastName(), line.getEmployeeFirstName(), line.getEmployeeMiddleInitital(), overriddenValidationResults.getMessages())); } return overriddenValidationResults.isValid(); }
Source:
public void setHotspot(float x, float y) { for (Drawable drawable : mLayers) { if (drawable != null) { drawable.setHotspot(x, y); } } }

Target:
public void setHotspot(float x, float y) { for (int i = 0; i < mLayers.length; i++) { Drawable drawable = mLayers[i]; if (drawable != null) { drawable.setHotspot(x, y); } } }
Source:
public void run() { while (isRunning && containerPlacementMetadataStore.isRunning()) { try { for (ContainerPlacementRequestMessage message : containerPlacementMetadataStore.readAllContainerPlacementRequestMessages()) { LOG.info("Received a container placement message {}", message); containerProcessManager.registerContainerPlacementAction(message); } Thread.sleep(DEFAULT_CLUSTER_MANAGER_CONTAINER_PLACEMENT_HANDLER_SLEEP_MS); } catch (InterruptedException e) { LOG.warn("Got InterruptedException in ContainerPlacementRequestAllocator thread.", e); Thread.currentThread().interrupt(); } catch (Exception e) { LOG.error( "Got unknown Exception while reading ContainerPlacementRequestMessage in ContainerPlacementRequestAllocator thread", e); } } }

Target:
public void run() { while (isRunning && containerPlacementMetadataStore.isRunning()) { try { for (ContainerPlacementRequestMessage message : containerPlacementMetadataStore.readAllContainerPlacementRequestMessages()) { LOG.info("Received a container placement message {}", message); containerProcessManager.registerContainerPlacementAction(message); } Thread.sleep(DEFAULT_CLUSTER_MANAGER_CONTAINER_PLACEMENT_HANDLER_SLEEP_MS); } catch (InterruptedException e) { LOG.warn("Got InterruptedException in ContainerPlacementRequestAllocator thread.", e); Thread.currentThread().interrupt(); } catch (Exception e) { LOG.error( "Got an exception while reading ContainerPlacementRequestMessage in ContainerPlacementRequestAllocator thread", e); } } }
Source:
protected Boolean doInBackground(String... urls) { try { byte[] buffer; ByteArrayOutputStream output = new ByteArrayOutputStream(); if (URLUtil.isDataUrl(urls[0])) { String[] parts = urls[0].split("base64,"); String encoded = parts[1]; buffer = Base64.decode(encoded, Base64.DEFAULT); output.write(buffer, 0, buffer.length); } else { URL url = new URL(urls[0]); InputStream is = (InputStream) url.getContent(); buffer = new byte[8192]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { output.write(buffer, 0, bytesRead); } } File path = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_DOWNLOADS); String fileExtenstion = MimeTypeMap.getFileExtensionFromUrl(urls[0]); String name = URLUtil.guessFileName(urls[0], null, fileExtenstion); name = System.currentTimeMillis() + name; imagePath = new File(path, name); FileOutputStream fos = new FileOutputStream(imagePath); fos.write(output.toByteArray()); fos.flush(); fos.close(); return true; } catch (IOException e) { CrashTracking.logHandledException(e); return false; } }

Target:
protected Boolean doInBackground(String... urls) { try { String fileExtenstion; String name; String sUrl = urls[0]; byte[] buffer; ByteArrayOutputStream output = new ByteArrayOutputStream(); if (URLUtil.isDataUrl(sUrl)) { String[] parts = sUrl.split(","); String encoded = parts[1]; String extension = ""; if (parts[0].toLowerCase().contains("image/")) { Pattern pattern = Pattern.compile("image/([a-zA-Z]*)"); Matcher matcher = pattern.matcher(parts[0]); matcher.find(); extension = matcher.group(1); } name = "dataimage" + extension; if (sUrl.toLowerCase().contains(";base64")) { buffer = Base64.decode(encoded, Base64.DEFAULT); output.write(buffer, 0, buffer.length); output.close(); } else { buffer = Uri.decode(encoded).getBytes(); output.write(buffer, 0, buffer.length); output.close(); } } else { fileExtenstion = MimeTypeMap.getFileExtensionFromUrl(sUrl); name = URLUtil.guessFileName(sUrl, null, fileExtenstion); URL url = new URL(sUrl); InputStream is = (InputStream) url.getContent(); buffer = new byte[8192]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { output.write(buffer, 0, bytesRead); } output.close(); } File path = Environment.getExternalStoragePublicDirectory( Environment.DIRECTORY_DOWNLOADS); name = System.currentTimeMillis() + name; imagePath = new File(path, name); FileOutputStream fos = new FileOutputStream(imagePath); fos.write(output.toByteArray()); fos.flush(); fos.close(); return true; } catch (IOException e) { CrashTracking.logHandledException(e); return false; } }
Source:
private static void addHostNetworksAndUpdateInterfaces(VDS vds, XmlRpcStruct xmlRpcStruct, Map<String, Integer> currVlans, Map<String, Integer> networkVlans) { Map<String, Object> networks = (Map<String, Object>) xmlRpcStruct.getItem(VdsProperties.network_networks); Map<String, VdsNetworkInterface> vdsInterfaces = Entities.entitiesByName(vds.getInterfaces()); if (networks != null) { vds.getNetworks().clear(); for (Entry<String, Object> entry : networks.entrySet()) { Map<String, Object> network = (Map<String, Object>) entry.getValue(); if (network != null) { Network net = new Network(); net.setname(entry.getKey()); net.setaddr((String) network.get("addr")); net.setsubnet((String) network.get("netmask")); net.setgateway((String) network.get(VdsProperties.GLOBAL_GATEWAY)); if (StringUtils.isNotBlank((String) network.get(VdsProperties.mtu))) { net.setMtu(Integer.parseInt((String) network.get(VdsProperties.mtu))); } if (vds.getvds_group_compatibility_version().compareTo(Version.v3_1) >= 0) { VdsNetworkInterface iface = null; String interfaceName = network.get("interface") == null ? null : (String)network.get("interface"); if (interfaceName != null) { iface = vdsInterfaces.get(interfaceName); if (iface == null) { iface = findInterfaceInBridges(xmlRpcStruct, interfaceName, vdsInterfaces); } } updateNetworkDetailsInInterface(iface, currVlans, networkVlans, network, net); } else { Object[] ports = (Object[]) network.get("ports"); if (ports != null) { for (Object port : ports) { updateNetworkDetailsInInterface(vdsInterfaces.get(port.toString()), currVlans, networkVlans, network, net); } } } vds.getNetworks().add(net); } } } }

Target:
private static void addHostNetworksAndUpdateInterfaces(VDS vds, XmlRpcStruct xmlRpcStruct, Map<String, Integer> currVlans, Map<String, Integer> networkVlans) { Map<String, Object> networks = (Map<String, Object>) xmlRpcStruct.getItem(VdsProperties.network_networks); if (networks != null) { vds.getNetworks().clear(); for (Entry<String, Object> entry : networks.entrySet()) { Map<String, Object> network = (Map<String, Object>) entry.getValue(); if (network != null) { Network net = createNetworkData(entry.getKey(), network); List<VdsNetworkInterface> interfaces = findNetworkInterfaces(vds, xmlRpcStruct, network); for (VdsNetworkInterface iface : interfaces) { updateNetworkDetailsInInterface(iface, currVlans, networkVlans, network, net); } vds.getNetworks().add(net); reportInvalidInterfacesForNetwork(interfaces, net, vds); } } } }
Source:
public void climbTest() { super.climbTest(); SWTWorkbenchBot bot = new SWTWorkbenchBot(); SWTBotTable tableBot = new SWTBotTable(getTable().getTableViewer().getTable()); tableBot.header("System Call").click(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); tableBot.header("System Call").click(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); tableBot.header("Duration").click(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); tableBot.header("Duration").click(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "99", 0, 2)); tableBot.header("Start Time").click(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "99", 0, 2)); }

Target:
public void climbTest() { super.climbTest(); SWTWorkbenchBot bot = new SWTWorkbenchBot(); SWTBotTable tableBot = new SWTBotTable(getTable().getTableViewer().getTable()); tableBot.header("System Call").click(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "99", 0, 2)); tableBot.header("System Call").click(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "98", 0, 2)); tableBot.header("Duration").click(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2)); tableBot.header("Duration").click(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "99", 0, 2)); tableBot.header("Start Time").click(); bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "99", 0, 2)); }
Source:
public TaskResult run() { Timer.Context deprecationTaskRunTimer = vcrMetrics.deprecationTaskRunTime.time(); try { logger.info("DeprecatedContainerCloudSyncTask run started."); Timer.Context accountServiceFetchTimer = vcrMetrics.accountServiceFetchTime.time(); Set<Container> deprecatedContainers = AccountUtils.getDeprecatedContainers(accountService, containerDeletionRetentionDays); accountServiceFetchTimer.stop(); logger.info(String.format("Attempting deprecation of %d containers.", deprecatedContainers.size())); cloudDestination.deprecateContainers(deprecatedContainers); } catch (CloudStorageException cloudStorageException) { logger.error("Error in updating deprecated containers from account service to cloud: ", cloudStorageException); } finally { logger.info("DeprecatedContainerCloudSyncTask done."); deprecationTaskRunTimer.stop(); } return null; }

Target:
public TaskResult run() { Timer.Context deprecationTaskRunTimer = vcrMetrics.deprecationTaskRunTime.time(); try { logger.info("DeprecatedContainerCloudSyncTask run started."); Timer.Context accountServiceFetchTimer = vcrMetrics.accountServiceFetchTime.time(); Set<Container> deprecatedContainers = AccountUtils.getDeprecatedContainers(accountService, containerDeletionRetentionDays); accountServiceFetchTimer.stop(); logger.info("Attempting deprecation of containers.", deprecatedContainers.size()); cloudDestination.deprecateContainers(deprecatedContainers); } catch (CloudStorageException cloudStorageException) { logger.error("Error in updating deprecated containers from account service to cloud: ", cloudStorageException); } finally { logger.info("DeprecatedContainerCloudSyncTask done."); deprecationTaskRunTimer.stop(); } return null; }