auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected Function<GitHubRepositoryName, GHHook> createHookSubscribedTo(final List<GHEvent> events) { return new Function<GitHubRepositoryName, GHHook>() { @Override public GHHook apply(GitHubRepositoryName name) { <START> Validate.notNull(name); <END> try { GHRepository repo = checkNotNull( from(name.resolve()).firstMatch(withAdminAccess()).orNull(), "There is no admin access to manage hooks on %s", name ); Validate.notEmpty(events, "Events list for hook can't be empty"); Set<GHHook> hooks = from(fetchHooks().apply(repo)) .filter(webhookFor(endpoint)) .toSet(); Set<GHEvent> alreadyRegistered = from(hooks) .transformAndConcat(eventsFromHook()).toSet(); if (hooks.size() == 1 && isEqualCollection(alreadyRegistered, events)) { LOGGER.debug("Hook already registered for events {}", events); return null; } Set<GHEvent> merged = from(alreadyRegistered).append(events).toSet(); from(hooks) .filter(deleteWebhook()) .filter(log("Replaced hook")).toList(); return createWebhook(endpoint, merged).apply(repo); } catch (Throwable t) { LOGGER.warn("Failed to add GitHub webhook for {}", name, t); } return null; } }; }</code><technical_language>please static imports</technical_language>

Target:
protected Function<GitHubRepositoryName, GHHook> createHookSubscribedTo(final List<GHEvent> events) { return new Function<GitHubRepositoryName, GHHook>() { @Override public GHHook apply(GitHubRepositoryName name) { name = Validate.notNull(name); try { GHRepository repo = checkNotNull( from(name.resolve()).firstMatch(withAdminAccess()).orNull(), "There is no admin access to manage hooks on %s", name ); Validate.notEmpty(events, "Events list for hook can't be empty"); Set<GHHook> hooks = from(fetchHooks().apply(repo)) .filter(webhookFor(endpoint)) .toSet(); Set<GHEvent> alreadyRegistered = from(hooks) .transformAndConcat(eventsFromHook()).toSet(); if (hooks.size() == 1 && isEqualCollection(alreadyRegistered, events)) { LOGGER.debug("Hook already registered for events {}", events); return null; } Set<GHEvent> merged = from(alreadyRegistered).append(events).toSet(); from(hooks) .filter(deleteWebhook()) .filter(log("Replaced hook")).toList(); return createWebhook(endpoint, merged).apply(repo); } catch (Throwable t) { LOGGER.warn("Failed to add GitHub webhook for due to {}", name, t); } return null; } }; }
Source:
<code><START> public void customWithUriVars() throws Exception { <END> MockHttpServletRequest request = logout().logoutUrl("/uri-logout/{var1}/{var2}", "val1", "val2").buildRequest( servletContext); CsrfToken token = (CsrfToken) request.getAttribute(CsrfRequestPostProcessor.TestCsrfTokenRepository.TOKEN_ATTR_NAME); assertThat(request.getMethod()).isEqualTo("POST"); assertThat(request.getParameter(token.getParameterName())).isEqualTo( token.getToken()); assertThat(request.getRequestURI()).isEqualTo("/uri-logout/val1/val2"); }</code><technical_language>This throws clause is redundant</technical_language>

Target:
public void customWithUriVars() { MockHttpServletRequest request = logout().logoutUrl("/uri-logout/{var1}/{var2}", "val1", "val2").buildRequest( servletContext); CsrfToken token = (CsrfToken) request.getAttribute(CsrfRequestPostProcessor.TestCsrfTokenRepository.TOKEN_ATTR_NAME); assertThat(request.getMethod()).isEqualTo("POST"); assertThat(request.getParameter(token.getParameterName())).isEqualTo( token.getToken()); assertThat(request.getRequestURI()).isEqualTo("/uri-logout/val1/val2"); }
Source:
<code><START> protected BigInteger inSatoshis(Object qty) { <END> BigInteger satoshis; if (qty instanceof Long || qty instanceof Integer) satoshis = BigInteger.valueOf(((Number)qty).longValue()); else if (qty instanceof BigInteger) satoshis = (BigInteger)qty; else if (qty instanceof BigDecimal) satoshis = ((BigDecimal)qty).movePointRight(Coin.NUM_COIN_DECIMALS). setScale(0,BigDecimal.ROUND_HALF_UP).unscaledValue(); else if (qty instanceof Double || qty instanceof Float) { return inSatoshis(BigDecimal.valueOf((Double)qty)); } else if (qty instanceof Coin) satoshis = BigInteger.valueOf(((Coin)qty).value); else throw new IllegalArgumentException("Cannot format a " + qty.getClass().getSimpleName() + " as a Bicoin value"); return satoshis; }</code><technical_language>Coin</technical_language>

Target:
private static BigInteger inSatoshis(Object qty) { BigInteger satoshis; if (qty instanceof Long || qty instanceof Integer) satoshis = BigInteger.valueOf(((Number)qty).longValue()); else if (qty instanceof BigInteger) satoshis = (BigInteger)qty; else if (qty instanceof BigDecimal) satoshis = ((BigDecimal)qty).movePointRight(Coin.SMALLEST_UNIT_EXPONENT). setScale(0,BigDecimal.ROUND_HALF_UP).unscaledValue(); else if (qty instanceof Coin) satoshis = BigInteger.valueOf(((Coin)qty).value); else throw new IllegalArgumentException("Cannot format a " + qty.getClass().getSimpleName() + " as a Bicoin value"); return satoshis; }
Source:
<code>private List<String> validateFilterOption( String moduleName, String filterOption, String testGroup) { Set<String> testSources = new HashSet<>(); List<String> testOptions = new ArrayList<>(); List<String> errors = new ArrayList<>(); List<Filters> <START> results = <END> new ArrayList<>(); for (TestInfo test : getTestInfos(moduleName, testGroup)) { for (TestOption options : test.getOptions()) { if (options.getName().equals(filterOption)) { testOptions.add(options.getValue()); testSources.addAll(test.getSources()); results.add(checkOptionType(options.getValue())); } } } if (!(results.isEmpty() || results.stream().allMatch(results.get(0)::equals))) { errors.add( String.format( "Test: %s uses \"%s\" %s for REGREX, %s for ClassOrMethod, %s for " + "Package. Options: %s, TEST_MAPPING file path: %s, test group: %s", moduleName, filterOption, Collections.frequency(results, Filters.REGREX), Collections.frequency(results, Filters.CLASSORMETHOD), Collections.frequency(results, Filters.PACKAGE), testOptions, testSources, testGroup)); } return errors; }</code><technical_language>rename filterTypes</technical_language>

