<commit_before>package integration;

import java.lang.invoke.MethodHandles;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.github.GithubData;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;

import static org.assertj.core.api.BDDAssertions.then;
import static org.awaitility.Awaitility.await;

/**
 * @author <NAME>
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = IntegrationTests.class,
		webEnvironment = SpringBootTest.WebEnvironment.NONE)
@EnableAutoConfiguration
public class IntegrationTests {

	private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

	@Value("${stubrunner.url}") String stubRunnerUrl;
	@Value("${application.url}") String applicationUrl;

	TestRestTemplate testRestTemplate = new TestRestTemplate();

	@Test
	public void shouldStoreAMessageWhenGithubDataWasReceivedViaMessaging() {
		final Integer countOfEntries = countGithubData();
		log.info("Initial count is [" + countOfEntries + "]");
		ResponseEntity<Map> response = triggerMessage();
		then(response.getStatusCode().is2xxSuccessful()).isTrue();
		log.info("Triggered additional message");

		log.info("Awaiting proper count of github data");
		await().until(() -> countGithubData() > countOfEntries);
	}

	@Test
	public void shouldStoreAMessageWhenGithubDataWasReceivedFromServiceDiscovery() {
		final Integer countOfEntries = countGithubData();
		log.info("Initial count is [" + countOfEntries + "]");

		ResponseEntity<GithubData> response = callData();
		then(response.getStatusCode().is2xxSuccessful()).isTrue();
		then(response.getBody()).isNotNull();

		log.info("Awaiting proper count of github data");
		await().until(() -> countGithubData() > countOfEntries);
	}

	private ResponseEntity<Map> triggerMessage() {
		return this.testRestTemplate.postForEntity("http://" +
				this.stubRunnerUrl + "/triggers/hook_created_v2", "", Map.class);
	}

	private ResponseEntity<GithubData> callData() {
		return this.testRestTemplate.postForEntity("http://" +
				this.applicationUrl + "/data", "", GithubData.class);
	}

	private Integer countGithubData() {
		Integer response = this.testRestTemplate
				.getForObject("http://" + this.applicationUrl + "/count", Integer.class);
		log.info("Received response [" + response + "]");
		return response;
	}
}
<commit_msg>Updated tests to pass integration tests<commit_after>package integration;

import java.lang.invoke.MethodHandles;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
import org.springframework.github.GithubData;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit4.SpringRunner;

import static org.assertj.core.api.BDDAssertions.then;
import static org.awaitility.Awaitility.await;

/**
 * @author <NAME>
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = IntegrationTests.class,
		webEnvironment = SpringBootTest.WebEnvironment.NONE)
@EnableAutoConfiguration
public class IntegrationTests {

	private static final Log log = LogFactory.getLog(MethodHandles.lookup().lookupClass());

	@Value("${stubrunner.url}") String stubRunnerUrl;
	@Value("${application.url}") String applicationUrl;

	TestRestTemplate testRestTemplate = new TestRestTemplate();

	@Test
	public void shouldStoreAMessageWhenGithubDataWasReceivedViaMessaging() {
		final Integer countOfEntries = countGithubData();
		log.info("Initial count is [" + countOfEntries + "]");
		ResponseEntity<Map> response = triggerMessage();
		then(response.getStatusCode().is2xxSuccessful()).isTrue();
		log.info("Triggered additional message");

		log.info("Awaiting proper count of github data");
		await().until(() -> countGithubData() > countOfEntries);
	}

	@Test
	public void shouldStoreAMessageWhenGithubDataWasReceivedFromServiceDiscovery() {
		final Integer countOfEntries = countGithubData();
		log.info("Initial count is [" + countOfEntries + "]");

		ResponseEntity<GithubData> response = callData();
		then(response.getStatusCode().is2xxSuccessful()).isTrue();
		then(response.getBody()).isNotNull();

		log.info("Awaiting proper count of github data");
		await().until(() -> countGithubData() > countOfEntries);
	}

	private ResponseEntity<Map> triggerMessage() {
		return this.testRestTemplate.postForEntity("http://" +
				this.stubRunnerUrl + "/triggers/hook_created_v2", "", Map.class);
	}

	private ResponseEntity<GithubData> callData() {
		return this.testRestTemplate.getForEntity("http://" +
				this.applicationUrl + "/data", GithubData.class);
	}

	private Integer countGithubData() {
		Integer response = this.testRestTemplate
				.getForObject("http://" + this.applicationUrl + "/count", Integer.class);
		log.info("Received response [" + response + "]");
		return response;
	}
}

{'fraction_non_alphanumeric': 0.12895641164767588, 'fraction_numerical': 0.0014469162597214686, 'mean_word_length': 6.098844672657253, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '246645', 'n_tokens_mistral': 1659, 'n_tokens_neox': 1592, 'n_words': 297}