|
1 | 1 | [](https://travis-ci.org/utPLSQL/utPLSQL-java-api)
|
2 | 2 | [](https://travis-ci.org/utPLSQL/utPLSQL-java-api)
|
3 | 3 |
|
4 |
| -##### Configuring the Oracle Maven Repository ##### |
| 4 | +# utPLSQL-java-api |
| 5 | +This is a collection of classes, that makes easy to access the [utPLSQL v3](https://github.com/utPLSQL/utPLSQL/) database objects using Java. |
| 6 | + |
| 7 | +* Uses [ut_runner.run](https://github.com/utPLSQL/utPLSQL/blob/develop/docs/userguide/running-unit-tests.md#ut_runnerrun-procedures) methods to execute tests. |
| 8 | +* Can gather results asynchronously from multiple reporters. |
| 9 | + |
| 10 | +## Downloading |
| 11 | +This is a Maven Library project, you can add on your Java project as a dependency. At the moment, it's not available in any public Maven repository, but you can clone it and install as a local dependency (follow the Contributing session). |
| 12 | + |
| 13 | +```xml |
| 14 | +<dependency> |
| 15 | + <groupId>org.utplsql</groupId> |
| 16 | + <artifactId>java-api</artifactId> |
| 17 | + <version>1.0-SNAPSHOT</version> |
| 18 | + <scope>compile</scope> |
| 19 | +</dependency> |
| 20 | +``` |
| 21 | + |
| 22 | +## Usage |
| 23 | + |
| 24 | +Executing tests using default parameters: |
| 25 | +```java |
| 26 | +try (Connection conn = DriverManager.getConnection(url)) { |
| 27 | + new TestRunner().run(conn); |
| 28 | +} catch (SQLException e) { |
| 29 | + e.printStackTrace(); |
| 30 | +} |
| 31 | +``` |
| 32 | + |
| 33 | +Executing tests and printing results to screen: |
| 34 | +```java |
| 35 | +try (Connection conn = DriverManager.getConnection(url)) { |
| 36 | + Reporter documentationReporter = new DocumentationReporter().init(conn); |
| 37 | + |
| 38 | + new TestRunner() |
| 39 | + .addReporter(documentationReporter) |
| 40 | + .run(conn); |
| 41 | + |
| 42 | + new OutputBuffer(documentationReporter) |
| 43 | + .printAvailable(conn, System.out); |
| 44 | +} catch (SQLException e) { |
| 45 | + e.printStackTrace(); |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +## Contributing |
| 50 | +To develop it locally, you need to setup your maven environment. |
| 51 | + |
| 52 | +### Maven Installation |
| 53 | +That's the easy part, you just need to download the Maven binaries and extract it somewhere, then put the maven/bin folder on your PATH. |
| 54 | + |
| 55 | +https://maven.apache.org/install.html |
| 56 | + |
| 57 | +*Don't forget to configure your JAVA_HOME environment variable.* |
| 58 | + |
| 59 | +### Oracle Maven Repository |
| 60 | +The library uses OJDBC Driver to connect to the database, it's added as a maven dependency. To be able to download the Oracle dependencies, you need to configure your access to Oracle's Maven Repository: |
| 61 | + |
5 | 62 | http://docs.oracle.com/middleware/1213/core/MAVEN/config_maven_repo.htm#MAVEN9010
|
6 |
| -https://blogs.oracle.com/dev2dev/entry/how_to_get_oracle_jdbc#pom |
7 | 63 |
|
8 |
| -##### IntelliJ IDEA Maven Module ##### |
9 |
| -https://www.jetbrains.com/help/idea/2017.1/maven.html |
| 64 | +*Sections 6.1 and 6.5 are the more important ones, and the only ones you need if you're using the latest Maven version.* |
| 65 | + |
| 66 | +After configuring your access to Oracle's Maven repository, you will be able to successfully build this API. |
| 67 | + |
| 68 | +```bash |
| 69 | +cd utPLSQL-java-api |
| 70 | +mvn clean package install -DskipTests |
| 71 | +``` |
| 72 | + |
| 73 | +The cmd above is ignoring unit tests because it needs a database connection with the latest utPLSQL v3 installed. Please take a look on .travis.yml and .travis folder to see how testing was configured. |
0 commit comments