Target:
private List<String> validateFilterOption( String moduleName, String filterOption, String testGroup) { List<String> errors = new ArrayList<>(); Set<Filters> filterTypes = new HashSet<>(); Map<Filters, Set<TestInfo>> filterTestInfos = new HashMap<>(); for (TestInfo test : getTestInfos(moduleName, testGroup)) { for (TestOption options : test.getOptions()) { if (options.getName().equals(filterOption)) { Filters optionType = getOptionType(options.getValue()); filterTestInfos.computeIfAbsent(optionType, k -> new HashSet<>()).add(test); } } } filterTypes = filterTestInfos.keySet(); if (!(filterTypes.isEmpty() || filterTypes.size() == 1)) { errors.add( String.format( "Mixed filter types found. Test: %s , TestGroup: %s, Details:\n" + "%s", moduleName, testGroup, getDetailedErrors(filterOption, filterTestInfos))); } return errors; }
Source:
<code>public FunctionCheckedException<CassandraClient, Map<String, String>, Exception> getHostnamesByIp() { return client -> { KsDef systemPalantir; try { systemPalantir = client.describe_keyspace(SYSTEM_PALANTIR_KEYSPACE); } catch (NotFoundException e) { logger.debug("Did not find keyspace with hostnames by ip, moving on without them"); return ImmutableMap.of(); } <START> if (systemPalantir.getCf_defs().stream().noneMatch(cfDef -> cfDef.name.equals(HOSTNAMES_BY_IP_TABLE))) { <END> logger.debug("Did not find table with hostnames by ip, moving on without them"); return ImmutableMap.of(); } CqlQuery query = CqlQuery.builder() .safeQueryFormat("SELECT * FROM \"%s\".\"%s\";") .addArgs( SafeArg.of("keyspace", SYSTEM_PALANTIR_KEYSPACE), SafeArg.of("table", HOSTNAMES_BY_IP_TABLE)) .build(); return client.execute_cql3_query(query, Compression.NONE, ConsistencyLevel.LOCAL_ONE).getRows().stream() .collect(ImmutableMap.toImmutableMap( row -> getNamedColumnValue(row, IP_COLUMN), row -> getNamedColumnValue(row, HOSTNAME_COLUMN))); }; }</code><technical_language>Extract doesNotContain method a bit more readable</technical_language>

Target:
public FunctionCheckedException<CassandraClient, Map<String, String>, Exception> getHostnamesByIp() { return client -> { KsDef systemPalantir; try { systemPalantir = client.describe_keyspace(SYSTEM_PALANTIR_KEYSPACE); } catch (NotFoundException e) { logger.debug("Did not find keyspace with hostnames by ip, moving on without them"); return ImmutableMap.of(); } if (isCfNotPresent(systemPalantir, HOSTNAMES_BY_IP_TABLE)) { logger.debug("Did not find table with hostnames by ip, moving on without them"); return ImmutableMap.of(); } CqlQuery query = CqlQuery.builder() .safeQueryFormat("SELECT * FROM \"%s\".\"%s\";") .addArgs( SafeArg.of("keyspace", SYSTEM_PALANTIR_KEYSPACE), SafeArg.of("table", HOSTNAMES_BY_IP_TABLE)) .build(); return client.execute_cql3_query(query, Compression.NONE, ConsistencyLevel.LOCAL_ONE).getRows().stream() .collect(ImmutableMap.toImmutableMap( row -> getNamedColumnValue(row, IP_COLUMN), row -> getNamedColumnValue(row, HOSTNAME_COLUMN))); }; }
Source:
<code>private static ChunkManager createChunkManager(Configuration config, boolean sync) { ChunkManager manager = null; boolean persist = config.getBoolean(HDDS_CONTAINER_PERSISTDATA, HDDS_CONTAINER_PERSISTDATA_DEFAULT); <START> if (persist == false) { <END> boolean scrubber = config.getBoolean( HddsConfigKeys.HDDS_CONTAINERSCRUB_ENABLED, HddsConfigKeys.HDDS_CONTAINERSCRUB_ENABLED_DEFAULT); if (scrubber) { LOG.warn("Failed to set " + HDDS_CONTAINER_PERSISTDATA + " to false." + " Please set " + HddsConfigKeys.HDDS_CONTAINERSCRUB_ENABLED + " also to false to enable non-persistent containers."); persist = true; } } if (persist == true) { manager = new ChunkManagerImpl(sync); } else { LOG.warn(HDDS_CONTAINER_PERSISTDATA + " is set to false. All user data will be discarded."); manager = new ChunkManagerNullImpl(sync); } return manager; }</code><technical_language>!persist</technical_language>

Target:
private static ChunkManager createChunkManager(Configuration config, boolean sync) { ChunkManager manager = null; boolean persist = config.getBoolean(HDDS_CONTAINER_PERSISTDATA, HDDS_CONTAINER_PERSISTDATA_DEFAULT); if (!persist) { boolean scrubber = config.getBoolean( HddsConfigKeys.HDDS_CONTAINERSCRUB_ENABLED, HddsConfigKeys.HDDS_CONTAINERSCRUB_ENABLED_DEFAULT); if (scrubber) { LOG.warn("Failed to set " + HDDS_CONTAINER_PERSISTDATA + " to false." + " Please set " + HddsConfigKeys.HDDS_CONTAINERSCRUB_ENABLED + " also to false to enable non-persistent containers."); persist = true; } } if (persist) { manager = new ChunkManagerImpl(sync); } else { LOG.warn(HDDS_CONTAINER_PERSISTDATA + " is set to false. This should be used only for testing." + " All user data will be discarded."); manager = new ChunkManagerDummyImpl(sync); } return manager; }
Source:
<code>public void serializeRecordedEvents(List<RecordedEvent> events, String filePath) { GsonPersistedDataSerializer serializationContext = new GsonPersistedDataSerializer(); PersistedData data = recordedEventListTypeHandler.serialize(events, serializationContext); try (Writer writer = new FileWriter(filePath)) { Gson gson = new GsonBuilder().create(); <START> gson.toJson(data, writer); <END> } catch (IOException e) { logger.error("Error while serializing recorded events", e); } }</code><technical_language>Instead of writing PersistedData data JSON, write JsonElement in (GsonPersistedData) data. For reference, <LINK_0></technical_language>

