<commit_before>//
// $Id: CDDBTest.java,v 1.1 2000/10/23 07:32:12 mdb Exp $

package com.samskivert.net.cddb;

/**
 * Tests the CDDB code by connecting to a CDDB server and making some
 * requests.
 */
public class CDDBTest
{
    public static void test (String hostname)
	throws Exception
    {
	CDDB cddb = new CDDB();

	try {
	    String rsp = cddb.connect(hostname);

	    // set the timeout to 30 seconds
	    cddb.setTimeout(30*1000);

	    // try a test query
	    String cdid = "1b037b03";
	    int[] offsets = { 150, 18130, 48615 };
	    int length = 893;
	    CDDB.Entry[] entries = cddb.query(cdid, offsets, length);

	    if (entries == null || entries.length == 0) {
		System.out.println("No match for " + cdid + ".");

	    } else {
		for (int i = 0; i < entries.length; i++) {
		    System.out.println("Match " + entries[i].category + "/" +
				       entries[i].cdid + "/" +
				       entries[i].title);
		}

		CDDB.Detail detail = cddb.read(entries[0].category,
					       entries[0].cdid);
		System.out.println("Title: " + detail.title);
		for (int i = 0; i < detail.trackNames.length; i++) {
		    System.out.println(pad(i) + ": " + detail.trackNames[i]);
		}
		System.out.println("Extended data: " + detail.extendedData);
		for (int i = 0; i < detail.extendedTrackData.length; i++) {
		    System.out.println(pad(i) + ": " +
				       detail.extendedTrackData[i]);
		}
	    }

	} finally {
	    cddb.close();
	}
    }

    protected static String pad (int value)
    {
	return ((value > 9) ? "" : " ") + value;
    }

    public static void main (String[] args)
    {
	if (args.length < 1) {
	    System.err.println("Usage: CDDBTest cddbhost");
	    System.exit(-1);
	}

	try {
	    test(args[0]);

	} catch (CDDBException ce) {
	    System.err.println("Protocol exception: " + ce.getCode() +
			       ": " + ce.getMessage());

	} catch (Throwable t) {
	    t.printStackTrace(System.err);
	}
    }
}<commit_msg>Supply the cdid to the test function.<commit_after>//
// $Id: CDDBTest.java,v 1.2 2000/12/06 00:27:00 mdb Exp $

package com.samskivert.net.cddb;

/**
 * Tests the CDDB code by connecting to a CDDB server and making some
 * requests.
 */
public class CDDBTest
{
    public static void test (String hostname, String cdid)
	throws Exception
    {
	CDDB cddb = new CDDB();

	try {
	    String rsp = cddb.connect(hostname);

	    // set the timeout to 30 seconds
	    cddb.setTimeout(30*1000);

	    // try a test query
	    int[] offsets = { 150, 18130, 48615 };
	    int length = 893;
	    CDDB.Entry[] entries = cddb.query(cdid, offsets, length);

	    if (entries == null || entries.length == 0) {
		System.out.println("No match for " + cdid + ".");

	    } else {
		for (int i = 0; i < entries.length; i++) {
		    System.out.println("Match " + entries[i].category + "/" +
				       entries[i].cdid + "/" +
				       entries[i].title);
		}

		CDDB.Detail detail = cddb.read(entries[0].category,
					       entries[0].cdid);
		System.out.println("Title: " + detail.title);
		for (int i = 0; i < detail.trackNames.length; i++) {
		    System.out.println(pad(i) + ": " + detail.trackNames[i]);
		}
		System.out.println("Extended data: " + detail.extendedData);
		for (int i = 0; i < detail.extendedTrackData.length; i++) {
		    System.out.println(pad(i) + ": " +
				       detail.extendedTrackData[i]);
		}
	    }

	} finally {
	    cddb.close();
	}
    }

    protected static String pad (int value)
    {
	return ((value > 9) ? "" : " ") + value;
    }

    public static void main (String[] args)
    {
	if (args.length < 1) {
	    System.err.println("Usage: CDDBTest cddbhost");
	    System.exit(-1);
	}

	try {
	    test(args[0], "1b037b03");

	} catch (CDDBException ce) {
	    System.err.println("Protocol exception: " + ce.getCode() +
			       ": " + ce.getMessage());

	} catch (Throwable t) {
	    t.printStackTrace(System.err);
	}
    }
}
{'fraction_non_alphanumeric': 0.16332304526748972, 'fraction_numerical': 0.02880658436213992, 'mean_word_length': 2.4785330948121644, 'pattern_counts': {'":': 6, '<': 11, '<?xml version=': 0, '>': 5, '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': '6541248', 'n_tokens_mistral': 1566, 'n_tokens_neox': 1349, 'n_words': 318}