Skip to content

Commit c5c433f

Browse files
committed
open source!
0 parents  commit c5c433f

File tree

219 files changed

+35033
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+35033
-0
lines changed

.gitignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
*.class
2+
3+
# Mobile Tools for Java (J2ME)
4+
.mtj.tmp/
5+
6+
# Package Files #
7+
*.jar
8+
*.war
9+
*.ear
10+
*.h2.db
11+
.idea
12+
*.iml
13+
libs/*.jar
14+
15+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
16+
hs_err_pid*
17+
18+
plsql/src/test/resources/test_sysdba.properties
19+
plsql/src/test/resources/test_schema.properties
20+
21+
*.iml
22+
23+
doc/build/*
24+
25+
.idea
26+
27+

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2010-2015 QAMatic
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[![Build Status](https://travis-ci.org/senips/mintleaf.svg?branch=master)](https://travis-ci.org/senips/mintleaf)
2+
3+
![logo](https://github.com/qamatic/mintleaf/blob/master/doc/source/images/logosimple.png)
4+
Welcome to the Mintleaf! Mintleaf is a light weight framework tool helps you to advance your database developement on continuous integration / continuous delivery model as easy as possible.
5+
6+
7+
- Database Migration (either from command line or programatic approach)
8+
- Ability to write automated tests and run them on migrated database schemas, objects, data integrity checks during CI/CD
9+
- Seamless Test life cycle management such as setup, teardown mock data, schema and database objects using changesets
10+
- Create mock data or transfer/copy data between databases for your tests
11+
- Nothing more but to use Plain old SQL that you know of
12+
13+
## Documentation
14+
15+
- [Documentation](https://qamatic.github.io/mintleaf/)
16+
17+
## Maven
18+
<dependency>
19+
<groupId>org.qamatic</groupId>
20+
<artifactId>mintleaf-core</artifactId>
21+
<version>1.8.15</version>
22+
</dependency>
23+
24+
## License
25+
26+
The MIT License (MIT)
27+
28+
Copyright (c) 2010-2015 QAMatic
29+
30+
Permission is hereby granted, free of charge, to any person obtaining a copy
31+
of this software and associated documentation files (the "Software"), to deal
32+
in the Software without restriction, including without limitation the rights
33+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
34+
copies of the Software, and to permit persons to whom the Software is
35+
furnished to do so, subject to the following conditions:
36+
37+
The above copyright notice and this permission notice shall be included in all
38+
copies or substantial portions of the Software.
39+
40+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
41+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
42+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
43+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
44+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
45+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
46+
SOFTWARE.
47+

cmd/dependency-reduced-pom.xml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<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">
3+
<parent>
4+
<artifactId>mintleaf</artifactId>
5+
<groupId>org.qamatic</groupId>
6+
<version>1.8.16-SNAPSHOT</version>
7+
</parent>
8+
<modelVersion>4.0.0</modelVersion>
9+
<artifactId>mintleaf-cmd</artifactId>
10+
<version>1.8.16-SNAPSHOT</version>
11+
<build>
12+
<plugins>
13+
<plugin>
14+
<artifactId>maven-shade-plugin</artifactId>
15+
<version>3.0.0</version>
16+
<executions>
17+
<execution>
18+
<phase>package</phase>
19+
<goals>
20+
<goal>shade</goal>
21+
</goals>
22+
<configuration>
23+
<minimizeJar>true</minimizeJar>
24+
<transformers>
25+
<transformer>
26+
<manifestEntries>
27+
<Main-Class>org.qamatic.mintleaf.MainCli</Main-Class>
28+
<Build-Number>1.14</Build-Number>
29+
</manifestEntries>
30+
</transformer>
31+
</transformers>
32+
</configuration>
33+
</execution>
34+
</executions>
35+
</plugin>
36+
</plugins>
37+
</build>
38+
<dependencies>
39+
<dependency>
40+
<groupId>junit</groupId>
41+
<artifactId>junit</artifactId>
42+
<version>4.12</version>
43+
<scope>test</scope>
44+
<exclusions>
45+
<exclusion>
46+
<artifactId>hamcrest-core</artifactId>
47+
<groupId>org.hamcrest</groupId>
48+
</exclusion>
49+
</exclusions>
50+
</dependency>
51+
</dependencies>
52+
</project>
53+

cmd/pom.xml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
4+
<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">
5+
<parent>
6+
<artifactId>mintleaf</artifactId>
7+
<groupId>org.qamatic</groupId>
8+
<version>1.8.16-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>mintleaf-cmd</artifactId>
13+
<version>1.8.16-SNAPSHOT</version>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>org.qamatic</groupId>
18+
<artifactId>mintleaf-core</artifactId>
19+
<version>1.8.16-SNAPSHOT</version>
20+
</dependency>
21+
<dependency>
22+
<groupId>commons-cli</groupId>
23+
<artifactId>commons-cli</artifactId>
24+
</dependency>
25+
26+
<dependency>
27+
<groupId>junit</groupId>
28+
<artifactId>junit</artifactId>
29+
<scope>test</scope>
30+
</dependency>
31+
32+
</dependencies>
33+
<build>
34+
35+
<plugins>
36+
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-shade-plugin</artifactId>
40+
<version>3.0.0</version>
41+
<executions>
42+
<execution>
43+
<phase>package</phase>
44+
<goals>
45+
<goal>shade</goal>
46+
</goals>
47+
<configuration>
48+
<minimizeJar>true</minimizeJar>
49+
<transformers>
50+
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
51+
<manifestEntries>
52+
<Main-Class>org.qamatic.mintleaf.MainCli</Main-Class>
53+
<Build-Number>1.14</Build-Number>
54+
</manifestEntries>
55+
</transformer>
56+
</transformers>
57+
</configuration>
58+
</execution>
59+
</executions>
60+
</plugin>
61+
62+
</plugins>
63+
64+
</build>
65+
</project>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
*
3+
* *
4+
* * * <!--
5+
* * * ~
6+
* * * ~ The MIT License (MIT)
7+
* * * ~
8+
* * * ~ Copyright (c) 2010-2017 QAMatic
9+
* * * ~
10+
* * * ~ Permission is hereby granted, free of charge, to any person obtaining a copy
11+
* * * ~ of this software and associated documentation files (the "Software"), to deal
12+
* * * ~ in the Software without restriction, including without limitation the rights
13+
* * * ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
* * * ~ copies of the Software, and to permit persons to whom the Software is
15+
* * * ~ furnished to do so, subject to the following conditions:
16+
* * * ~
17+
* * * ~ The above copyright notice and this permission notice shall be included in all
18+
* * * ~ copies or substantial portions of the Software.
19+
* * * ~
20+
* * * ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
* * * ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
* * * ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
* * * ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
* * * ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
* * * ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26+
* * * ~ SOFTWARE.
27+
* * * ~
28+
* * * ~
29+
* * * -->
30+
* *
31+
* *
32+
*
33+
*/
34+
35+
package org.qamatic.mintleaf;
36+
37+
import org.apache.commons.cli.*;
38+
39+
/**
40+
* Created by senips on 2/18/6/16.
41+
*/
42+
public class MainCli {
43+
44+
public static void main(String[] args) {
45+
CommandLineParser parser = new DefaultParser();
46+
47+
Options options = new Options();
48+
options.addOption("help", "help", false, "usage");
49+
50+
51+
try {
52+
// parse the command line arguments
53+
CommandLine line = parser.parse(options, args);
54+
if (args.length == 0) {
55+
HelpFormatter formatter = new HelpFormatter();
56+
formatter.printHelp("mintleaf", options);
57+
System.exit(0);
58+
}
59+
60+
} catch (ParseException exp) {
61+
System.out.println("Unexpected exception:" + exp.getMessage());
62+
System.exit(-1);
63+
}
64+
}
65+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
*
3+
* *
4+
* * * <!--
5+
* * * ~
6+
* * * ~ The MIT License (MIT)
7+
* * * ~
8+
* * * ~ Copyright (c) 2010-2017 QAMatic
9+
* * * ~
10+
* * * ~ Permission is hereby granted, free of charge, to any person obtaining a copy
11+
* * * ~ of this software and associated documentation files (the "Software"), to deal
12+
* * * ~ in the Software without restriction, including without limitation the rights
13+
* * * ~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14+
* * * ~ copies of the Software, and to permit persons to whom the Software is
15+
* * * ~ furnished to do so, subject to the following conditions:
16+
* * * ~
17+
* * * ~ The above copyright notice and this permission notice shall be included in all
18+
* * * ~ copies or substantial portions of the Software.
19+
* * * ~
20+
* * * ~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21+
* * * ~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
* * * ~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23+
* * * ~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
* * * ~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25+
* * * ~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26+
* * * ~ SOFTWARE.
27+
* * * ~
28+
* * * ~
29+
* * * -->
30+
* *
31+
* *
32+
*
33+
*/
34+
35+
package org.qamatic.mintleaf;
36+
37+
import org.junit.Test;
38+
import org.qamatic.mintleaf.configuration.ConfigurationRoot;
39+
import org.qamatic.mintleaf.configuration.DbConnectionInfo;
40+
import org.qamatic.mintleaf.configuration.SchemaInfo;
41+
import org.qamatic.mintleaf.core.BaseSqlReader;
42+
43+
import java.io.IOException;
44+
import java.io.InputStream;
45+
46+
import static junit.framework.TestCase.assertTrue;
47+
import static org.junit.Assert.assertEquals;
48+
49+
/**
50+
* Created by senips on 5/6/16.
51+
*/
52+
public class MigrationConfigTest {
53+
54+
@Test
55+
public void testConfigurationDump() throws IOException {
56+
57+
58+
ConfigurationRoot dbConfiguration = new ConfigurationRoot();
59+
DbConnectionInfo dbConnectionSetting = new DbConnectionInfo("abcdb", DbType.H2, "");
60+
dbConfiguration.getDatabases().add(dbConnectionSetting);
61+
dbConnectionSetting.getConnectionProperties().add("poolSize=100");
62+
SchemaInfo versionSetting = new SchemaInfo();
63+
versionSetting.setId("1.0");
64+
versionSetting.setChangeSets("create schema, load seed data");
65+
66+
versionSetting.setScriptLocation("./path/*.sql");
67+
dbConfiguration.getSchemaVersions().getVersion().add(versionSetting);
68+
69+
//a sanity check whether dump works
70+
assertTrue(dbConfiguration.toString().contains("databases"));
71+
}
72+
73+
@Test
74+
public void testConfigurationLoad() throws IOException {
75+
InputStream inputStream = BaseSqlReader.getInputStreamFromFile("res:/test-config.yml");
76+
}
77+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
databases:
2+
- id: abcdb
3+
properties:
4+
poolSize: '100'
5+
type: H2
6+
url: ''
7+
mintleaf:
8+
description: 'Database and Schema version configuration file'
9+
file version: '1.0'
10+
schemaVersions:
11+
- changeSets:
12+
- create schema
13+
- load seed data
14+
scriptLocation: ./path/*.sql
15+
version: '1.0'

0 commit comments

Comments
 (0)