<commit_before>import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;

import javax.swing.JFrame;

import org.junit.Test;

import sk.tomsik68.mclauncher.api.common.ILaunchSettings;
import sk.tomsik68.mclauncher.api.common.IObservable;
import sk.tomsik68.mclauncher.api.common.IObserver;
import sk.tomsik68.mclauncher.api.common.mc.IMinecraftInstance;
import sk.tomsik68.mclauncher.api.login.IProfile;
import sk.tomsik68.mclauncher.api.login.ISession;
import sk.tomsik68.mclauncher.api.versions.IVersion;
import sk.tomsik68.mclauncher.impl.common.Platform;
import sk.tomsik68.mclauncher.impl.common.mc.VanillaMinecraftInstance;
import sk.tomsik68.mclauncher.impl.login.yggdrasil.YDLoginService;
import sk.tomsik68.mclauncher.impl.login.yggdrasil.io.YDProfileIO;
import sk.tomsik68.mclauncher.impl.versions.mcdownload.MCDownloadVersionList;

public class TestMCDownloadLaunch {

    @Test
    public void test() {

	try {
	    // finally use my minecraft credentials
	    System.out.println("Logging in...");
	    YDLoginService service = new YDLoginService();
	    service.load(Platform.getCurrentPlatform().getWorkingDirectory());
	    YDProfileIO profileIO = new YDProfileIO(Platform
		    .getCurrentPlatform().getWorkingDirectory());
	    IProfile[] profiles = profileIO.read();
	    /*
	     * for (IProfile profile : profiles) {
	     * System.out.println(profile.getName() + ";" +
	     * profile.getPassword()); }
	     */
	    final ISession session = service.login(profiles[0]);
	    profileIO.write(profiles);
	    System.out.println("Success! Launching...");
	    final IMinecraftInstance mc = new VanillaMinecraftInstance(
		    new File("testmc"));
	    MCDownloadVersionList versionList = new MCDownloadVersionList();
	    versionList.addObserver(new IObserver<IVersion>() {

		private boolean launched = false;

		@Override
		public void onUpdate(IObservable<IVersion> observable,
			IVersion changed) {
		    if (!launched) {
			launched = true;
			try {
			    List<String> launchCommand = changed.getLauncher()
				    .getLaunchCommand(session, mc, null,
					    changed, new ILaunchSettings() {

						@Override
						public boolean isModifyAppletOptions() {
						    return false;
						}

						@Override
						public boolean isErrorStreamRedirected() {
						    return true;
						}

						@Override
						public File getJavaLocation() {
						    return null;
						}

						@Override
						public List<String> getJavaArguments() {
						    return null;
						}

						@Override
						public String getInitHeap() {
						    return null;
						}

						@Override
						public String getHeap() {
						    return null;
						}

						@Override
						public Map<String, String> getCustomParameters() {
						    return null;
						}

						@Override
						public List<String> getCommandPrefix() {
						    return null;
						}
					    });
			    for (String cmd : launchCommand) {
				System.out.print(cmd + " ");
			    }
			    ProcessBuilder pb = new ProcessBuilder(
				    launchCommand);
			    pb.directory(mc.getLocation());
			    Process proc = pb.start();
			    BufferedReader br = new BufferedReader(
				    new InputStreamReader(proc.getInputStream()));
			    String line;
			    while (isProcessAlive(proc)) {
				line = br.readLine();
				if (line != null && line.length() > 0)
				    System.out.println(line);
			    }
			} catch (Exception e) {
			    e.printStackTrace();
			}

		    }
		}
	    });
	    versionList.startDownload();
	} catch (Exception e) {
	    e.printStackTrace();
	}
    }

    protected boolean isProcessAlive(Process proc) {
	try {
	    proc.exitValue();
	    return false;
	} catch (Exception e) {
	    return true;
	}

    }

}<commit_msg>Added some arguments & test files to TestMCDownloadLaunch<commit_after>import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.junit.Test;