Target:
public void serializeRecordedEvents(List<RecordedEvent> events, String filePath) { GsonPersistedDataSerializer serializationContext = new GsonPersistedDataSerializer(); GsonPersistedData data = (GsonPersistedData) recordedEventListTypeHandler.serialize(events, serializationContext); try (Writer writer = new FileWriter(filePath)) { Gson gson = new GsonBuilder().create(); gson.toJson(data.getElement(), writer); } catch (IOException e) { logger.error("Error while serializing recorded events", e); } }
Source:
<code>private static Collection<CountrySpecification> getCountrySpecifications(Collection<String> shipsToCountries) { Set<String> countryCodes = new HashSet<>(); String wildcard = "*"; List<String> wildCardCodes; for (String countryCode : shipsToCountries) { if (wildcard.equals(countryCode)) { <START> wildCardCodes = new ArrayList<>(Arrays.asList(Locale.getISOCountries())); <END> wildCardCodes.removeAll(Arrays.asList(UNSUPPORTED_COUNTRIES_FOR_SHIPPING)); countryCodes.addAll(wildCardCodes); } else { countryCodes.add(countryCode); } } List<CountrySpecification> countrySpecifications = new ArrayList<>(countryCodes.size()); for (String countryCode : countryCodes) { countrySpecifications.add(new CountrySpecification(countryCode)); } return countrySpecifications; }</code><technical_language>if in list user passes 100 " \* " (I this is right still) this create 100 ArrayList<>. move this of loop filter countries == " \* ". if " \* " include wildCardCodes countryCodes</technical_language>

Target:
private static Collection<CountrySpecification> getCountrySpecifications(Collection<String> shipsToCountries) { Set<String> countryCodes = new HashSet<>(shipsToCountries); String wildcard = "*"; if (countryCodes.remove(wildcard)) { List<String> wildCardCodes = new ArrayList<>(Arrays.asList(Locale.getISOCountries())); wildCardCodes.removeAll(Arrays.asList(UNSUPPORTED_COUNTRIES_FOR_SHIPPING)); countryCodes.addAll(wildCardCodes); } List<CountrySpecification> countrySpecifications = new ArrayList<>(countryCodes.size()); for (String countryCode : countryCodes) { countrySpecifications.add(new CountrySpecification(countryCode)); } return countrySpecifications; }
Source:
<code>public EntityManager createEntityManager() { <START> return new OgmEntityManager( this, hibernateEmf.createEntityManager().unwrap( EntityManagerImpl.class ) ); <END> }</code><technical_language>is handling for specific implementation _EntityManagerImpl.class_ in unwrap() implementation of EntityManager. This work unwrap() is able cast _EntityManager_ (the interface), this works if actual implementation _EntityManagerImpl_. So.. cast explicitly</technical_language>

Target:
public EntityManager createEntityManager() { return new OgmEntityManager( this, (EntityManagerImpl) hibernateEmf.createEntityManager() ); }
Source:
<code>public void before() throws Exception { DOWNLOAD_CACHE.before(); Path tmpPath = tmp.getRoot().toPath(); LOG.info("The current temporary path: {}", tmpPath); Path currentModulePath = Paths.get("").toAbsolutePath(); Path flinkHomePath = currentModulePath.getParent().getParent().toAbsolutePath(); Path hadoopClasspath = Paths.get(flinkHomePath.toString(), "/flink-yarn-tests/target/yarn.classpath"); File hadoopClasspathFile = new File(hadoopClasspath.toString()); if (!hadoopClasspathFile.exists()) { <START> throw new FileNotFoundException(HBASE_E2E_SQL); <END> } String classPathContent = FileUtils.readFileUtf8(hadoopClasspathFile); hadoopClasspathJars = Arrays.stream(classPathContent.split(":")) .map(jar -> Paths.get(jar)) .collect(Collectors.toList()); }</code><technical_language>yarn.classpath</technical_language>

Target:
public void before() throws Exception { DOWNLOAD_CACHE.before(); Path tmpPath = tmp.getRoot().toPath(); LOG.info("The current temporary path: {}", tmpPath); File hadoopClasspathFile = new File(hadoopClasspath.toAbsolutePath().toString()); if (!hadoopClasspathFile.exists()) { throw new FileNotFoundException("File that contains hadoop classpath " + hadoopClasspath.toString() + " does not exist."); } String classPathContent = FileUtils.readFileUtf8(hadoopClasspathFile); hadoopClasspathJars = Arrays.stream(classPathContent.split(":")) .map(jar -> Paths.get(jar)) .collect(Collectors.toList()); }
Source:
<code><START> public ContainerPlan cloneWithScheduledResource(Resource resource) { <END> return new ContainerPlan(getId(), getInstances(), getRequiredResource(), resource); }</code><technical_language>else currently needs besides class itself. I typically restrictive necessary increase visibility necessary, ready provide a public, stable API</technical_language>

Target:
private ContainerPlan cloneWithScheduledResource(Resource resource) { return new ContainerPlan(getId(), getInstances(), getRequiredResource(), resource); }
Source:
<code>public void testExecuteAndPostProcess() throws Exception{ FeedbackSessionsDb fsDb = new FeedbackSessionsDb(); FeedbackSessionAttributes fs = dataBundle.feedbackSessions.get("session1InCourse1"); String[] submissionParams = new String[]{ Const.ParamsNames.COURSE_ID, fs.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.feedbackSessionName, }; InstructorAttributes instructor = dataBundle.instructors.get("instructor1OfCourse1"); gaeSimulation.loginAsInstructor(instructor.googleId); assertNotNull(fsDb.getFeedbackSession(fs.courseId, fs.feedbackSessionName)); Action a = gaeSimulation.getActionObject(uri, submissionParams); RedirectResult r = (RedirectResult) a.executeAndPostProcess(); assertNull(fsDb.getFeedbackSession(fs.courseId, fs.feedbackSessionName)); assertEquals(Const.ActionURIs.INSTRUCTOR_FEEDBACKS_PAGE + "?error=false" + "&user=idOfInstructor1OfCourse1", <START> r.getDestinationWithParams()); <END> assertEquals(Const.StatusMessages.FEEDBACK_SESSION_DELETED, r.getStatusMessage()); assertEquals(false, r.isError); }</code><technical_language>This indentation show hierarchy. i.e. lines 2-3 parts of parameter while line 4 is 2nd parameter. assertEquals(Const.ActionURIs.INSTRUCTOR_FEEDBACKS_PAGE + "?error=false" + "&user=idOfInstructor1OfCourse1", r.getDestinationWithParams()); is ok combine lines 2 3</technical_language>

