auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private synchronized void processNewPeers() { if (newPeers.isEmpty()) return; List<Channel> processed = new ArrayList<>(); int addCnt = 0; for(Channel peer : newPeers) { logger.debug("Processing new peer: " + peer); if(peer.isProtocolsInitialized()) { logger.debug("Protocols initialized"); if (!activePeers.containsKey(peer.getNodeIdWrapper())) { if (!peer.isActive() && activePeers.size() >= maxActivePeers && !trustedPeers.accept(peer.getNode())) { disconnect(peer, TOO_MANY_PEERS); } else { process(peer); addCnt++; } } else { disconnect(peer, DUPLICATE_PEER); } processed.add(peer); } } if (addCnt > 0) { logger.info("New peers processed: " + processed + ", active peers added: " + addCnt + ", total active peers: " + activePeers.size()); } newPeers.removeAll(processed); }

Target:
private void processNewPeers() { List<Runnable> noLockTasks = new ArrayList<>(); synchronized (this) { if (newPeers.isEmpty()) return; List<Channel> processed = new ArrayList<>(); int addCnt = 0; for (Channel peer : newPeers) { logger.debug("Processing new peer: " + peer); if (peer.isProtocolsInitialized()) { logger.debug("Protocols initialized"); if (!activePeers.containsKey(peer.getNodeIdWrapper())) { if (!peer.isActive() && activePeers.size() >= maxActivePeers && !trustedPeers.accept(peer.getNode())) { noLockTasks.add(() -> disconnect(peer, TOO_MANY_PEERS)); } else { process(peer); } } else { noLockTasks.add(() -> disconnect(peer, DUPLICATE_PEER)); } processed.add(peer); } } if (addCnt > 0) { logger.info("New peers processed: " + processed + ", active peers added: " + addCnt + ", total active peers: " + activePeers.size()); } newPeers.removeAll(processed); } noLockTasks.forEach(Runnable::run); }
Source:
private void applyTransactions(Address sender, Collection<TransactionInfo> transactions, int topologyId) { log.debugf("Applying %d transactions for cache %s transferred from node %s", transactions.size(), cacheName, sender); if (isTransactional) { for (TransactionInfo transactionInfo : transactions) { GlobalTransaction gtx = transactionInfo.getGlobalTransaction(); if (rpcManager.getAddress().equals(gtx.getAddress())) { continue; } gtx.setRemote(true); CacheTransaction tx = transactionTable.getLocalTransaction(gtx); if (tx == null) { tx = transactionTable.getRemoteTransaction(gtx); if (tx == null) { try { tx = transactionTable.getOrCreateRemoteTransaction(gtx, transactionInfo.getModifications()); ((RemoteTransaction) tx).setLookedUpEntriesTopology(topologyId - 1); } catch (IllegalStateException e) { if (trace) log.tracef(e, "Failed to create remote transaction %s", gtx); } } } transactionInfo.getLockedKeys().forEach(tx::addBackupLockForKey); } } }

Target:
private void applyTransactions(Address sender, Collection<TransactionInfo> transactions, int topologyId) { log.debugf("Applying %d transactions for cache %s transferred from node %s", transactions.size(), cacheName, sender); if (isTransactional) { for (TransactionInfo transactionInfo : transactions) { GlobalTransaction gtx = transactionInfo.getGlobalTransaction(); if (rpcManager.getAddress().equals(gtx.getAddress())) { continue; } gtx.setRemote(true); CacheTransaction tx = transactionTable.getLocalTransaction(gtx); if (tx == null) { tx = transactionTable.getRemoteTransaction(gtx); if (tx == null) { try { tx = transactionTable.getOrCreateRemoteTransaction(gtx, transactionInfo.getModifications()); ((RemoteTransaction) tx).setLookedUpEntriesTopology(topologyId - 1); } catch (Throwable t) { if (trace) log.tracef(t, "Failed to create remote transaction %s", gtx); } } } if (tx != null) { transactionInfo.getLockedKeys().forEach(tx::addBackupLockForKey); } } } }
Source:
public void testVoidCenterRetrieval() { ArrayList<CenterDomain> arr = CenterHelper.listCenters(requestSpec, responseSpec); long id = arr.get(arr.size() - 1).getId(); BatchRequest br = new BatchRequest(); br.setRequestId(id); br.setRelativeUrl("centers"); br.setMethod("GET"); br.setBody("{ }"); List<BatchResponse> response = BatchHelper.postWithSingleRequest(requestSpec, responseSpec, br); System.out.print(response.get(0).getBody()); Assert.assertEquals("Verify Status Code 404 for getting a nonexistent center", 404, (long) response.get(0).getStatusCode()); }

Target:
public void testVoidCenterRetrieval() { ArrayList<CenterDomain> arr = CenterHelper.listCenters(requestSpec, responseSpec); int id = arr.get(arr.size() - 1).getId() + 1; ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(404).build(); CenterDomain center = CenterHelper.retrieveByID(id, requestSpec, responseSpec); Assert.assertNotNull(center); }
Source:
public ByteAmount plus(ByteAmount other) { Preconditions.checkArgument(Long.MAX_VALUE - asBytes() >= other.asBytes(), String.format( "Subtracting %s from %s would overshoot Long.MIN_LONG", other, this)); return ByteAmount.fromBytes(asBytes() + other.asBytes()); }

Target:
public ByteAmount plus(ByteAmount other) { Preconditions.checkArgument(Long.MAX_VALUE - asBytes() >= other.asBytes(), String.format( "Adding %s to %s would exceed Long.MAX_LONG", other, this)); return ByteAmount.fromBytes(asBytes() + other.asBytes()); }
Source:
public List<String> allocateMacAddresses(int numberOfAddresses) { log.debug("Allocating mac addresses from {}.", numberOfAddresses, this); List<Long> macs = macsStorage.allocateAvailableMacs(numberOfAddresses); List<String> result = MacAddressRangeUtils.macAddressesToStrings(macs); log.debug("Allocated mac addresses: from {}.", Arrays.toString(result.toArray()), this); Collections.sort(result); logWhenMacPoolIsEmpty(); return result; }

