Revision 310

tmp/org.txm.core.tests/src/org/txm/core/tests/ToolboxTester.java (revision 310)
1
/**
2
 * 
3
 */
4
package org.txm.core.tests;
5

  
6
import org.txm.Toolbox;
7

  
8
/**
9
 * Toolbox standalone tests.
10
 * @author sjacquot
11
 *
12
 */
13
public class ToolboxTester {
14

  
15
	/**
16
	 * 
17
	 */
18
	public ToolboxTester() {
19
		// TODO Auto-generated constructor stub
20
	}
21

  
22
	/**
23
	 * 
24
	 * @param args
25
	 */
26
	public static void main(String[] args) {
27
		
28
		System.out.println("ToolboxTester.main(): Java version = " + System.getProperty("sun.arch.data.model"));
29
		
30
		try {
31
			Toolbox.initialize();
32
		}
33
		catch(Exception e) {
34
			// TODO Auto-generated catch block
35
			e.printStackTrace();
36
		}
37
	}
38

  
39
}
tmp/org.txm.core.tests/src/org/txm/core/tests/junit/PairTest.java (revision 310)
1
package org.txm.core.tests.junit;
2

  
3

  
4
import static org.junit.Assert.*;
5

  
6
import org.junit.After;
7
import org.junit.Before;
8
import org.junit.Test;
9
import org.txm.utils.Pair;
10

  
11
public class PairTest {
12

  
13
	Pair p;
14
	
15
	@Before
16
	public void setUp() throws Exception {
17
		
18
		this.p = new Pair<String, String>("12", "50");
19
	}
20

  
21
	@After
22
	public void tearDown() throws Exception {
23
	}
24

  
25
	@Test
26
	public void testHashCode() {
27
		fail("Not yet implemented"); // TODO
28
	}
29

  
30
	@Test
31
	public void testPair() {
32
		fail("Not yet implemented"); // TODO
33
	}
34

  
35
	@Test
36
	public void testSame() {
37
		fail("Not yet implemented"); // TODO
38
	}
39

  
40
	@Test
41
	public void testGetFirst() {
42
		assertEquals("12", p.getFirst());
43
	}
44

  
45
	@Test
46
	public void testGetSecond() {
47
		fail("Not yet implemented"); // TODO
48
	}
49

  
50
	@Test
51
	public void testSetFirst() {
52
		fail("Not yet implemented"); // TODO
53
	}
54

  
55
	@Test
56
	public void testSetSecond() {
57
		fail("Not yet implemented"); // TODO
58
	}
59

  
60
	@Test
61
	public void testEqualsObject() {
62
		fail("Not yet implemented"); // TODO
63
	}
64

  
65
	@Test
66
	public void testToString() {
67
		fail("Not yet implemented"); // TODO
68
	}
69

  
70
	@Test
71
	public void testMain() {
72
		fail("Not yet implemented"); // TODO
73
	}
74

  
75
}
0 76

  
tmp/org.txm.core.tests/src/org/txm/core/tests/manual/ToolBoxTesterWithoutApplication.java (revision 310)
1
package org.txm.core.tests.manual;
2

  
3
import java.util.ServiceLoader;
4

  
5
import org.eclipse.core.internal.runtime.InternalPlatform;
6
import org.osgi.framework.BundleContext;
7
import org.osgi.framework.BundleException;
8
import org.osgi.framework.InvalidSyntaxException;
9
import org.osgi.framework.launch.Framework;
10
import org.osgi.framework.launch.FrameworkFactory;
11
import org.osgi.util.tracker.ServiceTracker;
12
import org.txm.Toolbox;
13

  
14
public class ToolBoxTesterWithoutApplication {
15

  
16
	public ToolBoxTesterWithoutApplication() {
17
		// TODO Auto-generated constructor stub
18
	}
19

  
20
	/**
21
	 * 
22
	 * @param args
23
	 */
24
	public static void main(String[] args) {
25

  
26
		// tests
27

  
28
		// Load the framwork factory
29
//		try {
30
//			ServiceLoader loader = ServiceLoader.load(FrameworkFactory.class);
31
//
32
//			FrameworkFactory factory = (FrameworkFactory) loader.iterator().next();
33
//
34
//			// Create a new instance of the framework
35
//			Framework framework = factory.newFramework(null);
36
//			framework.init();
37
//			framework.start();
38
//			BundleContext bc = framework.getBundleContext();
39
//
40
//			ServiceTracker serviceTaskTracker = new ServiceTracker(bc, bc.createFilter("(objectClass=*ServiceTasks)"), null);
41
//
42
//			InternalPlatform.getDefault().start(bc);
43
//			System.out.println("CONTEXT: " + bc);
44
//			// Activator.getDefault().start(bc);
45
//		}
46
//		catch(BundleException e1) {
47
//			// TODO Auto-generated catch block
48
//			e1.printStackTrace();
49
//		}
50
//		catch(InvalidSyntaxException e1) {
51
//			// TODO Auto-generated catch block
52
//			e1.printStackTrace();
53
//		}
54

  
55
		try {
56
			Toolbox.initialize();
57
		}
58
		catch(Exception e) {
59
			// TODO Auto-generated catch block
60
			e.printStackTrace();
61
		}
62
	}
63
}
0 64

  
tmp/org.txm.core.tests/src/org/txm/core/tests/manual/ToolBoxTesterRCPApplication.java (revision 310)
1
/**
2
 * 
3
 */
