<commit_before>package eu.stratosphere.test.spargel;

import eu.stratosphere.api.common.Plan;
import eu.stratosphere.configuration.Configuration;
import eu.stratosphere.spargel.java.examples.connectedcomponents.SpargelConnectedComponents;
import eu.stratosphere.test.iterative.nephele.ConnectedComponentsNepheleITCase;
import eu.stratosphere.test.util.TestBase2;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.io.BufferedReader;
import java.util.Collection;

@RunWith(Parameterized.class)
public class SpargelConnectedComponentsITCase extends TestBase2 {

	private static final long SEED = 0xBADC0FFEEBEEFL;

	private static final int NUM_VERTICES = 1000;

	private static final int NUM_EDGES = 10000;

	protected String verticesPath;

	protected String edgesPath;

	protected String resultPath;

	public SpargelConnectedComponentsITCase(Configuration config) {
		super(config);
	}

	@Override
	protected void preSubmit() throws Exception {
		verticesPath = createTempFile("vertices.txt", ConnectedComponentsNepheleITCase.getEnumeratingVertices(NUM_VERTICES));
		edgesPath = createTempFile("edges.txt", ConnectedComponentsNepheleITCase.getRandomOddEvenEdges(NUM_EDGES, NUM_VERTICES, SEED));
		resultPath = getTempFilePath("results");
	}

	@Override
	protected Plan getTestJob() {
		int dop = config.getInteger("ConnectedComponents#NumSubtasks", 1);
		int maxIterations = config.getInteger("ConnectedComponents#NumIterations", 1);
		String[] params = { String.valueOf(dop) , verticesPath, edgesPath, resultPath, String.valueOf(maxIterations) };

		SpargelConnectedComponents cc = new SpargelConnectedComponents();
		return cc.getPlan(params);
	}

	@Override
	protected void postSubmit() throws Exception {
		for (BufferedReader reader : getResultReader(resultPath)) {
			ConnectedComponentsNepheleITCase.checkOddEvenResult(reader);
		}
	}

	@Parameterized.Parameters
	public static Collection<Object[]> getConfigurations() {
		Configuration config1 = new Configuration();
		config1.setInteger("ConnectedComponents#NumSubtasks", 4);
		config1.setInteger("ConnectedComponents#NumIterations", 100);
		return toParameterList(config1);
	}
}<commit_msg>Extend ConnectedComponentsITCase instead of code duplication for SpargelConnectedComponentsITCase<commit_after>package eu.stratosphere.test.spargel;

import eu.stratosphere.api.common.Plan;
import eu.stratosphere.configuration.Configuration;
import eu.stratosphere.spargel.java.examples.connectedcomponents.SpargelConnectedComponents;
import eu.stratosphere.test.iterative.ConnectedComponentsITCase;

public class SpargelConnectedComponentsITCase extends ConnectedComponentsITCase {

	public SpargelConnectedComponentsITCase(Configuration config) {
		super(config);
	}

	@Override
	protected Plan getTestJob() {
		int dop = config.getInteger("ConnectedComponents#NumSubtasks", 1);
		int maxIterations = config.getInteger("ConnectedComponents#NumIterations", 1);
		String[] params = { String.valueOf(dop) , verticesPath, edgesPath, resultPath, String.valueOf(maxIterations) };

		SpargelConnectedComponents cc = new SpargelConnectedComponents();
		return cc.getPlan(params);
	}
}
{'fraction_non_alphanumeric': 0.09010433133101486, 'fraction_numerical': 0.007903888713246918, 'mean_word_length': 7.326315789473684, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '3146913', 'n_tokens_mistral': 985, 'n_tokens_neox': 910, 'n_words': 175}