This repository has been archived by the owner on May 26, 2022. It is now read-only.
/
KnowledgeResourcesCompilationTest.java
72 lines (60 loc) · 1.9 KB
/
KnowledgeResourcesCompilationTest.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ${package};
import java.sql.SQLException;
import org.drools.mas.core.DroolsAgent;
import org.h2.tools.DeleteDbFiles;
import org.h2.tools.Server;
import org.junit.*;
import static org.junit.Assert.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
*
* @author salaboy
*/
public class KnowledgeResourcesCompilationTest {
private static Logger logger = LoggerFactory.getLogger(KnowledgeResourcesCompilationTest.class);
private Server server;
public KnowledgeResourcesCompilationTest() {
}
@BeforeClass
public static void setUpClass() throws Exception {
}
@AfterClass
public static void tearDownClass() throws Exception {
}
@Before
public void setUp() {
DeleteDbFiles.execute("~", "mydb", false);
logger.info("Staring DB for white pages ...");
try {
server = Server.createTcpServer(null).start();
} catch (SQLException ex) {
logger.error(ex.getMessage());
}
logger.info("DB for white pages started! ");
}
@After
public void tearDown() {
logger.info("Stopping DB ...");
server.stop();
logger.info("DB Stopped!");
}
/*
* Test for check that the resources provided inside this agent
* at least compile without errors. To ensure that the agent can be
* initialized correctly
*/
@Test
public void compilationTest() {
ApplicationContext context = new ClassPathXmlApplicationContext("META-INF/applicationContext.xml");
DroolsAgent agent = (DroolsAgent) context.getBean("agent");
assertNotNull(agent);
agent.dispose();
}
}