Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
automated the process of creating the quickstart/distro h2 database
- Loading branch information
1 parent
3c5ddf1
commit f381f19
Showing
26 changed files
with
191 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<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/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>io.apiman</groupId> | ||
<artifactId>apiman-distro</artifactId> | ||
<version>1.0.1-SNAPSHOT</version> | ||
</parent> | ||
<artifactId>apiman-distro-db</artifactId> | ||
<name>apiman-distro-db</name> | ||
|
||
<dependencies> | ||
<!-- Project Dependencies --> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>apiman-test-common</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>apiman-manager-test-api</artifactId> | ||
</dependency> | ||
|
||
<!-- Third Party Dependencies --> | ||
<dependency> | ||
<groupId>org.apache.httpcomponents</groupId> | ||
<artifactId>httpclient</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<groupId>org.slf4j</groupId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.codehaus.jackson</groupId> | ||
<artifactId>jackson-core-asl</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.codehaus.jackson</groupId> | ||
<artifactId>jackson-mapper-asl</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
61 changes: 61 additions & 0 deletions
61
distro/db/src/test/java/io/apiman/distro/db/CreateH2DatabaseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright 2014 JBoss Inc | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.apiman.distro.db; | ||
|
||
import io.apiman.manager.test.util.AbstractTestPlanTest; | ||
|
||
import java.io.File; | ||
|
||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Unit test that creates an H2 database file by firing up the API Manager and sending a | ||
* bunch of REST requests to configure it. When this test is complete there should be a | ||
* valid H2 database located in target/classes (and thus be included in the JAR). | ||
* | ||
* @author eric.wittmann@redhat.com | ||
*/ | ||
@SuppressWarnings("nls") | ||
public class CreateH2DatabaseTest extends AbstractTestPlanTest { | ||
|
||
@BeforeClass | ||
public static void setup() throws Exception { | ||
File targetClassesDir = new File("target/classes").getAbsoluteFile(); | ||
if (!targetClassesDir.exists()) { | ||
targetClassesDir.mkdirs(); | ||
} | ||
|
||
System.out.println("------------------------------------------------"); | ||
System.out.println("Setting H2 db output path: " + targetClassesDir.toString()); | ||
System.out.println("------------------------------------------------"); | ||
|
||
System.setProperty("apiman.test.h2-output-dir", targetClassesDir.toString()); | ||
AbstractTestPlanTest.setup(); | ||
} | ||
|
||
@Test | ||
public void test() { | ||
try { | ||
System.setProperty("apiman.suite.api-username", "admin"); | ||
System.setProperty("apiman.suite.api-password", "admin"); | ||
runTestPlan("scripts/api-manager-init-testPlan.xml", CreateH2DatabaseTest.class.getClassLoader()); | ||
} finally { | ||
System.clearProperty("apiman.test.h2-output-dir"); | ||
} | ||
} | ||
|
||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions
22
distro/db/src/test/resources/data/policyDefs/04_ignoredresources-policydef.resttest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
POST /policyDefs ${apiman.suite.api-username}/${apiman.suite.api-password} | ||
Content-Type: application/json | ||
|
||
{ | ||
"name" : "Ignored Resources Policy", | ||
"description" : "Requests satisfying the provided regular expression will be ignored.", | ||
"policyImpl" : "class:io.apiman.gateway.engine.policies.IgnoredResourcesPolicy", | ||
"icon" : "eye-slash", | ||
"templates" : [ | ||
{ | ||
"language" : null, | ||
"template" : "Requests matching any of the @{pathsToIgnore.size()} regular expressions provided will receive a 404 error code." | ||
} | ||
] | ||
} | ||
---- | ||
200 | ||
Content-Type: application/json | ||
|
||
{ | ||
"id" : "IgnoredResourcesPolicy" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
|
||
<modules> | ||
<module>data</module> | ||
<module>db</module> | ||
<module>wildfly8</module> | ||
</modules> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file removed
BIN
-2.01 MB
distro/wildfly8/src/main/resources/overlay/standalone/data/h2/apiman-manager-api.h2.db
Binary file not shown.
4 changes: 0 additions & 4 deletions
4
distro/wildfly8/src/main/resources/overlay/standalone/data/h2/apiman-manager-api.lock.db
This file was deleted.
Oops, something went wrong.
89 changes: 0 additions & 89 deletions
89
distro/wildfly8/src/main/resources/overlay/standalone/data/h2/apiman-manager-api.trace.db
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.