Target:
public void testExecuteAndPostProcess() throws Exception{ FeedbackSessionsDb fsDb = new FeedbackSessionsDb(); FeedbackSessionAttributes fs = dataBundle.feedbackSessions.get("session1InCourse1"); String[] submissionParams = new String[]{ Const.ParamsNames.COURSE_ID, fs.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.feedbackSessionName, }; InstructorAttributes instructor = dataBundle.instructors.get("instructor1OfCourse1"); gaeSimulation.loginAsInstructor(instructor.googleId); assertNotNull(fsDb.getFeedbackSession(fs.courseId, fs.feedbackSessionName)); Action a = gaeSimulation.getActionObject(uri, submissionParams); RedirectResult r = (RedirectResult) a.executeAndPostProcess(); assertNull(fsDb.getFeedbackSession(fs.courseId, fs.feedbackSessionName)); assertEquals(Const.ActionURIs.INSTRUCTOR_FEEDBACKS_PAGE + "?error=false&user=idOfInstructor1OfCourse1", r.getDestinationWithParams()); assertEquals(Const.StatusMessages.FEEDBACK_SESSION_DELETED, r.getStatusMessage()); assertEquals(false, r.isError); }
Source:
<code>public GitBlitUrlsConfig(Config config) { canonicalWebUrlString = config.getString("gerrit", null, "canonicalWebUrl"); sshdListenAddressString = config.getString("sshd", null, "listenAddress"); httpdListenUrlString = config.getString("httpd", null, "listenUrl"); <START> downloadSchemes = config.getStringList("download", null, "scheme"); <END> }</code><technical_language>.. get straight as: downloadSchemes = Arrays.asList(config.getStringList("download", null, "scheme");</technical_language>

Target:
public GitBlitUrlsConfig(Config config) { canonicalWebUrlString = config.getString("gerrit", null, "canonicalWebUrl"); sshdListenAddressString = config.getString("sshd", null, "listenAddress"); httpdListenUrlString = config.getString("httpd", null, "listenUrl"); downloadSchemes = Arrays.asList(config.getStringList("download", null, "scheme")); }
Source:
<code>public void testConstructAccountAndContainerFromArguments() throws JSONException { List<Container> containers = new ArrayList<>(); for (int i = 0; i < 2; i++) { <START> containers.add(new Container(refContainerIds.get(i), refContainerNames.get(i), refContainerStatuses.get(i), <END> refContainerDescriptions.get(i), refContainerPrivacies.get(i), refAccountId)); } Account accountFromArguments = new Account(refAccountId, refAccountName, refAccountStatus, containers); assertAccountAgainstReference(accountFromArguments, true, true); }</code><technical_language>Builder here. coz, package access constructor</technical_language>

Target:
public void testConstructAccountAndContainerFromArguments() throws JSONException { List<Container> containers = new ArrayList<>(); for (int i = 0; i < CONTAINER_COUNT; i++) { containers.add(new ContainerBuilder(refContainerIds.get(i), refContainerNames.get(i), refContainerStatuses.get(i), refContainerDescriptions.get(i), refContainerPrivacyValues.get(i), refAccountId).build()); } Account accountFromArguments = new AccountBuilder(refAccountId, refAccountName, refAccountStatus, containers).build(); assertAccountAgainstReference(accountFromArguments, true, true); }
Source:
<code>public void insertFile(DrawableFile f) { try { DrawableTransaction trans = beginTransaction(); CaseDbTransaction caseDbTransaction = this.tskCase.beginTransaction(); insertFile(f, trans, caseDbTransaction); commitTransaction(trans, true); caseDbTransaction.commit(); } catch (TskCoreException ex) { <START> LOGGER.log(Level.SEVERE, "Error inserting file", ex); END> } }</code><technical_language>Ditto rollback error</technical_language>

Target:
public void insertFile(DrawableFile f) { DrawableTransaction trans = null; CaseDbTransaction caseDbTransaction = null; try { trans = beginTransaction(); caseDbTransaction = tskCase.beginTransaction(); insertFile(f, trans, caseDbTransaction); commitTransaction(trans, true); caseDbTransaction.commit(); } catch (TskCoreException ex) { if (null != trans) { rollbackTransaction(trans); } if (null != caseDbTransaction) { try { caseDbTransaction.rollback(); } catch (TskCoreException ex2) { LOGGER.log(Level.SEVERE, "Error in trying to rollback transaction", ex2); } } LOGGER.log(Level.SEVERE, "Error inserting file", ex); } }
Source:
<code>@Override public boolean test(Map<Object, Object> ctx) throws Exception { Integer origin = firstKey.get(); int key = ThreadLocalRandom.current().nextInt(origin, origin + keysNumbPerThread); try (Transaction tx = txs.txStart(args.txConcurrency(), args.txIsolation())) { IgniteCache<Integer, Object> cache = cacheForOperation(); cache.put(key, new SampleValue(key)); tx.suspend(); ex.submit(new Callable<Object>() { <START> @Override public Object call() { <END> tx.resume(); tx.commit(); return null; } }).get(); } return true; }</code><technical_language>Callable<Void></technical_language>

Target:
@Override public boolean test(Map<Object, Object> ctx) throws Exception { Integer origin = firstKey.get(); int key = ThreadLocalRandom.current().nextInt(origin, origin + keysNumbPerThread); try (Transaction tx = txs.txStart(args.txConcurrency(), args.txIsolation())) { IgniteCache<Integer, Object> cache = cacheForOperation(); cache.put(key, new SampleValue(key)); tx.suspend(); ex.submit(new Callable<Void>() { @Override public Void call() { tx.resume(); tx.commit(); return null; } }).get(); } return true; }
Source:
<code>public String getLocalName() { if (localName == null) { if (getSemanticElement() instanceof Diagram) { Diagram diagram = (Diagram) getSemanticElement(); String type = diagram.getType(); String humanType = NotationTypesMap.instance.getHumanReadableType(diagram); if (humanType != null) { localName = humanType; } else { localName = type; } } else if (getNotationElement() instanceof BasicCompartment) { localName = "Compartment"; } else if (helper.isFloatingLabel(getNotationElement())) { localName = "Label"; } else <START> if (getSemanticElement() instanceof CSSConnectorImpl) { <END> String type = ((CSSConnectorImpl) semanticElement).getType(); if (null != type) { localName = type; } } else { localName = getSemanticElement().eClass().getName(); } } return localName; }</code><technical_language>I remove this part entirely. Otherwise: CSSConnectorImpl Connector? Connector Edge, Node Compartment? type is [kind] [type] attribute matcher, block sense in opinion</technical_language>

Target:
public String getLocalName() { if (localName == null) { if (getSemanticElement() instanceof Diagram) { Diagram diagram = (Diagram) getSemanticElement(); String type = diagram.getType(); String humanType = NotationTypesMap.instance.getHumanReadableType(diagram); if (humanType != null) { localName = humanType; } else { localName = type; } } else if (getNotationElement() instanceof BasicCompartment) { localName = "Compartment"; } else if (helper.isFloatingLabel(getNotationElement())) { localName = "Label"; } else { localName = getSemanticElement().eClass().getName(); } } return localName; }
Source:
<code>public void testPrimaryKeyValidation() { final TableSchema pkSchema = TableSchema.builder() .field(NAME, DataTypes.STRING().notNull()) .field(COUNT, DataTypes.DECIMAL(38, 18)) .field(TIME, DataTypes.TIMESTAMP(3)) .field(COMPUTED_COLUMN_NAME, COMPUTED_COLUMN_DATATYPE, COMPUTED_COLUMN_EXPRESSION) .watermark(TIME, WATERMARK_EXPRESSION, WATERMARK_DATATYPE) .primaryKey(NAME) .build(); Map<String, String> options1 = getModifiedOptions( getBasicSinkOptions(), options -> options.put( String.format( "%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.CHANGELOG_MODE.key()), "I;UA;UB;D")); createTableSink(pkSchema, options1); <START> <END> try { createTableSink(pkSchema, getBasicSinkOptions()); fail(); } catch (Throwable t) { String error = "The Kafka table 'default.default.sinkTable' with 'test-format' format" + " doesn't support defining PRIMARY KEY constraint on the table, because it can't" + " guarantee the semantic of primary key."; assertEquals(error, t.getCause().getMessage()); } try { createTableSource(pkSchema, getBasicSourceOptions()); fail(); } catch (Throwable t) { String error = "The Kafka table 'default.default.scanTable' with 'test-format' format" + " doesn't support defining PRIMARY KEY constraint on the table, because it can't" + " guarantee the semantic of primary key."; assertEquals(error, t.getCause().getMessage()); } }</code><technical_language>createTableSource(...)</technical_language>

Target:
public void testPrimaryKeyValidation() { final TableSchema pkSchema = TableSchema.builder() .field(NAME, DataTypes.STRING().notNull()) .field(COUNT, DataTypes.DECIMAL(38, 18)) .field(TIME, DataTypes.TIMESTAMP(3)) .field(COMPUTED_COLUMN_NAME, COMPUTED_COLUMN_DATATYPE, COMPUTED_COLUMN_EXPRESSION) .watermark(TIME, WATERMARK_EXPRESSION, WATERMARK_DATATYPE) .primaryKey(NAME) .build(); Map<String, String> sinkOptions = getModifiedOptions( getBasicSinkOptions(), options -> options.put( String.format( "%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.CHANGELOG_MODE.key()), "I;UA;UB;D")); createTableSink(pkSchema, sinkOptions); try { createTableSink(pkSchema, getBasicSinkOptions()); fail(); } catch (Throwable t) { String error = "The Kafka table 'default.default.sinkTable' with 'test-format' format" + " doesn't support defining PRIMARY KEY constraint on the table, because it can't" + " guarantee the semantic of primary key."; assertEquals(error, t.getCause().getMessage()); } Map<String, String> sourceOptions = getModifiedOptions( getBasicSourceOptions(), options -> options.put( String.format( "%s.%s", TestFormatFactory.IDENTIFIER, TestFormatFactory.CHANGELOG_MODE.key()), "I;UA;UB;D")); createTableSource(pkSchema, sourceOptions); try { createTableSource(pkSchema, getBasicSourceOptions()); fail(); } catch (Throwable t) { String error = "The Kafka table 'default.default.scanTable' with 'test-format' format" + " doesn't support defining PRIMARY KEY constraint on the table, because it can't" + " guarantee the semantic of primary key."; assertEquals(error, t.getCause().getMessage()); } }
Source:
<code>public Reading(ConvertiblePair convertiblePair, Function<? super S, ? extends T> function) { <START> super(convertiblePair, function); <END> }</code><technical_language>Public required</technical_language>

Target:
Reading(ConvertiblePair convertiblePair, Function<? super S, ? extends T> function) { super(convertiblePair, function); }
Source:
<code>private Mono<PagedResponse<CustomFormModelInfo>> listFirstPageModelInfo(Context context) { return service.listCustomModelsSinglePageAsync(context) .doOnRequest(ignoredValue -> logger.info("Listing all model information")) .doOnSuccess(response -> logger.info("Listed all models")) <START> .doOnError(error -> logger.warning("Failed to list all models", error)) <END> .map(res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), toCustomFormModelInfo(res.getValue()), res.getContinuationToken(), null)); }</code><technical_language>nit: logger.warning("Failed list model information",</technical_language>

Target:
private Mono<PagedResponse<CustomFormModelInfo>> listFirstPageModelInfo(Context context) { return service.listCustomModelsSinglePageAsync(context) .doOnRequest(ignoredValue -> logger.info("Listing information for all models")) .doOnSuccess(response -> logger.info("Listed all models")) .doOnError(error -> logger.warning("Failed to list all models information", error)) .map(res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), toCustomFormModelInfo(res.getValue()), res.getContinuationToken(), null)); }
Source:
<code>public double calculatePacketLoss( NetworkStatistics previousStats, NetworkStatistics currentStats, String switchName, String portId, long previousTimestamp, long currentTimestamp) throws Exception { long currentReceiveErrors = getPortReceiveErrors(currentStats, switchName, portId); <START> long previousReceiveErrors = getPortReceiveErrors(currentStats, switchName, portId); <END> long currentReceivedPackets = getPortReceivedPackets(currentStats, switchName, portId); long previousReceivedPackets = getPortReceivedPackets(currentStats, switchName, portId); if (currentReceivedPackets == previousReceivedPackets) return 0; return (currentReceiveErrors - previousReceiveErrors) / (currentReceivedPackets - previousReceivedPackets); }</code><technical_language>I guess parameter "previousStats", getPortReceiveErrors is called "currentStats" parameter</technical_language>

Target:
public double calculatePacketLoss( NetworkStatistics previousStats, NetworkStatistics currentStats, String switchName, String portId, long previousTimestamp, long currentTimestamp) throws Exception { long currentReceiveErrors = getPortReceiveErrors(currentStats, switchName, portId); long previousReceiveErrors = getPortReceiveErrors(previousStats, switchName, portId); long currentReceivedPackets = getPortReceivedPackets(currentStats, switchName, portId); long previousReceivedPackets = getPortReceivedPackets(previousStats, switchName, portId); if (currentReceivedPackets == previousReceivedPackets) return 0; return (currentReceiveErrors - previousReceiveErrors) / (currentReceivedPackets - previousReceivedPackets); }
Source:
<code>public Map<String, String> getOutputFormatConfiguration() { Map<String, String> configuration = new HashMap<>(); if (conf.schema != null) { configuration.put(SCHEMA_KEY, conf.schema); } if (conf.compressionCodec != null && !conf.containsMacro("compressionCodec") && !"none".equalsIgnoreCase(conf.compressionCodec)) { <START> configuration.put(MAPRED_OUTPUT_COMPRESS, "true"); <END> if (CODEC_SNAPPY.equalsIgnoreCase(conf.compressionCodec)) { configuration.put(AVRO_OUTPUT_CODEC, CODEC_SNAPPY); } else if (CODEC_DEFLATE.equalsIgnoreCase(conf.compressionCodec)) { configuration.put(AVRO_OUTPUT_CODEC, CODEC_DEFLATE); } else { throw new IllegalArgumentException("Unsupported compression codec " + conf.compressionCodec); } } return configuration; }</code><technical_language>CodecFactory class avro library parse pickup codec simplify logic. java try { CodecFactory.fromString(conf.compressionCodec); } catch (Exception e) { throw new IllegalArgumentException(.....); }</technical_language>

Target:
public Map<String, String> getOutputFormatConfiguration() { Map<String, String> configuration = new HashMap<>(); if (conf.schema != null) { configuration.put(SCHEMA_KEY, conf.schema); } if (conf.compressionCodec != null && !conf.containsMacro("compressionCodec") && !"none".equalsIgnoreCase(conf.compressionCodec)) { try { CodecFactory.fromString(conf.compressionCodec.toLowerCase()); configuration.put(MAPRED_OUTPUT_COMPRESS, "true"); configuration.put(AVRO_OUTPUT_CODEC, conf.compressionCodec.toLowerCase()); } catch (Exception e) { throw new IllegalArgumentException("Unsupported compression codec " + conf.compressionCodec); } } return configuration; }
Source:
<code>private void doSignUp() { String emailAddress = mEmailEditText.getText().toString(); String password = mPasswordEditText.getText().toString(); String confirmPassword = mPasswordConfirmEditText.getText().toString(); String firstName = mFirstNameEditText.getText().toString(); String lastName = mLastNameEditText.getText().toString(); if (isValidEmail(emailAddress) && confirmPasswords(password, confirmPassword)) { mErrorTextView.setVisibility(View.INVISIBLE); mErrorString = ""; mErrorTextView.setText(mErrorString); User user = new User(); user.setEmail(emailAddress); user.setPassword(password); user.setFirstName(firstName); user.setLastName(lastName); <START> user.needsOnBoarding(); <END> new SignUpTask(this).executeOnExecutor( AsyncTask.THREAD_POOL_EXECUTOR, user); } else { mErrorTextView.setText(mErrorString); mErrorTextView.setVisibility(View.VISIBLE); } }</code><technical_language>this user.onboardingComplete(false)</technical_language>

Target:
private void doSignUp() { String emailAddress = mEmailEditText.getText().toString(); String password = mPasswordEditText.getText().toString(); String confirmPassword = mPasswordConfirmEditText.getText().toString(); String firstName = mFirstNameEditText.getText().toString(); String lastName = mLastNameEditText.getText().toString(); if (isValidEmail(emailAddress) && confirmPasswords(password, confirmPassword)) { mErrorTextView.setVisibility(View.INVISIBLE); mErrorString = ""; mErrorTextView.setText(mErrorString); User user = new User(); user.setEmail(emailAddress); user.setPassword(password); user.setFirstName(firstName); user.setLastName(lastName); user.onBoardingComplete(false); new SignUpTask(this).executeOnExecutor( AsyncTask.THREAD_POOL_EXECUTOR, user); } else { mErrorTextView.setText(mErrorString); mErrorTextView.setVisibility(View.VISIBLE); } }
Source:
<code>public Object combine(Object lhs, Object rhs) { <START> return (((SerializablePair<Long, Double>) lhs).lhs <= ((SerializablePair<Long, Double>) rhs).lhs) ? lhs : rhs; <END> }</code><technical_language>this able static comparator a full of (((())))(</technical_language>

Target:
public Object combine(Object lhs, Object rhs) { return TIME_COMPARATOR.compare(lhs, rhs) <= 0 ? lhs : rhs; }
Source:
<code>public FieldBuilderOptions setConverter(MemberNameConverter converter) { <START> this.converter = Objects.requireNonNull(converter, "The serializer cannot be null"); <END> return this; }</code><technical_language>suggestion this.converter = Objects.requireNonNull(converter, "The converter null");</technical_language>

Target:
public FieldBuilderOptions setConverter(MemberNameConverter converter) { this.converter = Objects.requireNonNull(converter, "The converter cannot be null"); return this; }
Source:
<code>public double deltaStickyStrike(IborFutureOption futureOption, RatesProvider prov, NormalVolatilityIborFutureParameters parameters, double futurePrice) { ArgChecker.isTrue(futureOption.getPremiumStyle().equals(FutureOptionPremiumStyle.DAILY_MARGIN), "premium style should be DAILY_MARGIN"); EuropeanVanillaOption option = createOption(futureOption, parameters); NormalFunctionData normalPoint = createData(createKey(futureOption, futurePrice, parameters), parameters); double[] priceAdjoint = new double[3]; <START> NORMAL_FUNCTION.getPriceAdjoint(option, normalPoint, priceAdjoint); <END> return priceAdjoint[0]; }</code><technical_language>Redundant computation of PDF avoided getDelta</technical_language>

Target:
public double deltaStickyStrike(IborFutureOption futureOption, RatesProvider prov, NormalVolatilityIborFutureParameters parameters, double futurePrice) { ArgChecker.isTrue(futureOption.getPremiumStyle().equals(FutureOptionPremiumStyle.DAILY_MARGIN), "premium style should be DAILY_MARGIN"); EuropeanVanillaOption option = createOption(futureOption, parameters); NormalFunctionData normalPoint = createData(createKey(futureOption, futurePrice, parameters), parameters); return NORMAL_FUNCTION.getDelta(option, normalPoint); }
Source:
<code>protected boolean checkPermissions(final List<PermissionSubject> permSubjects) { for (PermissionSubject permSubject : permSubjects) { if (!checkSinglePermission(permSubject, getReturnValue().getCanDoActionMessages())) { <START> log.infoFormat("No permission found for user {0} or one of the groups he is member of, when running action {1}," <END> + " on object {2} for {3} with id {4}.", getCurrentUser().getId(), getActionType(), permSubject.getObjectType().getVdcObjectTranslation(), permSubject.getActionGroup(), permSubject.getObjectId()); return false; } } return true; }</code><technical_language>running action XXX. Required permissions are: Action type: AAA Action group: BBB Object type: CCC Object ID: DDD</technical_language>

Target:
protected boolean checkPermissions(final List<PermissionSubject> permSubjects) { for (PermissionSubject permSubject : permSubjects) { if (!checkSinglePermission(permSubject, getReturnValue().getCanDoActionMessages())) { log.infoFormat("No permission found for user {0} or one of the groups he is member of," + " when running action {1}, Required permissions are: Action type: {2} Action group: {3}" + " Object type: {4} Object ID: {5}.", getCurrentUser().getId(), getActionType(), permSubject.getActionGroup().getRoleType().name(), permSubject.getActionGroup().name(), permSubject.getObjectType().getVdcObjectTranslation(), permSubject.getObjectId()); return false; } } return true; }
Source:
<code>private int chooseFromCandidates() { for (int port : candidatePorts) { if (!usedPorts.contains(port) && canBind(port)) { return port; } } <START> throw new ISE("All ports are Used.."); <END> }</code><technical_language>typos Used, .</technical_language>

Target:
private int chooseFromCandidates() { for (int port : candidatePorts) { if (!usedPorts.contains(port) && canBind(port)) { return port; } } throw new ISE("All ports are used..."); }
Source:
<code>private static EcsClientConfig buildEcsClientConfig(String clusterName, Config ecsConfig) { return EcsClientConfig.builder() .withClusterName(clusterName) .withLaunchType(ecsConfig.getOptional("launch_type", String.class)) .withAccessKeyId(ecsConfig.get("access_key_id", String.class)) .withSecretAccessKey(ecsConfig.get("secret_access_key", String.class)) .withRegion(ecsConfig.get("region", String.class)) .withSubnets(ecsConfig.getOptional("subnets", String.class)) .withMaxRetries(ecsConfig.get("max_retries", int.class, DEFAULT_MAX_RETRIES)) .withCapacityProviderName(ecsConfig.getOptional("capacity_provider_name", String.class)) .withContainerCpu(ecsConfig.getOptional("container_cpu", Integer.class)) <START> .withContainerMemory(ecsConfig.getOptional("memory", Integer.class)) <END> .withStartedBy(ecsConfig.getOptional("startedBy", String.class)) .withAssignPublicIp(ecsConfig.get("assign_public_ip", boolean.class, true)) .withPlacementStrategyType(ecsConfig.getOptional("placement_strategy_type", String.class)) .withPlacementStrategyField(ecsConfig.getOptional("placement_strategy_field", String.class)) .withTaskCpu(ecsConfig.getOptional("task_cpu", String.class)) .withTaskMemory(ecsConfig.getOptional("task_memory", String.class)) .build(); }</code><technical_language>container_memory for consistent naming</technical_language>

Target:
private static EcsClientConfig buildEcsClientConfig(String clusterName, Config ecsConfig) { return EcsClientConfig.builder() .withClusterName(clusterName) .withLaunchType(ecsConfig.getOptional("launch_type", String.class)) .withAccessKeyId(ecsConfig.get("access_key_id", String.class)) .withSecretAccessKey(ecsConfig.get("secret_access_key", String.class)) .withRegion(ecsConfig.get("region", String.class)) .withSubnets(ecsConfig.getOptional("subnets", String.class)) .withMaxRetries(ecsConfig.get("max_retries", int.class, DEFAULT_MAX_RETRIES)) .withCapacityProviderName(ecsConfig.getOptional("capacity_provider_name", String.class)) .withContainerCpu(ecsConfig.getOptional("container_cpu", Integer.class)) .withContainerMemory(ecsConfig.getOptional("container_memory", Integer.class)) .withStartedBy(ecsConfig.getOptional("startedBy", String.class)) .withAssignPublicIp(ecsConfig.get("assign_public_ip", boolean.class, true)) .withPlacementStrategyType(ecsConfig.getOptional("placement_strategy_type", String.class)) .withPlacementStrategyField(ecsConfig.getOptional("placement_strategy_field", String.class)) .withTaskCpu(ecsConfig.getOptional("task_cpu", String.class)) .withTaskMemory(ecsConfig.getOptional("task_memory", String.class)) .build(); }
Source:
<code>public void onUpgrade(@NonNull final SQLiteDatabase db, final int oldVersion, final int newVersion) { if (oldVersion < 7) { resetDatabase(db); return; } int upgradeTo = oldVersion + 1; while (upgradeTo <= newVersion) { switch (upgradeTo) { case 8: db.execSQL(Contract.Church.SQL_V8_CREATE_TABLE); break; case 9: db.execSQL(Contract.Church.SQL_V9_ALTER_DIRTY); db.execSQL(Contract.MeasurementDetails.SQL_V9_ALTER_LOCAL); <START> db.execSQL(Contract.MeasurementDetails.SQL_V9_ALTER_PERSONAL); <END> break; default: resetDatabase(db); return; } upgradeTo++; } }</code><technical_language>a case 10: db upgrading 9 10 run migrations for new version(s)</technical_language>

Target:
public void onUpgrade(@NonNull final SQLiteDatabase db, final int oldVersion, final int newVersion) { if (oldVersion < 7) { resetDatabase(db); return; } int upgradeTo = oldVersion + 1; while (upgradeTo <= newVersion) { switch (upgradeTo) { case 8: db.execSQL(Contract.Church.SQL_V8_CREATE_TABLE); break; case 9: db.execSQL(Contract.Church.SQL_V9_ALTER_DIRTY); break; case 10: db.execSQL(Contract.MeasurementDetails.SQL_V10_ALTER_LOCAL); db.execSQL(Contract.MeasurementDetails.SQL_V10_ALTER_PERSONAL); break; default: resetDatabase(db); return; } upgradeTo++; } }
Source:
<code>public void testPost() throws Exception { String expectedResponse = "Customer added : Customer{name='TestCreate', surname='TestCreate', id=3}"; int customerId = 3; Customer customer = new Customer("TestCreate", "TestCreate", customerId); Response response = createCustomer(customer); <START> System.out.println(response.readEntity(String.class)); <END> File file = new File("target/test/consumerTest/create.txt"); byte[] encoded = Files.readAllBytes(file.toPath()); String responseBody = new String(encoded); Assert.assertEquals(expectedResponse, responseBody); Assert.assertEquals(customer, getCustomer(customerId)); deleteCustomer(customerId); }</code><technical_language>this is test period debug :)</technical_language>

Target:
public void testPost() throws Exception { String expectedResponse = "Customer added : Customer{name='TestCreate', surname='TestCreate', id=3}"; int customerId = 3; Customer customer = new Customer("TestCreate", "TestCreate", customerId); Response response = createCustomer(customer); File file = new File("target/test/consumerTest/create.txt"); byte[] encoded = Files.readAllBytes(file.toPath()); String responseBody = new String(encoded); Assert.assertEquals(expectedResponse, responseBody); Assert.assertEquals(customer, getCustomer(customerId)); deleteCustomer(customerId); }
Source:
<code>protected void executeQueryCommand() { VDSBrokerFrontend vdsBroker = getBackend().getResourceManager(); VDSReturnValue imagesListResult = vdsBroker.RunVdsCommand(VDSCommandType.GetImagesList, new GetImagesListVDSCommandParameters(getParameters().getDomainId(), DbFacade.getInstance() .getStoragePoolDAO() .getAllForStorageDomain( <START> getParameters().getDomainId()).get(0).getId())); <END> List<Guid> imagesList = (List<Guid>) imagesListResult.getReturnValue(); List<DiskImage> fromDao = getDbFacade().getDiskImageDao().getAllSnapshotsForStorageDomain(getParameters().getDomainId()); for (DiskImage image : fromDao) { if (imagesList.contains(image.getId())) { imagesList.remove(image.getId()); } } if (imagesList.isEmpty()) { logger.info("List is empty."); } else { logger.info("UUIDs found: " + StringUtils.join(imagesList, ",")); } getQueryReturnValue().setReturnValue(imagesList); }</code><technical_language>pass domainId poolId in parameter object</technical_language>

Target:
protected void executeQueryCommand() { VDSBrokerFrontend vdsBroker = getBackend().getResourceManager(); VDSReturnValue imagesListResult = vdsBroker.RunVdsCommand(VDSCommandType.GetImagesList, new GetImagesListVDSCommandParameters(getParameters().getStorageDomainId(), DbFacade.getInstance() .getStoragePoolDao() .getAllForStorageDomain( getParameters().getStorageDomainId()).get(0).getId())); List<Guid> imagesList = (List<Guid>) imagesListResult.getReturnValue(); List<DiskImage> fromDao = getDbFacade().getDiskImageDao().getAllSnapshotsForStorageDomain(getParameters().getStorageDomainId()); for (DiskImage image : fromDao) { imagesList.remove(image.getId()); } if (imagesList.isEmpty()) { logger.info("List is empty."); } else { logger.info("UUIDs found: " + StringUtils.join(imagesList, ",")); } getQueryReturnValue().setReturnValue(imagesList); }
Source:
<code>public void createsHostsConfiguration() throws IOException { final File path = this.temp.newFolder(); final SSHD sshd = new SSHD(path); <START> final int port = sshd.start(); <END> final File key = this.temp.newFile(); FileUtils.write(key, sshd.key()); final String file = Joiner.on('\n').join( "Thindeck-LoadBalancer-Host: localhost", String.format("Thindeck-LoadBalancer-Port: %d", port), String.format("Thindeck-LoadBalancer-User: %s", sshd.login()), String.format( "Thindeck-LoadBalancer-Key-File: %s", key.toString() ), String.format( "Thindeck-LoadBalancer-Directory: %s", path.toString() ), StringUtils.EMPTY ); Manifests.append( new ByteArrayInputStream(file.getBytes()) ); final String host = "host"; final int hport = 1234; final String server = "server"; final int sport = 567; final String shosts = String.format("%s.hosts.conf", host); final File fhosts = new File(path, shosts); FileUtils.writeStringToFile( fhosts, Joiner.on('\n').join( "upstream example_servers {", " server 10.0.0.1:80;", " server 10.0.0.2:80;", "}" ) ); new Nginx().update(host, hport, server, sport); MatcherAssert.assertThat( FileUtils.readFileToString(fhosts), Matchers.equalTo( Joiner.on('\n').join( "upstream example_servers {", " server 10.0.0.1:80;", " server 10.0.0.2:80;", String.format(" server %s:%d;", server, sport), "}" ) ) ); }</code><technical_language>one-time variable port</technical_language>

Target:
public void createsHostsConfiguration() throws IOException { final File path = this.temp.newFolder(); final SSHD sshd = new SSHD(path); final int port = sshd.start(); final File key = this.temp.newFile(); FileUtils.write(key, sshd.key()); this.manifest(path, sshd.login(), port, key); final String host = "host"; final int sport = 567; final String server = "server"; final File fhosts = this.hosts(path, host); new Nginx().update(host, 1234, server, sport); MatcherAssert.assertThat( FileUtils.readFileToString(fhosts), Matchers.equalTo( Joiner.on('\n').join( "upstream example_servers {", " server 10.0.0.1:80;", " server 10.0.0.2:80;", String.format(" server %s:%d;", server, sport), "}" ) ) ); }
Source:
<code>public void init() { meter = metricRegistry.meter("persistence"); nodeInfoCache = CacheBuilder.newBuilder() .maximumSize(1000) <START> .expireAfterAccess(300, TimeUnit.SECONDS) END> .build(new CacheLoader<NodeInfoKey, Optional<NodeInfo>>() { @Override public Optional<NodeInfo> load(NodeInfoKey key) throws Exception { return getNodeInfo(key.location, key.ipAddress); } }); }</code><technical_language>I expireAfterWrite instead of expireAfterAccess ensure cache objects for longer configured time - node details change</technical_language>

Target:
public void init() { meter = metricRegistry.meter("persistence"); nodeInfoCache = CacheBuilder.newBuilder() .maximumSize(1000) .expireAfterWrite(300, TimeUnit.SECONDS) .build(new CacheLoader<NodeInfoKey, Optional<NodeInfo>>() { @Override public Optional<NodeInfo> load(NodeInfoKey key) throws Exception { return getNodeInfo(key.location, key.ipAddress); } }); }