4
package org.txm.core.tests.manual;
5

  
6
import org.apache.tools.ant.taskdefs.Sleep;
7
import org.eclipse.core.internal.preferences.RootPreferences;
8
import org.eclipse.equinox.app.IApplication;
9
import org.eclipse.equinox.app.IApplicationContext;
10
import org.txm.Toolbox;
11
import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
12
import org.txm.searchengine.cqp.corpus.CorpusManager;
13
import org.txm.searchengine.cqp.corpus.MainCorpus;
14
import org.txm.searchengine.cqp.corpus.Property;
15
import org.txm.searchengine.cqp.corpus.StructuralUnit;
16
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
17
import org.txm.statsengine.r.core.preferences.RPreferences;
18

  
19
/**
20
 * 
21
 * Toolbox standalone tests.
22
 * @author sjacquot
23
 *
24
 */
25
public class ToolBoxTesterRCPApplication implements IApplication {
26

  
27
	/**
28
	 * 
29
	 */
30
	public ToolBoxTesterRCPApplication() {
31
		// TODO Auto-generated constructor stub
32
	}
33

  
34
	/*
35
	 * (non-Javadoc)
36
	 * 
37
	 * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.
38
	 * IApplicationContext)
39
	 */
40
	@Override
41
	public Object start(IApplicationContext context) throws Exception {
42
//		System.out.println("Hello RCP World!");
43
//		final Map<?, ?> args = context.getArguments();
44
//		final String[] appArgs = (String[]) args.get("application.args");
45
//		for(final String arg : appArgs) {
46
//			System.out.println(arg);
47
//		}
48

  
49
		//FIXME: tests to retrieve PREFERENCE_NODE static field from the subclasses
50
//		System.err.println("ToolBoxTesterApplication.start() runtime node qualifier = " + RPreferences.getNodeQualifier());
51
//		System.err.println("ToolBoxTesterApplication.start(): " + RPreferences.getString(RPreferences.PATH_TO_EXECUTABLE));
52

  
53
		
54
		
55
		System.out.println("ToolBoxTesterApplication.start(): Java version = " + System.getProperty("sun.arch.data.model"));
56
		
57
		try {
58
			Toolbox.initialize();
59
			
60
			
61
			//FIXME: tests
62
			MainCorpus corpus = CorpusManager.getCorpusManager().getCorpus("BROWN");
63
			try {
64
				corpus.getStructuralUnit("text");
65
			}
66
			catch(Exception testE) {
67
				System.err.println("Can't continue, the BROWN corpus is missing");
68
				System.err.println("You can download it at https://sourceforge.net/projects/txm/files/corpora/brown/");
69
				return -1;
70
			}
71
			StructuralUnit textUnit = corpus.getStructuralUnit("text");
72
			StructuralUnitProperty text_type = textUnit.getProperty("type");
73
			StructuralUnitProperty text_id = textUnit.getProperty("id");
74
			StructuralUnit sUnit = corpus.getStructuralUnit("s");
75
			Property word = corpus.getProperty("word");
76
			Property enpos = corpus.getProperty("enpos");
77
			Property enlemma = corpus.getProperty("enlemma");
78

  
79
			// Lexicon
80
			System.out.println("**************************************************");
81
			System.out.println("** Lexicon tests");
82
			System.out.println("**************************************************");
83
			Lexicon lex1 = corpus.getLexicon(word);
84
			System.out.println("Details: " + lex1.getDetails());
85
			
86
			//FIXME: end of tests
87
			
88
		}
89
		catch(Exception e) {
90
			// TODO Auto-generated catch block
91
			e.printStackTrace();
92
		}
93
		
94
		return IApplication.EXIT_OK;
95
	}
96

  
97
	/*
98
	 * (non-Javadoc)
99
	 * 
100
	 * @see org.eclipse.equinox.app.IApplication#stop()
101
	 */
102
	@Override
103
	public void stop() {
104
		// TODO Auto-generated method stub
105

  
106
	}
107

  
108
}
0 109

  
tmp/org.txm.core.tests/build.properties (revision 310)
1 1
source.. = src/
2 2
output.. = bin/
3 3
bin.includes = META-INF/,\
4
               .
4
               .,\
5
               plugin.xml
tmp/org.txm.core.tests/plugin.xml (revision 310)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<?eclipse version="3.4"?>
3
<plugin>
4
   <extension
5
         id="id1"
6
         name="ToolboxTester"
7
         point="org.eclipse.core.runtime.applications">
8
      <application
9
            cardinality="singleton-global"
10
            thread="main"
11
            visible="true">
12
         <run
13
               class="org.txm.core.tests.manual.ToolBoxTesterRCPApplication">
14
         </run>
15
      </application>
16
   </extension>
17

  
18
</plugin>
0 19

  
tmp/org.txm.core.tests/META-INF/MANIFEST.MF (revision 310)
1 1
Manifest-Version: 1.0
2 2
Bundle-ManifestVersion: 2
3 3
Bundle-Name: Core Toolbox Tests
4
Bundle-SymbolicName: org.txm.core.tests
4
Bundle-SymbolicName: org.txm.core.tests;singleton:=true
5 5
Bundle-Version: 1.0.0.qualifier
6 6
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
7
Require-Bundle: org.txm.core;bundle-version="0.7.0",
8
 CQP;bundle-version="1.1.0"
7
Require-Bundle: org.txm.lexicon.core,
8
 org.eclipse.core.runtime;bundle-version="3.10.0",
9
 org.txm.core;bundle-version="0.7.0",
10
 CQP;bundle-version="1.1.0",
11
 org.txm.statsengine.r.core

Also available in: Unified diff