-
Notifications
You must be signed in to change notification settings - Fork 2
/
ScriptTest.java
51 lines (43 loc) · 1.61 KB
/
ScriptTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package com.bm.model.server.conf;
import java.util.Properties;
import org.apache.log4j.PropertyConfigurator;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import com.bm.model.shared.conf.TileConf;
public class ScriptTest {
@Before
public void initLog4j() {
Properties props = new Properties();
props.put("log4j.rootLogger", "DEBUG, A1");
props.put("log4j.appender.A1", "org.apache.log4j.ConsoleAppender");
props.put("log4j.appender.A1.layout", "org.apache.log4j.PatternLayout");
props.put("log4j.appender.A1.layout.ConversionPattern", "%d [%t] %-5p %c - %m%n");
PropertyConfigurator.configure(props);
}
public void basicAssert(TileConf conf) {
Assert.assertEquals(0, conf.getContext().errors.size());
Assert.assertEquals(68, conf.tiles.size());
Assert.assertEquals(13, conf.items.size());
Assert.assertEquals(12, conf.groups.size());
Assert.assertEquals(18, conf.changes.size());
Assert.assertEquals(16, conf.slots.size());
}
@Test
public void testRhino() {
TileConf conf = new ScriptRunner().readTileConf("JavaScript", "conf/tiles.js");
basicAssert(conf);
}
@Test
public void testGroovy() {
TileConf conf = new ScriptRunner().readTileConf("groovy", "conf/tiles.groovy");
basicAssert(conf);
System.out.println(conf.dumpString());
}
@Test
public void testRuby() {
TileConf conf = new ScriptRunner().readTileConf("ruby", "conf/tiles.ruby");
basicAssert(conf);
System.out.println(conf.dumpString());
}
}