Target:
public List<String> allocateMacAddresses(int numberOfAddresses) { log.debug("Allocating mac addresses from {}.", numberOfAddresses, this); List<Long> macs = macsStorage.allocateAvailableMacs(numberOfAddresses); List<String> result = MacAddressRangeUtils.macAddressesToStrings(macs); log.debug("Allocated mac addresses: from {}.", result, this); Collections.sort(result); logWhenMacPoolIsEmpty(); return result; }
Source:
void archiveEntityViaMigration() { ProjectId id = createId(42); TestProcessManager entity = createEntity(id); repository().store(entity); repository().applyMigration(id, new MarkPmArchived<>()); Optional<TestProcessManager> found = repository().find(id); Truth8.assertThat(found).isPresent(); assertThat(found.get() .isArchived()).isTrue(); }

Target:
void archiveEntityViaMigration() { ProjectId id = createId(42); TestProcessManager entity = createEntity(id); repository().store(entity); repository().applyMigration(id, new MarkPmArchived<>()); Optional<TestProcessManager> found = repository().find(id); assertThat(found).isPresent(); assertThat(found.get() .isArchived()).isTrue(); }
Source:
public CompletableFuture<ClientResponse> run(byte[] catalogJarBytes, String deploymentString) { if (!allowPausedModeWork(isRestoring(), isAdminConnection())) { return makeQuickResponse( ClientResponse.SERVER_UNAVAILABLE, "Server is paused and is available in read-only mode - please try again later."); } if ((catalogJarBytes != null) && (catalogJarBytes.length == 0)) { catalogJarBytes = null; } boolean useDDLSchema = VoltDB.instance().getCatalogContext().cluster.getUseddlschema() && !isRestoring(); if (catalogJarBytes != null && useDDLSchema) { return makeQuickResponse( ClientResponse.GRACEFUL_FAILURE, "Cluster is configured to use AdHoc DDL to change application schema. " + "Use of @UpdateApplicationCatalog is forbidden."); } logCatalogUpdateInvocation("@UpdateApplicationCatalog"); return updateApplication("@UpdateApplicationCatalog", catalogJarBytes, deploymentString, new String[0], new ArrayList<>(), null, false, useDDLSchema); }

Target:
public CompletableFuture<ClientResponse> run(byte[] catalogJarBytes, String deploymentString) { if (!allowPausedModeWork(isRestoring(), isAdminConnection())) { return makeQuickResponse( ClientResponse.SERVER_UNAVAILABLE, "Server is paused and is available in read-only mode - please try again later."); } if ((catalogJarBytes != null) && (catalogJarBytes.length == 0)) { catalogJarBytes = null; } boolean useDDLSchema = VoltDB.instance().getCatalogContext().cluster.getUseddlschema() && !isRestoring(); if (catalogJarBytes != null && useDDLSchema) { return makeQuickResponse( ClientResponse.GRACEFUL_FAILURE, "Cluster is configured to use AdHoc DDL to change application schema. " + "Use of @UpdateApplicationCatalog is forbidden."); } logCatalogUpdateInvocation("@UpdateApplicationCatalog"); return updateApplication("@UpdateApplicationCatalog", catalogJarBytes, deploymentString, new String[0], Collections.emptyList(), null, false, useDDLSchema); }
Source:
@Provides @Singleton @Readonly ManagedDataSource readonlyDataSource(Environment environment, KeywhizConfig config) { DataSourceFactory dataSourceFactory = config.getDataSourceFactory(); ManagedDataSource dataSource = dataSourceFactory.build(environment.metrics(), "postgres-readonly"); return dataSource; }

Target:
@Provides @Singleton @Readonly ManagedDataSource readonlyDataSource(Environment environment, KeywhizConfig config) { DataSourceFactory dataSourceFactory = config.getDataSourceFactory(); return dataSourceFactory.build(environment.metrics(), "postgres-readonly"); }
Source:
public static Set<String> getSwiftSourceFiles() throws IOException { Set<String> filenames = new TreeSet<>(); for (String pathName : pathNames) { File file = new File(pathName); if (file.isDirectory()) { Files.walk(Paths.get(pathName)) .filter(path -> path.toFile().isFile()) .filter(path -> path.toString().endsWith(".swift")) .forEach(path -> filenames.add(path.toString())); } else if (file.isFile() && pathName.endsWith(".swift") && file.canRead()) { filenames.add(pathName); } else { throw new IOException("Cannot read " + pathName); } } return filenames; }

Target:
public static Set<String> getSwiftSourceFiles() throws IOException { Set<String> filenames = new TreeSet<>(); for (String pathName : pathNames) { File file = new File(pathName); if (file.isDirectory()) { Files.walk(Paths.get(pathName)) .filter(path -> path.toString().endsWith(".swift")) .filter(path -> { File tempFile = path.toFile(); return tempFile.isFile() && tempFile.canRead(); }) .forEach(path -> filenames.add(path.toString())); } else if (file.isFile() && pathName.endsWith(".swift") && file.canRead()) { filenames.add(pathName); } else { throw new IOException("Cannot read " + pathName); } } return filenames; }
Source:
protected void getExternalAppProperties() { M_log.debug("getExternalAppProperties(): called"); if(appExtSecurePropertiesFile!=null) { isTestUrlEnabled = Boolean.parseBoolean(appExtSecurePropertiesFile.getProperty(SectionUtilityToolFilter.PROPERTY_USE_TEST_URL,FALSE)); providerURL=appExtSecurePropertiesFile.getProperty(PROPERTY_LDAP_SERVER_URL); mcommunityGroup=appExtSecurePropertiesFile.getProperty(PROPERTY_AUTH_GROUP); }else { M_log.error("Failed to load secure application properties from sectionsToolPropsSecure.properties for SectionsTool"); } }

Target:
protected void getExternalAppProperties() { M_log.debug("getExternalAppProperties(): called"); if(appExtSecureProperties!=null) { isTestUrlEnabled = Boolean.parseBoolean(appExtSecureProperties.getProperty(SectionUtilityToolFilter.PROPERTY_USE_TEST_URL,FALSE)); providerURL=appExtSecureProperties.getProperty(PROPERTY_LDAP_SERVER_URL); mcommunityGroup=appExtSecureProperties.getProperty(PROPERTY_AUTH_GROUP); }else { M_log.error("Failed to load secure application properties from sectionsToolPropsSecure.properties for SectionsTool"); } }
Source:
public void serDeTest() { doSerDeTest(Collections.emptyList()); doSerDeTest(Arrays.asList("a", "b", "/signedId/abcdef")); }