import sk.tomsik68.mclauncher.api.common.ILaunchSettings;
import sk.tomsik68.mclauncher.api.common.IObservable;
import sk.tomsik68.mclauncher.api.common.IObserver;
import sk.tomsik68.mclauncher.api.common.mc.IMinecraftInstance;
import sk.tomsik68.mclauncher.api.login.IProfile;
import sk.tomsik68.mclauncher.api.login.ISession;
import sk.tomsik68.mclauncher.api.versions.IVersion;
import sk.tomsik68.mclauncher.impl.common.Platform;
import sk.tomsik68.mclauncher.impl.common.mc.VanillaMinecraftInstance;
import sk.tomsik68.mclauncher.impl.login.yggdrasil.YDLoginService;
import sk.tomsik68.mclauncher.impl.login.yggdrasil.io.YDProfileIO;
import sk.tomsik68.mclauncher.impl.versions.mcdownload.MCDownloadVersionList;

public class TestMCDownloadLaunch {

    @Test
    public void test() {

	try {
	    // finally use my minecraft credentials
	    System.out.println("Logging in...");
	    YDLoginService service = new YDLoginService();
	    service.load(Platform.getCurrentPlatform().getWorkingDirectory());
	    YDProfileIO profileIO = new YDProfileIO(Platform
		    .getCurrentPlatform().getWorkingDirectory());
	    IProfile[] profiles = profileIO.read();
	    /*
	     * for (IProfile profile : profiles) {
	     * System.out.println(profile.getName() + ";" +
	     * profile.getPassword()); }
	     */
	    final ISession session = service.login(profiles[0]);
	    profileIO.write(profiles);
	    System.out.println("Success! Launching...");
	    final IMinecraftInstance mc = new VanillaMinecraftInstance(
		    new File("testmc"));
	    MCDownloadVersionList versionList = new MCDownloadVersionList();
	    versionList.addObserver(new IObserver<IVersion>() {

		private boolean launched = false;

		@Override
		public void onUpdate(IObservable<IVersion> observable,
			IVersion changed) {
		    if (!launched) {
			launched = true;
			try {
			    List<String> launchCommand = changed.getLauncher()
				    .getLaunchCommand(session, mc, null,
					    changed, new ILaunchSettings() {

						@Override
						public boolean isModifyAppletOptions() {
						    return false;
						}

						@Override
						public boolean isErrorStreamRedirected() {
						    return true;
						}

						@Override
						public File getJavaLocation() {
						    return null;
						}

						@Override
						public List<String> getJavaArguments() {
						    return Arrays
							    .asList("-XX:+UseConcMarkSweepGC",
								    "-XX:+CMSIncrementalMode",
								    "-XX:-UseAdaptiveSizePolicy",
								    "-Xmn128M");
						}

						@Override
						public String getInitHeap() {
						    return "512M";
						}

						@Override
						public String getHeap() {
						    return "1G";
						}

						@Override
						public Map<String, String> getCustomParameters() {
						    return null;
						}

						@Override
						public List<String> getCommandPrefix() {
						    return null;
						}
					    });
			    for (String cmd : launchCommand) {
				System.out.print(cmd + " ");
			    }
			    System.out.println();
			    ProcessBuilder pb = new ProcessBuilder(
				    launchCommand);
			    pb.redirectError(new File("mcerr.log"));
			    pb.redirectOutput(new File("mcout.log"));
			    pb.directory(mc.getLocation());
			    Process proc = pb.start();
			    BufferedReader br = new BufferedReader(
				    new InputStreamReader(proc.getInputStream()));
			    String line;
			    while (isProcessAlive(proc)) {
				line = br.readLine();
				if (line != null && line.length() > 0)
				    System.out.println(line);
			    }
			} catch (Exception e) {
			    e.printStackTrace();
			}

		    }
		}
	    });
	    versionList.startDownload();
	} catch (Exception e) {
	    e.printStackTrace();
	}
    }

    protected boolean isProcessAlive(Process proc) {
	try {
	    System.out.println("Process exited with error code:"
		    + proc.exitValue());
	    return false;
	} catch (Exception e) {
	    return true;
	}

    }

}
{'fraction_non_alphanumeric': 0.1127857322280834, 'fraction_numerical': 0.007410198442602361, 'mean_word_length': 2.791904761904762, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5371657', 'n_tokens_mistral': 3112, 'n_tokens_neox': 2450, 'n_words': 460}