Skip to content

Commit 40c820a

Browse files
authored
Merge pull request #37 from UCSDOalads/refineAntForContinuousIntegration
Refine ant for continuous integration
2 parents b5815e6 + 9561257 commit 40c820a

6 files changed

Lines changed: 90 additions & 3 deletions

File tree

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: java
2+
jdk:
3+
- oraclejdk8
4+
5+
before_script:
6+
- "export DISPLAY=:99.0"
7+
- "sh -e /etc/init.d/xvfb start"
8+
- sleep 3 # give xvfb some time to start

build.xml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<project name="JavaSketchPad" default="run" basedir=".">
2+
<property name="build.dir" location="ant_build" />
3+
<property name="src.dir" location="src" />
4+
5+
<target name="init" description="Creating directory">
6+
<mkdir dir="${build.dir}" />
7+
</target>
8+
9+
<target name="compile" depends="init" description="Compiling Sources">
10+
<javac srcdir="${src.dir}" destdir="${build.dir}" includeantruntime="false">
11+
<classpath refid="classpath.test" />
12+
</javac>
13+
</target>
14+
15+
<target name="run" depends="compile" description="Running the program">
16+
</target>
17+
18+
<target name="clean">
19+
<delete dir="${build.dir}" />
20+
</target>
21+
22+
23+
<path id="classpath.test">
24+
<pathelement location="lib/junit-4.12.jar" />
25+
<pathelement location="lib/hamcrest-core-1.3.jar" />
26+
<pathelement location="${build.dir}" />
27+
</path>
28+
29+
30+
<target name="test" depends="compile">
31+
<junit printsummary="on" haltonfailure="yes" fork="true">
32+
<classpath>
33+
<path refid="classpath.test" />
34+
<pathelement location="${test.build.dir}" />
35+
</classpath>
36+
<formatter type="brief" usefile="false" />
37+
<batchtest>
38+
<fileset dir="${src.dir}" includes="**/*Test.java" />
39+
</batchtest>
40+
</junit>
41+
</target>
42+
</project>

lib/hamcrest-core-1.3.jar

44 KB
Binary file not shown.

lib/junit-4.12.jar

308 KB
Binary file not shown.

src/ui/helper/classsearch/ClassSearchFrameTest.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class ClassSearchFrameTest {
1212

1313
@Test
1414
public void test() throws InterruptedException {
15-
SwingUtilities.invokeLater(new Runnable() {
15+
Runnable t = (new Runnable() {
1616

1717
@Override
1818
public void run() {
@@ -29,10 +29,29 @@ public void didSelectClass(String classname) {
2929
classSearchFrame.setVisible(true);
3030
classSearchFrame.setSize(new Dimension(300, 200));
3131

32+
/* Comment below to test the framework */
33+
/* Added for the purpose of continuous integration */
34+
new Thread(new Runnable() {
35+
36+
@Override
37+
public void run() {
38+
try {
39+
Thread.sleep(5000);
40+
classSearchFrame.setVisible(false);
41+
classSearchFrame.dispose();
42+
} catch (InterruptedException e) {
43+
e.printStackTrace();
44+
}
45+
46+
}
47+
}).start();
3248

3349
}
3450
});
35-
Thread.sleep(Long.MAX_VALUE);
51+
SwingUtilities.invokeLater(t);
52+
Thread.sleep(10000);
53+
54+
3655
}
3756

3857
}

src/ui/helper/historyui/HistoryUITest.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,27 @@ public void didPressButton(String buttonName, int selectedRow) {
4444
historyUI.setSize(new Dimension(300, 200));
4545

4646

47+
/* Comment below to test the framework */
48+
/* Added for the purpose of continuous integration */
49+
new Thread(new Runnable() {
50+
51+
@Override
52+
public void run() {
53+
54+
try {
55+
Thread.sleep(5000);
56+
historyUI.dispose();
57+
} catch (InterruptedException e) {
58+
e.printStackTrace();
59+
}
60+
}
61+
}).start();
62+
63+
64+
4765
}
4866
});
49-
Thread.sleep(Long.MAX_VALUE);
67+
Thread.sleep(10000);
5068
}
5169

5270

0 commit comments

Comments
 (0)