Target:
public void serDeTest() { doSerDeTest(null); doSerDeTest(Collections.emptyList()); doSerDeTest(Arrays.asList("a", "b", "/signedId/abcdef")); }
Source:
public void readFields( final DataInput input ) throws IOException { final int rasterTileSize = input.readInt(); final byte[] rasterTileBinary = new byte[rasterTileSize]; input.readFully(rasterTileBinary); rasterTile = new RasterTile(); rasterTile.fromBinary(rasterTileBinary); minX = input.readDouble(); maxX = input.readDouble(); minY = input.readDouble(); maxY = input.readDouble(); int crsStrSize = input.readInt(); if (crsStrSize > 0) { byte[] crsStrBytes = new byte[crsStrSize]; input.readFully(crsStrBytes); String crsStr = StringUtils.stringFromBinary(crsStrBytes); try { crs = CRS.decode(crsStr); } catch (FactoryException e) { e.printStackTrace(); } } else { crs = GeometryUtils.DEFAULT_CRS; } }

Target:
public void readFields( final DataInput input ) throws IOException { final int rasterTileSize = input.readInt(); final byte[] rasterTileBinary = new byte[rasterTileSize]; input.readFully(rasterTileBinary); rasterTile = new RasterTile(); rasterTile.fromBinary(rasterTileBinary); minX = input.readDouble(); maxX = input.readDouble(); minY = input.readDouble(); maxY = input.readDouble(); int crsStrSize = input.readInt(); if (crsStrSize > 0) { byte[] crsStrBytes = new byte[crsStrSize]; input.readFully(crsStrBytes); String crsStr = StringUtils.stringFromBinary(crsStrBytes); try { crs = CRS.decode(crsStr); } catch (FactoryException e) { LOGGER.error( "Unable to decode " + crsStr + " CRS", e); throw new RuntimeException( "Unable to decode " + crsStr + " CRS", e); } } else { crs = GeometryUtils.DEFAULT_CRS; } }
Source:
public RsFlash(final String msg, final Level level, final String cookie) { super( new RsWithCookie( cookie, DatatypeConverter.printBase64Binary( new StringBuilder(level.getName()) .append('/') .append(msg) .toString() .getBytes(Charset.defaultCharset()) ), "Path=/", String.format( "Expires=%1$ta, %1$td %1$tb %1$tY %1$tT GMT", new Date( System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1L) ) ) ) ); }

