01: /*
02: (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
03: [See end of file]
04: $Id: TestARPStates.java,v 1.4 2008/01/02 12:05:24 andy_seaborne Exp $
05: */
06:
07: package com.hp.hpl.jena.rdf.arp.states.test;
08:
09: import java.io.FileReader;
10: import java.io.IOException;
11: import java.io.LineNumberReader;
12: import java.util.HashMap;
13: import java.util.Map;
14:
15: import junit.framework.TestCase;
16: import junit.framework.TestSuite;
17:
18: /**
19: * @author jjc
20: */
21: public class TestARPStates extends TestCase {
22: public TestARPStates() {
23: super ();
24: }
25:
26: public static TestSuite suite() {
27: TestSuite rslt = new TestSuite();
28: rslt.setName("ARP state machine");
29: Map tests = new HashMap();
30: try {
31: LineNumberReader r = new LineNumberReader(new FileReader(
32: TestData.dataFile));
33: while (true) {
34: String line = r.readLine();
35: if (line == null)
36: return rslt;
37: int hash = line.indexOf('%');
38: line = (hash == -1 ? line : line.substring(0, hash))
39: .trim();
40: String fields[] = line.split(" *");
41: if (fields.length == 0)
42: continue;
43: TestSuite child = (TestSuite) tests.get(fields[0]);
44: if (child == null) {
45: child = new TestSuite();
46: child.setName(TestData.stateLongName(fields[0]));
47: rslt.addTest(child);
48: tests.put(fields[0], child);
49: }
50: child.addTest(TestEventList.create(line, fields));
51: }
52: } catch (IOException e) {
53: e.printStackTrace();
54: return rslt;
55: }
56: }
57: }
58:
59: /*
60: * (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP All
61: * rights reserved.
62: *
63: * Redistribution and use in source and binary forms, with or without
64: * modification, are permitted provided that the following conditions are met:
65: *
66: * 1. Redistributions of source code must retain the above copyright notice,
67: * this list of conditions and the following disclaimer.
68: *
69: * 2. Redistributions in binary form must reproduce the above copyright notice,
70: * this list of conditions and the following disclaimer in the documentation
71: * and/or other materials provided with the distribution.
72: *
73: * 3. The name of the author may not be used to endorse or promote products
74: * derived from this software without specific prior written permission.
75: *
76: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
77: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
78: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
79: * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
80: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
81: * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
82: * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
83: * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
84: * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
85: * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
86: */
|