Permalink
Browse files

refactoring to support P6Spy in External drivers

  • Loading branch information...
arcuri82 committed Sep 20, 2018
1 parent 66df11a commit 58a8473d2c0acad2930d6cb50f20a914b8d7e915
@@ -26,6 +26,10 @@
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-java-instrumentation</artifactId>
</dependency>
<dependency>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-database-spy</artifactId>
</dependency>
<dependency>
@@ -56,10 +60,6 @@
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
</dependency>
<dependency>
<groupId>p6spy</groupId>
<artifactId>p6spy</artifactId>
</dependency>
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
@@ -164,11 +164,6 @@
<pattern>org.objectweb</pattern>
<shadedPattern>shaded.org.objectweb</shadedPattern>
</relocation>
<!-- Shading this one gives a few issues... -->
<!--<relocation>-->
<!--<pattern>com.p6spy</pattern>-->
<!--<shadedPattern>shaded.com.p6spy</shadedPattern>-->
<!--</relocation>-->
<relocation>
<pattern>net.sf.jsqlparser</pattern>
<shadedPattern>shaded.net.sf.jsqlparser</shadedPattern>
@@ -3,15 +3,14 @@
import org.evomaster.clientJava.clientUtil.SimpleLogger;
import org.evomaster.clientJava.controller.internal.SutController;
import org.evomaster.clientJava.controller.internal.db.StandardOutputTracker;
import org.evomaster.clientJava.databasespy.P6SpyFormatter;
import org.evomaster.clientJava.instrumentation.InstrumentingAgent;
import org.evomaster.clientJava.instrumentation.TargetInfo;
import org.evomaster.clientJava.instrumentation.db.P6SpyFormatter;
import org.evomaster.clientJava.instrumentation.external.JarAgentLocator;
import org.evomaster.clientJava.instrumentation.external.ServerController;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -1,13 +1,9 @@
package org.evomaster.clientJava.controller;
import com.ea.agentloader.AgentLoader;
import com.p6spy.engine.spy.appender.StdoutLogger;
import org.evomaster.clientJava.controller.internal.SutController;
import org.evomaster.clientJava.controller.internal.db.StandardOutputTracker;
import org.evomaster.clientJava.instrumentation.InstrumentingAgent;
import org.evomaster.clientJava.instrumentation.db.P6SpyFormatter;
import java.util.Objects;
/**
* Class responsible to handle the SutController in a way
@@ -1,7 +1,7 @@
package org.evomaster.clientJava.controller.internal.db;
import org.evomaster.clientJava.controller.internal.SutController;
import org.evomaster.clientJava.instrumentation.db.P6SpyFormatter;
import org.evomaster.clientJava.databasespy.P6SpyFormatter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -0,0 +1,35 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-java</artifactId>
<version>0.1.2-SNAPSHOT</version>
</parent>
<artifactId>evomaster-client-database-spy</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>p6spy</groupId>
<artifactId>p6spy</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
@@ -1,4 +1,4 @@
package org.evomaster.clientJava.instrumentation.db;
package org.evomaster.clientJava.databasespy;
import com.p6spy.engine.spy.appender.MessageFormattingStrategy;
@@ -25,10 +25,6 @@
<groupId>org.ow2.asm</groupId>
<artifactId>asm-util</artifactId>
</dependency>
<dependency>
<groupId>p6spy</groupId>
<artifactId>p6spy</artifactId>
</dependency>
<dependency>
@@ -81,11 +77,6 @@
<pattern>org.objectweb</pattern>
<shadedPattern>shaded.org.objectweb</shadedPattern>
</relocation>
<!-- Shading this one gives a few issues... -->
<!--<relocation>-->
<!--<pattern>com.p6spy</pattern>-->
<!--<shadedPattern>shaded.com.p6spy</shadedPattern>-->
<!--</relocation>-->
</relocations>
</configuration>
</execution>
@@ -1,13 +1,10 @@
package org.evomaster.clientJava.instrumentation;
import com.p6spy.engine.spy.appender.StdoutLogger;
import org.evomaster.clientJava.clientUtil.SimpleLogger;
import org.evomaster.clientJava.instrumentation.db.P6SpyFormatter;
import org.evomaster.clientJava.instrumentation.external.AgentController;
import org.evomaster.clientJava.instrumentation.staticState.ObjectiveRecorder;
import org.objectweb.asm.ClassReader;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.instrument.ClassFileTransformer;
@@ -123,13 +120,19 @@ public static void initP6Spy(String driver) {
Objects.requireNonNull(driver);
//see http://p6spy.readthedocs.io/en/latest/configandusage.html
System.setProperty("p6spy.config.logMessageFormat", P6SpyFormatter.class.getName());
System.setProperty("p6spy.config.driverlist", driver);
System.setProperty("p6spy.config.filter", "true");
System.setProperty("p6spy.config.include", "select, insert, update, delete");
System.setProperty("p6spy.config.autoflush", "true");
System.setProperty("p6spy.config.appender", StdoutLogger.class.getName());
System.setProperty("p6spy.config.appender", "com.p6spy.engine.spy.appender.StdoutLogger");
System.setProperty("p6spy.config.jmx", "false");
/*
Note: this is a reference to a class in another module, although
this module does NOT (and should not) reference it.
Long story... see documentation on how P6Spy is used in EM.
*/
System.setProperty("p6spy.config.logMessageFormat", "org.evomaster.clientJava.databasespy.P6SpyFormatter");
}
View
@@ -17,6 +17,7 @@
<module>controller-api</module>
<module>instrumentation</module>
<module>client-util</module>
<module>database-spy</module>
</modules>
<dependencyManagement>
View
@@ -133,6 +133,11 @@
<artifactId>evomaster-client-java-controller-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-database-spy</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.evomaster</groupId>
<artifactId>evomaster-client-java-instrumentation</artifactId>

0 comments on commit 58a8473

Please sign in to comment.