Target:
public RsFlash(final String msg, final Level level, final String cookie) throws IOException { super( new RsWithCookie( cookie, String.format( "%s/%s", URLEncoder.encode(msg, Charset.defaultCharset().name()), level.getName() ), "Path=/", String.format( Locale.ENGLISH, "Expires=%1$ta, %1$td %1$tb %1$tY %1$tT GMT", new Date( System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1L) ) ) ) ); }
Source:
public InnerStateRuntime clone(String key) { StreamInnerStateRuntime streamInnerStateRuntime = new StreamInnerStateRuntime(stateType); for (SingleStreamRuntime singleStreamRuntime : singleStreamRuntimeList) { streamInnerStateRuntime.singleStreamRuntimeList.add((SingleStreamRuntime) singleStreamRuntime.clone(null, key)); } Processor processor = streamInnerStateRuntime.singleStreamRuntimeList.get(0).getProcessorChain(); streamInnerStateRuntime.firstProcessor = (StreamPreStateProcessor) processor; while (processor != null) { if (processor instanceof StreamPostStateProcessor) { streamInnerStateRuntime.lastProcessor = (StreamPostStateProcessor) processor; break; } else { processor = processor.getNextProcessor(); } } ((StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor).setThisStatePreProcessor( (StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor); ((StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor).setThisStatePostProcessor( (StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor); ((StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor).setThisLastProcessor( (StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor); return streamInnerStateRuntime; }

Target:
public InnerStateRuntime clone(String key) { StreamInnerStateRuntime streamInnerStateRuntime = new StreamInnerStateRuntime(stateType); for (SingleStreamRuntime singleStreamRuntime : singleStreamRuntimeList) { streamInnerStateRuntime.singleStreamRuntimeList.add((SingleStreamRuntime) singleStreamRuntime.clone(key)); } Processor processor = streamInnerStateRuntime.singleStreamRuntimeList.get(0).getProcessorChain(); streamInnerStateRuntime.firstProcessor = (StreamPreStateProcessor) processor; while (processor != null) { if (processor instanceof StreamPostStateProcessor) { streamInnerStateRuntime.lastProcessor = (StreamPostStateProcessor) processor; break; } else { processor = processor.getNextProcessor(); } } ((StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor).setThisStatePreProcessor( (StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor); ((StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor).setThisStatePostProcessor( (StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor); ((StreamPreStateProcessor) streamInnerStateRuntime.firstProcessor).setThisLastProcessor( (StreamPostStateProcessor) streamInnerStateRuntime.lastProcessor); return streamInnerStateRuntime; }
Source:
public EventQueue getEventQueue() { return eventQueue; }

Target:
protected EventQueue getEventQueue() { return eventQueue; }
Source:
private String getHttpMessageAsString(HttpMessage msg) { return msg.getResponseHeader().toString() + msg.getResponseBody().toString(); }

Target:
private static String getHttpMessageAsString(HttpMessage msg) { return msg.getResponseHeader().toString() + msg.getResponseBody().toString(); }
Source:
protected void getProjectDetails(IProgressMonitor monitor, GerritConfig gerritConfig, List<Project> result) throws GerritException { ConfigInfo configInfo = retrieveProjectConfigs(gerritConfig.getWildProject().get(), monitor); List<ProjectDetailX> projectDetails = adaptProjectDetails(gerritConfig, configInfo, monitor ); for (ProjectDetailX projectDetail : projectDetails) { if (!GerritUtil.isPermissionOnlyProject(projectDetail, gerritConfig)) { result.add(projectDetail.project); } } }

Target:
protected List<ProjectDetailX> getProjectDetails(IProgressMonitor monitor, GerritConfig gerritConfig, List<Project> result) throws GerritException { if (!GerritVersion.isVersion2120OrLater(getVersion())) { return super.getProjectDetails(monitor, gerritConfig, result); } ConfigInfo configInfo = retrieveProjectConfigs(gerritConfig.getWildProject().get(), monitor); List<ProjectDetailX> projectDetails = adaptProjectDetails(gerritConfig, configInfo, monitor ); return projectDetails; }
Source:
private ImmutableList<Host> parseWSResponse(final WSResponse response) { try { if (response.getStatus() / 100 != 2) { throw new IOException("Non-200 response from Consul"); } else { return OBJECT_MAPPER.readValue( response.getBody(), HOST_LIST_RESPONSE_TYPE_REFERENCE); } } catch (final IOException e) { throw Throwables.propagate(e); } }

Target:
private ImmutableList<Host> parseWSResponse(final WSResponse response) { try { if (response.getStatus() / 100 != 2) { throw new IOException( String.format( "Non-200 response %d from Consul", response.getStatus())); } else { return OBJECT_MAPPER.readValue( response.getBody(), HOST_LIST_RESPONSE_TYPE_REFERENCE); } } catch (final IOException e) { throw Throwables.propagate(e); } }
Source:
public void generateECL() throws SQLException { int sqlReqType = sqlParser.getSqlType(); eclCode = new StringBuilder(""); hpccRequestUrl = null; switch (sqlReqType) { case SQLParser.SQL_TYPE_SELECT: { generateSelectECL(); generateSelectURL(); break; } case SQLParser.SQL_TYPE_SELECTCONST: { generateConstSelectECL(); generateConstSelectURL(); break; } case SQLParser.SQL_TYPE_CALL: { hpccPublishedQuery = dbMetadata.getHpccQuery(HPCCJDBCUtils.handleQuotedString(sqlParser.getStoredProcName())); if (hpccPublishedQuery != null) { storeProcInParams = hpccPublishedQuery.getAllInFields(); procInParamValues = sqlParser.getStoredProcInParamVals(); expectedretcolumns = hpccPublishedQuery.getAllNonInFields(); expectedDSName = hpccPublishedQuery.getDefaultTableName(); int inParamValuesCount = procInParamValues == null ? 0 : procInParamValues.length; if (inParamValuesCount != storeProcInParams.size()) throw new SQLException(hpccPublishedQuery.getName() + " expects "+ storeProcInParams.size() + " input parameters, " + " received " + inParamValuesCount); generateCallURL(); } else throw new SQLException("Invalid store procedure found, verify name and QuerySet: " + sqlParser.getStoredProcName()); break; } default: throw new SQLException("Invalid SQL type detected!"); } }

Target:
public void generateECL() throws SQLException { int sqlReqType = sqlParser.getSqlType(); eclCode = new StringBuilder(""); hpccRequestUrl = null; switch (sqlReqType) { case SQLParser.SQL_TYPE_SELECT: { generateSelectECL(); generateSelectURL(); break; } case SQLParser.SQL_TYPE_SELECTCONST: { generateConstSelectECL(); generateConstSelectURL(); break; } case SQLParser.SQL_TYPE_CALL: { hpccPublishedQuery = dbMetadata.getHpccQuery(HPCCJDBCUtils.handleQuotedString(sqlParser.getStoredProcName())); if (hpccPublishedQuery != null) { storeProcInParams = hpccPublishedQuery.getAllInFields(); procInParamValues = sqlParser.getStoredProcInParamVals(); expectedretcolumns = hpccPublishedQuery.getAllNonInFields(); expectedDSName = hpccPublishedQuery.getDefaultTableName(); int inParamValuesCount = procInParamValues == null ? 0 : procInParamValues.length; if (inParamValuesCount != storeProcInParams.size()) throw new SQLException(hpccPublishedQuery.getName() + " expects "+ storeProcInParams.size() + " input parameters, " + " received " + inParamValuesCount); generateCallURL(); } else throw new SQLException("Invalid Stored Procedure found, verify name and QuerySet: " + sqlParser.getStoredProcName()); break; } default: throw new SQLException("Invalid SQL type detected!"); } }
Source:
public void validate(String name) { if (name == null || name.length() < minLength || name.length() > maxLength) throw exception(name, "Can't be null or empty. Length must be " + minLength + " to " + maxLength + " symbols"); if (!CharMatcher.JAVA_LETTER_OR_DIGIT.matches(name.charAt(0))) throw exception(name, "Should start with letter/number"); CharMatcher range = getAcceptableRange(); if (!range.matchesAllOf(name)) throw exception(name, "Should have lowercase or uppercase ASCII letters, numbers, dashes, underscores and " + "periods"); }

Target:
public void validate(String name) { if (name == null || name.length() < minLength || name.length() > maxLength) throw exception(name, "Can't be null or empty. Length must be " + minLength + " to " + maxLength + " symbols"); if (!CharMatcher.JAVA_LETTER_OR_DIGIT.matches(name.charAt(0))) throw exception(name, "Should start with letter/number"); CharMatcher range = getAcceptableRange(); if (!range.matchesAllOf(name)) throw exception(name, "Should have lowercase or uppercase ASCII letters, numbers, dashes, underscores and periods"); }
Source:
protected void editorActivated(IEditorPart editor) { IEditorInput editorInput = editor.getEditorInput(); IFile file = ResourceUtil.getFile(editorInput); if (file != null) { setSelection(new StructuredSelection(file)); } }

Target:
protected void editorActivated(IEditorPart editor) { IEditorInput editorInput = editor.getEditorInput(); IResource resource = ResourceUtil.getResource(editorInput); if (resource != null) { setSelection(new StructuredSelection(resource)); } }
Source:
public String getColumnText(Object element, int columnIndex) { IRemoteConnection connection = getOriginalIfClean((IRemoteConnection) element); switch (columnIndex) { case 0: return connection.isOpen() ? Messages.ConnectionsPreferencePage_open : Messages.ConnectionsPreferencePage_closed; case 1: return connection.getName(); case 2: if (connection.hasService(IRemoteConnectionHostService.class)) { return connection.getService(IRemoteConnectionHostService.class).getHostname(); } case 3: if (connection.hasService(IRemoteConnectionHostService.class)) { return connection.getService(IRemoteConnectionHostService.class).getUsername(); } } return null; }

Target:
public String getColumnText(Object element, int columnIndex) { IRemoteConnection connection = getOriginalIfClean((IRemoteConnection) element); switch (columnIndex) { case 0: return connection.isOpen() ? Messages.ConnectionsPreferencePage_open : Messages.ConnectionsPreferencePage_closed; case 1: return connection.getName(); case 2: if (connection.hasService(IRemoteConnectionHostService.class)) { return connection.getService(IRemoteConnectionHostService.class).getHostname(); } break; case 3: if (connection.hasService(IRemoteConnectionHostService.class)) { return connection.getService(IRemoteConnectionHostService.class).getUsername(); } break; } return null; }
Source:
public String getHelpNote(ConfigKey key) { return getHelpNoteByType(key, "numercial"); }

Target:
public String getHelpNote(ConfigKey key) { return getHelpNoteByType(key, "numeric"); }
Source:
public static Map<String, Object> readCommandLineOpts() { Map<String, Object> ret = new HashMap<>(); String commandOptions = System.getProperty("storm.options"); if (commandOptions != null) { String[] configs = commandOptions.split(",(?![^\\[\\]{}]*(]|}))"); for (String config : configs) { try { config = URLDecoder.decode(config, StandardCharsets.UTF_8.name()); } catch (UnsupportedEncodingException e) { throw Utils.wrapInRuntime(e); } String[] options = config.split("=", 2); if (options.length == 2) { Object val = options[1]; try { val = JSONValue.parseWithException(options[1]); } catch (ParseException ignored) { } ret.put(options[0], val); } } } return ret; }

Target:
public static Map<String, Object> readCommandLineOpts() { Map<String, Object> ret = new HashMap<>(); String commandOptions = System.getProperty("storm.options"); if (commandOptions != null) { String[] configs = commandOptions.split(",(?![^\\[\\]{}]*(]|}))"); for (String config : configs) { config = urlDecodeUtf8(config); String[] options = config.split("=", 2); if (options.length == 2) { Object val = options[1]; try { val = JSONValue.parseWithException(options[1]); } catch (ParseException ignored) { } ret.put(options[0], val); } } } return ret; }
Source:
protected void showError(String message) { mAnalyticsListener.trackFailure(message); finishFlow(); mGoogleListener.onGoogleSignupError(message); }

Target:
protected void showError(String message) { finishFlow(); mGoogleListener.onGoogleSignupError(message); }
Source:
public static void applyPartitioner() { if (conf.partitioner == null) { throw new ConfigurationException("Missing directive: partitioner", false); } String partitionerName = conf.partitioner; try { partitionerName = System.getProperty(Config.PROPERTY_PREFIX + "partitioner", conf.partitioner); partitioner = FBUtilities.newPartitioner(partitionerName); } catch (Exception e) { throw new ConfigurationException("Invalid partitioner class " + partitionerName, e); } paritionerName = partitioner.getClass().getCanonicalName(); }

Target:
public static void applyPartitioner() { applyPartitioner(conf); }
Source:
public RepoObjectOutput(RepoObject repoObject) { this.key = repoObject.getKey(); this.checksum = repoObject.getChecksum(); this.timestamp = TimestampFormatter.getFormattedTimestamp(repoObject.getTimestamp()); this.downloadName = repoObject.getDownloadName(); this.contentType = repoObject.getContentType(); this.size = repoObject.getSize(); this.tag = repoObject.getTag(); this.versionNumber = repoObject.getVersionNumber(); this.status = repoObject.getStatus(); this.creationDate = TimestampFormatter.getFormattedTimestamp(repoObject.getCreationDate()); this.versionChecksum = repoObject.getVersionChecksum(); URL[] urls = repoObject.getReproxyURL(); if (urls != null) { reproxyURL = Arrays.asList(urls); } }

Target:
public RepoObjectOutput(RepoObject repoObject) { this.key = repoObject.getKey(); this.checksum = repoObject.getChecksum(); this.timestamp = TimestampFormatter.getFormattedTimestamp(repoObject.getTimestamp()); this.downloadName = repoObject.getDownloadName(); this.contentType = repoObject.getContentType(); this.size = repoObject.getSize(); this.tag = repoObject.getTag(); this.versionNumber = repoObject.getVersionNumber(); this.status = repoObject.getStatus(); this.creationDate = TimestampFormatter.getFormattedTimestamp(repoObject.getCreationDate()); this.versionChecksum = repoObject.getVersionChecksum(); this.userMetadata = repoObject.getUserMetadata(); URL[] urls = repoObject.getReproxyURL(); if (urls != null) { reproxyURL = Arrays.asList(urls); } }
Source:
public void initialize() { config = createHomematicConfig(); registerDeviceDiscoveryService(); final HomematicBridgeHandler instance = this; scheduler.execute(() -> { try { String id = getThing().getUID().getId(); gateway = HomematicGatewayFactory.createGateway(id, config, instance, httpClient); configureThingProperties(); gateway.initialize(); discoveryService.startScan(null); discoveryService.waitForScanFinishing(); updateStatus(ThingStatus.ONLINE); if (!config.getGatewayInfo().isHomegear()) { try { gateway.loadRssiValues(); } catch (IOException ex) { logger.warn("Unable to load RSSI values from bridge '{}'", getThing().getUID().getId()); logger.error("{}", ex.getMessage(), ex); } } gateway.startWatchdogs(); } catch (IOException ex) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, ex.getMessage()); logger.error("Homematic bridge was set to OFFLINE-COMMUNICATION_ERROR due to the following exception: {}", ex.getMessage(), ex); dispose(); scheduleReinitialize(); } }); }

Target:
public void initialize() { config = createHomematicConfig(); registerDeviceDiscoveryService(); final HomematicBridgeHandler instance = this; scheduler.execute(() -> { try { String id = getThing().getUID().getId(); gateway = HomematicGatewayFactory.createGateway(id, config, instance, httpClient); configureThingProperties(); gateway.initialize(); discoveryService.startScan(null); discoveryService.waitForScanFinishing(); updateStatus(ThingStatus.ONLINE); if (!config.getGatewayInfo().isHomegear()) { try { gateway.loadRssiValues(); } catch (IOException ex) { logger.warn("Unable to load RSSI values from bridge '{}'", getThing().getUID().getId()); logger.error("{}", ex.getMessage(), ex); } } gateway.startWatchdogs(); } catch (IOException ex) { updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, ex.getMessage()); logger.debug( "Homematic bridge was set to OFFLINE-COMMUNICATION_ERROR due to the following exception: {}", ex.getMessage(), ex); dispose(); scheduleReinitialize(); } }); }
Source:
private boolean runVmAsStateless(VM vmToRunAsStateless) { log.infoFormat("Running Vm {0} as stateless", vmToRunAsStateless); RunVmParams runVmParams = new RunVmParams(vmToRunAsStateless.getId()); runVmParams.setEntityInfo(new EntityInfo(VdcObjectType.VM, vmToRunAsStateless.getId())); runVmParams.setRunAsStateless(true); VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.RunVm, runVmParams, ExecutionHandler.createInternalJobContext()); boolean prestartingVmSucceeded = vdcReturnValue.getSucceeded(); if (!prestartingVmSucceeded) { AuditLogableBase log = new AuditLogableBase(); log.setVmId(vmToRunAsStateless.getId()); log.addCustomValue("VmPoolName", vmToRunAsStateless.getVmPoolName()); AuditLogDirector.log(log, AuditLogType.VM_FAILED_TO_PRESTART_IN_POOL); } log.infoFormat("Running Vm {0} as stateless {1}", vmToRunAsStateless, prestartingVmSucceeded ? "succeeded" : "failed"); return prestartingVmSucceeded; }

Target:
private boolean runVmAsStateless(VM vmToRunAsStateless) { log.infoFormat("Running Vm {0} as stateless", vmToRunAsStateless); RunVmParams runVmParams = new RunVmParams(vmToRunAsStateless.getId()); runVmParams.setEntityInfo(new EntityInfo(VdcObjectType.VM, vmToRunAsStateless.getId())); runVmParams.setRunAsStateless(true); VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.RunVm, runVmParams, ExecutionHandler.createInternalJobContext()); boolean prestartingVmSucceeded = vdcReturnValue.getSucceeded(); if (!prestartingVmSucceeded) { AuditLogableBase log = new AuditLogableBase(); log.addCustomValue("VmPoolName", vmToRunAsStateless.getVmPoolName()); AuditLogDirector.log(log, AuditLogType.VM_FAILED_TO_PRESTART_IN_POOL); } log.infoFormat("Running Vm {0} as stateless {1}", vmToRunAsStateless, prestartingVmSucceeded ? "succeeded" : "failed"); return prestartingVmSucceeded; }
Source:
public BatchRefUpdate newBatchUpdate() { return new BatchRefUpdate(this) { @Override public void execute(RevWalk walk, ProgressMonitor monitor) throws IOException { if (performsAtomicTransactions() && isAtomic()) { try { lock.writeLock().lock(); List<ReceiveCommand> cmds = getCommands(); batch(cmds); for (ReceiveCommand cmd : cmds) { if (cmd.getResult() == ReceiveCommand.Result.OK) { objdb.markDirty(); break; } } } finally { lock.writeLock().unlock(); } } else { super.execute(walk, monitor); } } }; }

Target:
public BatchRefUpdate newBatchUpdate() { return new BatchRefUpdate(this) { @Override public void execute(RevWalk walk, ProgressMonitor monitor) throws IOException { if (performsAtomicTransactions() && isAtomic()) { try { lock.writeLock().lock(); batch(getCommands()); } finally { lock.writeLock().unlock(); } } else { super.execute(walk, monitor); } } }; }
Source:
public List<Task<? extends Serializable>> handle(Context context) throws SemanticException { try { DropPartitionMessage msg = deserializer.getDropPartitionMessage(context.dmd.getPayload()); String actualDbName = context.isDbNameEmpty() ? msg.getDB() : context.dbName; String actualTblName = context.isTableNameEmpty() ? msg.getTable() : context.tableName; Map<Integer, List<ExprNodeGenericFuncDesc>> partSpecs = ReplUtils.genPartSpecs(new Table(msg.getTableObj()), msg.getPartitions()); if (partSpecs.size() > 0) { DropTableDesc dropPtnDesc = new DropTableDesc(actualDbName + "." + actualTblName, partSpecs, null, true, context.eventOnlyReplicationSpec()); Task<DDLWork> dropPtnTask = TaskFactory.get( new DDLWork(readEntitySet, writeEntitySet, dropPtnDesc), context.hiveConf ); context.log.debug("Added drop ptn task : {}:{},{}", dropPtnTask.getId(), dropPtnDesc.getTableName(), msg.getPartitions()); updatedMetadata.set(context.dmd.getEventTo().toString(), actualDbName, actualTblName, null); return Collections.singletonList(ReplUtils.appendOpenTxnTaskForMigration(actualDbName, actualTblName, context.hiveConf, updatedMetadata, dropPtnTask, msg.getTableObj())); } else { throw new SemanticException( "DROP PARTITION EVENT does not return any part descs for event message :" + context.dmd.getPayload()); } } catch (Exception e) { throw (e instanceof SemanticException) ? (SemanticException) e : new SemanticException("Error reading message members", e); } }

Target:
public List<Task<? extends Serializable>> handle(Context context) throws SemanticException { try { DropPartitionMessage msg = deserializer.getDropPartitionMessage(context.dmd.getPayload()); String actualDbName = context.isDbNameEmpty() ? msg.getDB() : context.dbName; String actualTblName = context.isTableNameEmpty() ? msg.getTable() : context.tableName; Map<Integer, List<ExprNodeGenericFuncDesc>> partSpecs = ReplUtils.genPartSpecs(new Table(msg.getTableObj()), msg.getPartitions()); if (partSpecs.size() > 0) { DropTableDesc dropPtnDesc = new DropTableDesc(actualDbName + "." + actualTblName, partSpecs, null, true, context.eventOnlyReplicationSpec()); Task<DDLWork> dropPtnTask = TaskFactory.get( new DDLWork(readEntitySet, writeEntitySet, dropPtnDesc), context.hiveConf ); context.log.debug("Added drop ptn task : {}:{},{}", dropPtnTask.getId(), dropPtnDesc.getTableName(), msg.getPartitions()); updatedMetadata.set(context.dmd.getEventTo().toString(), actualDbName, actualTblName, null); return Collections.singletonList(dropPtnTask); } else { throw new SemanticException( "DROP PARTITION EVENT does not return any part descs for event message :" + context.dmd.getPayload()); } } catch (Exception e) { throw (e instanceof SemanticException) ? (SemanticException) e : new SemanticException("Error reading message members", e); } }
Source:
public int compare(Viewer viewer, Object e1, Object e2) { int rc = 0; rc = super.compare(viewer, ((Ref) e1).getName(), ((Ref) e2).getName()); if (direction == DESCENDING) { rc = -rc; } return rc; }

Target:
public int compare(Viewer viewer, Object e1, Object e2) { int rc = 0; if (direction == DESCENDING) { rc = super.compare(viewer, labelProvider.getText(e1), labelProvider.getText(e2)); } else { rc = super.compare(viewer, labelProvider.getText(e2), labelProvider.getText(e1)); } return rc; }
Source:
public void execute(int iterationId) { try { Backend.getInstance().getResourceManager().RunVdsCommand( VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(getVdss().get(iterationId), getStoragePool(), masterStorageDomainId, storagePoolIsoMap, true)); StorageHelperDirector.getInstance().getItem(getStorageDomain().getStorageType()) .disconnectStorageFromDomainByVdsId(getStorageDomain(), getVdss().get(iterationId).getId()); } catch (RuntimeException e) { log.error("Failed to connect/refresh storagePool. Host '{}' to storage pool '{}'. Error: {}", getVdss().get(iterationId).getName(), getStoragePool().getName(), e.getMessage()); log.debug("Exception", e); } }

Target:
public void execute(int iterationId) { try { Backend.getInstance().getResourceManager().RunVdsCommand( VDSCommandType.ConnectStoragePool, new ConnectStoragePoolVDSCommandParameters(getVdss().get(iterationId), getStoragePool(), masterStorageDomainId, storagePoolIsoMap, true)); StorageHelperDirector.getInstance().getItem(getStorageDomain().getStorageType()) .disconnectStorageFromDomainByVdsId(getStorageDomain(), getVdss().get(iterationId).getId()); } catch (RuntimeException e) { log.error("Failed to connect/refresh storagePool. Host '{}' to storage pool '{}': {}", getVdss().get(iterationId).getName(), getStoragePool().getName(), e.getMessage()); log.debug("Exception", e); } }
Source:
public void run() { FedoraTransaction tx = txManager.startTransaction(); try (Timer.Context context = timer.time()) { for (PID pid : objsToDestroy) { RepositoryObject repoObj = repoObjLoader.getRepositoryObject(pid); assertCanDestroy(agent, repoObj, aclService); if (!inheritedAclFactory.isMarkedForDeletion(pid)) { log.warn("Skipping destruction of {}, it is not marked for deletion", pid); continue; } if (!repoObj.getResource().hasProperty(RDF.type, Cdr.Tombstone)) { RepositoryObject parentObj = repoObj.getParent(); destroyTree(repoObj); parentObj.getPremisLog().buildEvent(Premis.Deletion) .addAuthorizingAgent(agent.getUsername()) .addOutcome(true) .addEventDetail("{0} object(s) were destroyed", deletedObjCount) .addEventDetail("Objects destroyed: {0}", String.join(System.getProperty("line.separator"), deletedObjIds)) .writeAndClose(); } indexingMessageSender.sendIndexingOperation(agent.getUsername(), pid, DELETE_SOLR_TREE); } } catch (Exception e) { tx.cancel(e); } finally { tx.close(); } destroyBinaries(); }

Target:
public void run() { FedoraTransaction tx = txManager.startTransaction(); try (Timer.Context context = timer.time()) { for (PID pid : objsToDestroy) { RepositoryObject repoObj = repoObjLoader.getRepositoryObject(pid); assertCanDestroy(agent, repoObj, aclService); if (!inheritedAclFactory.isMarkedForDeletion(pid)) { log.warn("Skipping destruction of {}, it is not marked for deletion", pid); continue; } if (!repoObj.getResource().hasProperty(RDF.type, Cdr.Tombstone)) { RepositoryObject parentObj = repoObj.getParent(); deletedObjIds.add(repoObj.getPid().getUUID()); destroyTree(repoObj); String lineSeparator = System.getProperty("line.separator"); parentObj.getPremisLog().buildEvent(Premis.Deletion) .addAuthorizingAgent(agent.getUsername()) .addOutcome(true) .addEventDetail("{0} object(s) were destroyed", deletedObjIds.size()) .addEventDetail("Objects destroyed:" + lineSeparator + "{0}", String.join(lineSeparator, deletedObjIds)) .writeAndClose(); } indexingMessageSender.sendIndexingOperation(agent.getUsername(), pid, DELETE_SOLR_TREE); } } catch (Exception e) { tx.cancel(e); } finally { tx.close(); } destroyBinaries(); }
Source:
private void setupRegistrationForm() { try { InputStream in = getAssets().open("config/registration_form.json"); Gson gson = new Gson(); RegistrationForm form = gson.fromJson(new InputStreamReader(in), RegistrationForm.class); LayoutInflater inflater = getLayoutInflater(); for (RegistrationFormField field : form.getFields()) { IRegistrationFieldView fieldView = null; if (field.getFieldType().equalsIgnoreCase(RegistrationFieldType.EMAIL.toString()) || field.getFieldType().equalsIgnoreCase(RegistrationFieldType.PASSWORD.toString()) || field.getFieldType().equalsIgnoreCase(RegistrationFieldType.TEXT.toString())) { View view = inflater.inflate(R.layout.view_register_edit_text, null); fieldView = new RegistrationEditTextView(field, view); } else if (field.getFieldType().equalsIgnoreCase(RegistrationFieldType.TEXTAREA.toString())) { View view = inflater.inflate(R.layout.view_register_text_area, null); fieldView = new RegistrationTextAreaView(field, view); } else if (field.getFieldType().equalsIgnoreCase(RegistrationFieldType.MULTI.toString())) { View view = inflater.inflate(R.layout.view_register_spinner, null); fieldView = new RegistrationSpinnerView(field, view); } if (fieldView != null) mFieldViews.add(fieldView); } for (IRegistrationFieldView v : mFieldViews) { if (v.getField().isRequired()) { requiredFieldsLayout.addView(v.getView()); } else { optionalFieldsLayout.addView(v.getView()); } } requiredFieldsLayout.requestLayout(); optionalFieldsLayout.requestLayout(); } catch(Exception ex) { logger.error(ex); } }

Target:
private void setupRegistrationForm() { try { RegistrationDescription form = new Api(this).getRegistrationDescription(); LayoutInflater inflater = getLayoutInflater(); for (RegistrationFormField field : form.getFields()) { IRegistrationFieldView fieldView = IRegistrationFieldView.Factory.getInstance(inflater, field); if (fieldView != null) mFieldViews.add(fieldView); } for (IRegistrationFieldView v : mFieldViews) { if (v.getField().isRequired()) { requiredFieldsLayout.addView(v.getView()); } else { optionalFieldsLayout.addView(v.getView()); } } requiredFieldsLayout.requestLayout(); optionalFieldsLayout.requestLayout(); } catch(Exception ex) { logger.error(ex); } }
Source:
public void start() { super.start(); logger.info("Starting SparkDriver"); SparkStreamingSupport processor; Properties sparkConfigs = null; try { processor = getComponent(SparkStreamingSupport.class); if (processor != null) { sparkConfigs = getSparkModuleProperties(processor); } } catch (NoSuchBeanDefinitionException e) { throw new RuntimeException("Either java or scala module should be present."); } startSparkStreamingContext(sparkConfigs, processor); }

Target:
public void start() { super.start(); logger.info("Starting SparkDriver"); SparkStreamingSupport processor; Properties sparkConfigs = null; try { processor = getComponent(SparkStreamingSupport.class); Assert.notNull(processor, "Problem getting the spark streaming module. Is the module context active?"); sparkConfigs = getSparkModuleProperties(processor); } catch (NoSuchBeanDefinitionException e) { throw new IllegalStateException("Either java or scala module should be present."); } startSparkStreamingContext(sparkConfigs, processor); }
Source:
public String getApiUri(DateTime startDate, FilterBuilder filterBuilder, String search, String after, int limit) throws IOException { Map<String, String> params = new HashMap<String, String>(); params.put(START_DATE, Utils.convertDateTimeToString(startDate)); params.put(LIMIT, Integer.toString(limit)); if (filterBuilder != null) { params.put(FILTER, filterBuilder.toString()); } if (search != null) { params.put(SEARCH_QUERY, search); } if (after != null) { params.put(AFTER_CURSOR, after); } return getEncodedPathWithQueryParams("/", params); }

Target:
public String getApiUri(DateTime startDate, FilterBuilder filterBuilder, String search, String after, int limit) throws IOException { Map<String, String> params = new HashMap<String, String>(); if (startDate != null) { params.put(START_DATE, Utils.convertDateTimeToString(startDate)); } params.put(LIMIT, Integer.toString(limit)); if (filterBuilder != null) { params.put(FILTER, filterBuilder.toString()); } if (search != null) { params.put(SEARCH_QUERY, search); } if (after != null) { params.put(AFTER_CURSOR, after); } return getEncodedPathWithQueryParams("/", params); }
Source:
public Optional<BibEntry> performSearchById(String identifier) throws FetcherException { if (StringUtil.isBlank(identifier)) { return Optional.empty(); } this.ensureThatIsbnIsValid(identifier); Document html; try { html = Jsoup.connect(BASE_URL + identifier + "/bibtex").userAgent(URLDownload.USER_AGENT).get(); } catch (IOException e) { throw new FetcherException("Could not ", e); } Element textArea = html.select("textarea").first(); Element potentialErrorMessageDiv = html.select("div#flash-notice.notice.add-bottom").first(); if (potentialErrorMessageDiv.hasText() && potentialErrorMessageDiv.text().contains("No Results")) { LOGGER.error("ISBN " + identifier + " not found at ottobib"); } Optional<BibEntry> entry = Optional.empty(); try { entry = BibtexParser.singleFromString(textArea.text(), importFormatPreferences, new DummyFileUpdateMonitor()); } catch (ParseException e) { throw new FetcherException("An internal parser error occurred", e); } entry.ifPresent(bibEntry -> doPostCleanup(bibEntry)); return entry; }

Target:
public Optional<BibEntry> performSearchById(String identifier) throws FetcherException { if (StringUtil.isBlank(identifier)) { return Optional.empty(); } this.ensureThatIsbnIsValid(identifier); Document html; try { html = Jsoup.connect(BASE_URL + identifier + "/bibtex").userAgent(URLDownload.USER_AGENT).get(); } catch (IOException e) { throw new FetcherException("Could not ", e); } Element textArea = html.select("textarea").first(); Optional<Element> potentialErrorMessageDiv = Optional.ofNullable((html.select("div#flash-notice.notice.add-bottom").first())); if (potentialErrorMessageDiv.isPresent() && potentialErrorMessageDiv.get().text().contains("No Results")) { LOGGER.error("ISBN not found at ottobib", identifier); } Optional<BibEntry> entry = Optional.empty(); try { entry = BibtexParser.singleFromString(textArea.text(), importFormatPreferences, new DummyFileUpdateMonitor()); } catch (ParseException e) { throw new FetcherException("An internal parser error occurred", e); } entry.ifPresent(bibEntry -> doPostCleanup(bibEntry)); return entry; }
Source:
long getWatermark(SystemStream systemStream) { return watermarks.get(systemStream); }

Target:
long getWatermark(SystemStream systemStream) { return watermarkStates.entrySet().stream() .filter(entry -> entry.getKey().getSystemStream().equals(systemStream)) .map(entry -> entry.getValue().getWatermarkTime()) .min(Long::compare) .orElse(WATERMARK_NOT_EXIST); }
Source:
public void getArtifact() throws Exception { respondWith(JSON_GET_ARTIFACT); ToscaTemplatesArtifact toscaTemplatesArtifact = osv3().artifact().toscaTemplatesArtifact().get(ARTIFACT_ID); server.takeRequest(); assertEquals(toscaTemplatesArtifact.getName(), "test.zip"); assertEquals(toscaTemplatesArtifact.getStatus(), "active"); }

Target:
public void getArtifact() throws Exception { respondWith(JSON_GET_ARTIFACT); ToscaTemplatesArtifact toscaTemplatesArtifact = osv3().artifact().toscaTemplatesArtifact().get(ARTIFACT_ID); assertEquals(toscaTemplatesArtifact.getName(), "test.zip"); assertEquals(toscaTemplatesArtifact.getStatus(), "active"); }