diff --git a/README.md b/README.md
index fe2567cc..036b7010 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,7 @@ Configure Maven to use JBoss Nexus repository. Follow the steps at https://devel
1. Create a database (e.g. named `perfrepo`)
2. Script `db_schema_creation.sql` in `model/src/main/sql` creates all necessary tables and structures
+3. You should run `migration_*.sql` ignoring the errors
## Set up the application server
@@ -65,6 +66,27 @@ Following text assumes PostgreSQL installed on localhost and WildFly's `standalo
...(described above)...
```
+```bash
+cd /path/wildfly
+mkdir -p modules/org/postgres/main
+cd modules/org/postgres/main
+wget https://jdbc.postgresql.org/download/postgresql-8.4-703.jdbc4.jar
+```
+
+```xml
+
+
+
+
+
+
+
+
+
+
+
+```
+
* Add security domain `perfrepo`, e.g.
```xml
@@ -112,25 +134,53 @@ Older JAAS/PicketLink configuration can be still used, but you have to place it
Integration tests uses Arquillian WildFly remote container, which means you have to have WidlFly running on your test machine and listening on default ports.
Also you have to add test datasource `PerfRepoTestDS`into the WildFly, ideally pointing to test DB, e.g.
```xml
-
- jdbc:postgresql://localhost:5432/perfrepotest
- org.postgresql.Driver
- postgresql
-
- perfrepo
- perfrepo
-
-
+
+ jdbc:postgresql://localhost:5432/perfrepotest
+ org.postgresql.Driver
+ postgresql
+
+ perfrepo
+ perfrepo
+
+
```
For testing session bean, authentication is require and thus you have to also add appropriate security domain:
```xml
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+```
+
+# Deploy PerfRepo database with docker
+
+```bash
+mkdir -p $HOME/docker/volumes/postgres
+docker run --rm --name perfrepo-db -e POSTGRES_PASSWORD=docker -d -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data postgres:8.4
```
+
+```bash
+docker container ls
+```
+
+```
+CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
+a77fcc604dfa postgres:8.4 "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 0.0.0.0:5432->5432/tcp perfrepo-db
+```
+
+```bash
+docker exec -i -t a77fcc604dfa /bin/bash
+psql -h localhost -U postgres -d postgres
+
+postgres=# create database perfrepotest;
+CREATE DATABASE
+postgres=# create user perfrepo with encrypted password 'perfrepo';
+CREATE ROLE
+postgres=# grant all privileges on database perfrepotest to perfrepo;
+GRANT
+```
\ No newline at end of file
diff --git a/client/src/test/java/org/perfrepo/client/test/ClientTest.java b/client/src/test/java/org/perfrepo/client/test/ClientTest.java
index 30a80a70..70bf866e 100644
--- a/client/src/test/java/org/perfrepo/client/test/ClientTest.java
+++ b/client/src/test/java/org/perfrepo/client/test/ClientTest.java
@@ -68,8 +68,8 @@ public static Archive> createDeployment() {
war.delete(ArchivePaths.create("WEB-INF/classes/META-INF/persistence.xml"));
war.delete(ArchivePaths.create("WEB-INF/jboss-web.xml"));
- war.add(new FileAsset(new File("target/test-classes/test-persistence.xml")), ArchivePaths.create("WEB-INF/classes/META-INF/persistence.xml"));
- war.add(new FileAsset(new File("target/test-classes/test-jboss-web.xml")), ArchivePaths.create("WEB-INF/jboss-web.xml"));
+ war.add(new FileAsset(new File(ClientTest.class.getResource("/test-persistence.xml").getFile())), ArchivePaths.create("WEB-INF/classes/META-INF/persistence.xml"));
+ war.add(new FileAsset(new File(ClientTest.class.getResource("/test-jboss-web.xml").getFile())), ArchivePaths.create("WEB-INF/jboss-web.xml"));
return war;
}
@@ -82,8 +82,10 @@ public static void createClient() {
@AfterClass
public static void destroyClient() {
- client.shutdown();
- client = null;
+ if (client != null) {
+ client.shutdown();
+ client = null;
+ }
}
@org.junit.Test
@@ -180,6 +182,7 @@ public void testCreateInvalidMultivalueTestExecution() throws Exception {
client.deleteTest(testId);
}
+ @Ignore("https://github.com/PerfCake/PerfRepo/issues/95")
@org.junit.Test
public void testUpdateTestExecution() throws Exception {
Test test = createTest();
diff --git a/web/src/main/java/org/perfrepo/web/alerting/ConditionCheckerImpl.java b/web/src/main/java/org/perfrepo/web/alerting/ConditionCheckerImpl.java
index 1173ed22..108d4157 100644
--- a/web/src/main/java/org/perfrepo/web/alerting/ConditionCheckerImpl.java
+++ b/web/src/main/java/org/perfrepo/web/alerting/ConditionCheckerImpl.java
@@ -53,6 +53,8 @@ public class ConditionCheckerImpl implements ConditionChecker {
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm");
+ private static final ScriptEngine JAVA_SCRIPT_ENGINE = new ScriptEngineManager(null).getEngineByName("JavaScript");
+
@Inject
private TestExecutionDAO testExecutionDAO;
@@ -82,7 +84,7 @@ public class ConditionCheckerImpl implements ConditionChecker {
public void checkConditionSyntax(String condition, Metric metric) {
// creates dummy execution and triggers evaluation against it
// if we had a 'perfect' grammar, we would only need to call parseTree(condition);
- // but ATM we need script engine to evaluate CONDITION and tell us if there were any errors
+ // but ATM we need script JAVA_SCRIPT_ENGINE to evaluate CONDITION and tell us if there were any errors
// e.g. current grammar cannot catch nonsenses such as: CONDITION x variables) {
- ScriptEngine engine = new ScriptEngineManager().getEngineByName("JavaScript");
Object result;
try {
- result = engine.eval(expression, new SimpleBindings(variables));
+ result = JAVA_SCRIPT_ENGINE.eval(expression, new SimpleBindings(variables));
} catch (ScriptException e) {
throw new IllegalArgumentException("Error occurred while evaluating the expression.", e);
}
@@ -485,12 +486,12 @@ private Double getValueFromMetric(TestExecution testExecution) {
private CommonTree parseTree(String string) {
//lexer splits input into tokens
ANTLRStringStream input = new ANTLRStringStream(string);
- TokenStream tokens = new CommonTokenStream(new AlertingDSLLexer(input));
+ TokenStream tokens = new CommonTokenStream(new org.perfrepo.web.alerting.AlertingDSLLexer(input));
//parser generates abstract syntax tree
- AlertingDSLParser parser = new AlertingDSLParser(tokens);
+ org.perfrepo.web.alerting.AlertingDSLParser parser = new org.perfrepo.web.alerting.AlertingDSLParser(tokens);
- AlertingDSLParser.expression_return ret;
+ org.perfrepo.web.alerting.AlertingDSLParser.expression_return ret;
try {
ret = parser.expression();
} catch (RecognitionException ex) {
diff --git a/web/src/test/java/org/perfrepo/test/TestServiceBeanTest.java b/web/src/test/java/org/perfrepo/test/TestServiceBeanTest.java
index 83334a3f..7f1679e3 100644
--- a/web/src/test/java/org/perfrepo/test/TestServiceBeanTest.java
+++ b/web/src/test/java/org/perfrepo/test/TestServiceBeanTest.java
@@ -72,6 +72,10 @@ public class TestServiceBeanTest {
@Deployment
public static Archive> createDeployment() {
+
+ File testClassFolder = new File(TestServiceBeanTest.class.getResource("/.").getFile());
+ File testLibsFolder = new File(testClassFolder.getParentFile(), "test-libs");
+
WebArchive war = ShrinkWrap.create(WebArchive.class, "test.war");
war.addPackages(true, Alert.class.getPackage());
war.addPackages(true, TestService.class.getPackage());
@@ -83,8 +87,8 @@ public static Archive> createDeployment() {
war.addPackage(MultiValue.class.getPackage());
war.addPackage(DAO.class.getPackage());
war.addPackages(true, Alert.class.getPackage());
- war.addAsLibrary(new File("target/test-libs/antlr-runtime.jar"));
- war.addAsLibrary(new File("target/test-libs/maven-artifact.jar"));
+ war.addAsLibrary(new File(testLibsFolder,"antlr-runtime.jar"));
+ war.addAsLibrary(new File(testLibsFolder, "maven-artifact.jar"));
war.addAsResource("test-persistence.xml", "META-INF/persistence.xml");
war.addAsResource("users.properties");
war.addAsResource("roles.properties");