use of org.apache.synapse.config.xml.DBReportMediatorFactory in project wso2-synapse by wso2.
the class DBReportMediatorTest method suite.
public static Test suite() {
return new TestSetup(new TestSuite(DBReportMediatorTest.class)) {
@Override
protected void setUp() throws Exception {
String baseDir = System.getProperty("basedir");
if (baseDir == null) {
baseDir = ".";
}
report = (DBReportMediator) new DBReportMediatorFactory().createMediator(createOMElement("<dblookup xmlns=\"http://ws.apache.org/ns/synapse\">\n" + " <connection>\n" + " <pool>\n" + " <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>\n" + " <url>jdbc:derby:" + baseDir + "/target/derbyDB;create=true</url>\n" + " <user>user</user>\n" + " <password>pass</password>\n" + " <property name=\"initialsize\" value=\"2\"/>\n" + " <property name=\"isolation\" value=\"Connection.TRANSACTION_SERIALIZABLE\"/>\n" + " </pool>\n" + " </connection>\n" + " <statement>\n" + " <sql>insert into audit values(?, ?, ?, ?)</sql>\n" + " <parameter expression=\"//from\" type=\"VARCHAR\"/>\n" + " <parameter expression=\"//count\" type=\"INTEGER\"/>\n" + " <parameter expression=\"//to\" type=\"VARCHAR\"/>\n" + " <parameter value=\"GOLD\" type=\"VARCHAR\"/>\n" + " </statement>\n" + "</dblookup>"), new Properties());
report.init(new Axis2SynapseEnvironment(new SynapseConfiguration()));
java.sql.Statement s = report.getDataSource().getConnection().createStatement();
try {
s.execute("drop table audit");
} catch (SQLException ignore) {
}
s.execute("create table audit(fromepr varchar(10), cnt int, toepr varchar(10), category varchar(10))");
s.close();
}
@Override
protected void tearDown() throws Exception {
}
};
}
Aggregations