Made runner configurable
This commit is contained in:
10
.classpath
10
.classpath
@@ -6,22 +6,12 @@
|
|||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
|
|
||||||
<attributes>
|
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"java.configuration.updateBuildConfiguration": "interactive"
|
||||||
|
}
|
46
pom.xml
46
pom.xml
@@ -1,12 +1,12 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
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/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>at.compax.tools</groupId>
|
<groupId>at.compax.tools</groupId>
|
||||||
<artifactId>frog-runner</artifactId>
|
<artifactId>frog-runner</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|
||||||
<!-- PLUGINS -->
|
<!-- PLUGINS -->
|
||||||
<compiler.plugin.version>2.3.2</compiler.plugin.version>
|
<compiler.plugin.version>2.3.2</compiler.plugin.version>
|
||||||
<surefire.version>2.9</surefire.version>
|
<surefire.version>2.9</surefire.version>
|
||||||
@@ -21,7 +21,6 @@
|
|||||||
<oracleDriver.version>11.2.0.2.0</oracleDriver.version>
|
<oracleDriver.version>11.2.0.2.0</oracleDriver.version>
|
||||||
<xmlbeans.version>2.5.0</xmlbeans.version>
|
<xmlbeans.version>2.5.0</xmlbeans.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -38,7 +37,6 @@
|
|||||||
<include>**/*Test.java</include>
|
<include>**/*Test.java</include>
|
||||||
</includes>
|
</includes>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@@ -49,9 +47,22 @@
|
|||||||
<target>1.7</target>
|
<target>1.7</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<configuration>
|
||||||
|
<descriptorRefs>
|
||||||
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
|
</descriptorRefs>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>at.compax.tools.sql.main.Main</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>oracle</groupId>
|
<groupId>oracle</groupId>
|
||||||
@@ -84,27 +95,4 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>public</id>
|
|
||||||
<url>http://nexus.int.compax.at:8081/nexus/content/groups/public/</url>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>compax</id>
|
|
||||||
<url>http://nexus.int.compax.at:8081/nexus/content/repositories/compax</url>
|
|
||||||
<releases>
|
|
||||||
</releases>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>compax-snapshot</id>
|
|
||||||
<url>http://nexus.int.compax.at:8081/nexus/content/repositories/compax-snapshot</url>
|
|
||||||
<snapshots>
|
|
||||||
</snapshots>
|
|
||||||
</repository>
|
|
||||||
<repository>
|
|
||||||
<id>compax-thirdparty</id>
|
|
||||||
<url>http://nexus.int.compax.at:8081/nexus/content/repositories/thirdparty</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
</project>
|
</project>
|
@@ -3,6 +3,7 @@ package at.compax.tools.sql.main;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.DriverManager;
|
import java.sql.DriverManager;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
@@ -94,11 +95,8 @@ public class Main {
|
|||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void runTests() {
|
||||||
BasicConfigurator.configure();
|
try {
|
||||||
LogManager.getLogger("at.compax.tools.sql.main").setLevel(Level.ALL);
|
|
||||||
LogManager.getLogger("at.compax.tools.sql").setLevel(Level.ALL);
|
|
||||||
|
|
||||||
// String stdInSql = readFromStdIn();
|
// String stdInSql = readFromStdIn();
|
||||||
|
|
||||||
@Cleanup
|
@Cleanup
|
||||||
@@ -111,5 +109,45 @@ public class Main {
|
|||||||
System.out.println(mapper.writeValueAsString(executeExampleQueryWithException(conn)));
|
System.out.println(mapper.writeValueAsString(executeExampleQueryWithException(conn)));
|
||||||
System.out.println(mapper.writeValueAsString(executeExampleQueryWithoutParameter(conn)));
|
System.out.println(mapper.writeValueAsString(executeExampleQueryWithoutParameter(conn)));
|
||||||
System.out.println(mapper.writeValueAsString(executeExampleQueryWithParameter(conn)));
|
System.out.println(mapper.writeValueAsString(executeExampleQueryWithParameter(conn)));
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
BasicConfigurator.configure();
|
||||||
|
LogManager.getLogger("at.compax.tools.sql.main").setLevel(Level.ALL);
|
||||||
|
LogManager.getLogger("at.compax.tools.sql").setLevel(Level.ALL);
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
|
if (args.length == 0) {
|
||||||
|
runTests();
|
||||||
|
} else {
|
||||||
|
if (args.length < 4)
|
||||||
|
throw new IllegalArgumentException("Arguments: Host Port sid username password");
|
||||||
|
|
||||||
|
String host = args[0];
|
||||||
|
long port = Long.parseLong(args[1]);
|
||||||
|
String sid = args[2];
|
||||||
|
String username = args[3];
|
||||||
|
String password = args[4];
|
||||||
|
|
||||||
|
@Cleanup
|
||||||
|
Connection conn = getConnection(host, port, sid, username, password);
|
||||||
|
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(System.in, Charset.forName("UTF-8")));
|
||||||
|
String line;
|
||||||
|
StringBuffer commandBuffer = new StringBuffer();
|
||||||
|
|
||||||
|
while ((line = br.readLine()) != null) {
|
||||||
|
if (!"--- END ---".equals(line)) {
|
||||||
|
commandBuffer.append(line);
|
||||||
|
} else {
|
||||||
|
System.out.println(mapper.writeValueAsString(SqlExecutor.executeQuery(conn, commandBuffer.toString())));
|
||||||
|
commandBuffer.setLength(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user