1

Split project into sub-projects

This commit is contained in:
2018-05-04 17:23:08 +03:00
parent a3e6f119e7
commit fb4baec57f
28 changed files with 119 additions and 42 deletions

View File

@@ -1,38 +1,23 @@
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "io.ratpack:ratpack-gradle:1.5.1"
classpath 'com.h2database:h2:1.4.191'
}
repositories {
jcenter()
}
dependencies {
classpath "io.ratpack:ratpack-gradle:1.5.1"
}
}
plugins {
id "org.flywaydb.flyway" version "5.0.7"
id "io.ratpack.ratpack-groovy" version "1.5.1"
id 'idea'
id 'idea'
id 'groovy'
id "io.ratpack.ratpack-groovy" version "1.5.1"
id "org.flywaydb.flyway" version "5.0.7"
}
repositories {
jcenter()
allprojects {
apply plugin: 'io.ratpack.ratpack-groovy'
apply plugin: 'idea'
repositories {
jcenter()
}
}
dependencies {
compile ratpack.dependency('h2')
compile ratpack.dependency('jdbc-tx')
compile ratpack.dependency('session')
compile 'org.flywaydb:flyway-core:5.0.7'
runtime 'org.slf4j:slf4j-simple:1.7.25'
testCompile ratpack.dependency('test')
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
testCompile 'cglib:cglib:2.2.2'
testCompile 'org.objenesis:objenesis:2.1'
}
flyway {
url = 'jdbc:h2:mem:dbtdb'
user = 'SA'
}
run.dependsOn(flywayMigrate)

6
dbt-core/build.gradle Normal file
View File

@@ -0,0 +1,6 @@
dependencies {
compile ratpack.dependency('jdbc-tx')
compile ratpack.dependency('session')
}

18
dbt-demo/build.gradle Normal file
View File

@@ -0,0 +1,18 @@
apply plugin: "org.flywaydb.flyway"
dependencies {
compile project(':dbt-core')
runtime ratpack.dependency('h2')
runtime ratpack.dependency('jdbc-tx')
runtime ratpack.dependency('session')
compile 'org.flywaydb:flyway-core:5.0.7'
runtime 'org.slf4j:slf4j-simple:1.7.25'
}
flyway {
url = 'jdbc:h2:mem:dbtdb'
user = 'SA'
}
run.dependsOn(flywayMigrate)

View File

@@ -1,4 +1,4 @@
package com.devsoap.dbt.app
package com.devsoap.dbt.demo
import org.flywaydb.core.Flyway
import ratpack.service.Service

View File

@@ -1,12 +1,8 @@
import com.devsoap.dbt.DBTModule
import com.devsoap.dbt.app.DatabaseService
import com.devsoap.dbt.demo.DatabaseService
import com.devsoap.dbt.config.DBTConfig
import com.devsoap.dbt.handlers.ExecutorHandler
import com.devsoap.dbt.services.TransactionManagerService
import com.fasterxml.jackson.databind.ObjectMapper
import org.h2.jdbcx.JdbcDataSource
import ratpack.config.ConfigData
import ratpack.session.SessionModule
import javax.sql.DataSource

25
dbt-test/build.gradle Normal file
View File

@@ -0,0 +1,25 @@
apply plugin: 'org.flywaydb.flyway'
dependencies {
testCompile project(':dbt-core')
testRuntime project(':dbt-core')
testCompile ratpack.dependency('h2')
testRuntime ratpack.dependency('jdbc-tx')
testRuntime ratpack.dependency('session')
testRuntime 'org.flywaydb:flyway-core:5.0.7'
testRuntime 'org.slf4j:slf4j-simple:1.7.25'
testCompile ratpack.dependency('test')
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
testCompile 'cglib:cglib:2.2.2'
testCompile 'org.objenesis:objenesis:2.1'
}
flyway {
url = 'jdbc:h2:mem:dbtdb'
user = 'SA'
}
run.dependsOn(flywayMigrate)

View File

@@ -0,0 +1,40 @@
import com.devsoap.dbt.DBTModule
import com.devsoap.dbt.config.DBTConfig
import org.flywaydb.core.Flyway
import org.h2.jdbcx.JdbcDataSource
import ratpack.service.Service
import ratpack.service.StartEvent
import ratpack.session.SessionModule
import javax.sql.DataSource
import static ratpack.groovy.Groovy.ratpack
ratpack {
serverConfig {
sysProps()
require('/dbt', DBTConfig)
}
bindings {
module SessionModule
module (DBTModule) {
it.ledger.remoteUrl = 'http://localhost:8888/ledger'
it.executor.remoteUrl = 'http://localhost:8888/executor'
}
bindInstance(DataSource, new JdbcDataSource(url: 'jdbc:h2:mem:dbtdb;DB_CLOSE_DELAY=-1', user: ''))
bind DatabaseService
}
}
class DatabaseService implements Service {
@Override
void onStart(StartEvent event){
new Flyway(dataSource: event.registry.get(DataSource)).migrate()
}
}

View File

@@ -1,4 +1,4 @@
package com.devsoap.dbt.framework
package com.devsoap.dbt
import ratpack.groovy.test.GroovyRatpackMainApplicationUnderTest
import ratpack.impose.Impositions

View File

@@ -1,4 +1,4 @@
package com.devsoap.dbt.framework
package com.devsoap.dbt
import com.devsoap.dbt.data.BlockTransaction
import com.fasterxml.jackson.databind.ObjectMapper

View File

@@ -1,4 +1,4 @@
package com.devsoap.dbt.framework
package com.devsoap.dbt
import com.devsoap.dbt.data.BlockTransaction

View File

@@ -1,4 +1,4 @@
package com.devsoap.dbt.framework
package com.devsoap.dbt
import com.devsoap.dbt.data.BlockTransaction
import com.fasterxml.jackson.databind.ObjectMapper
@@ -8,7 +8,6 @@ import spock.lang.Specification
class TransactionManagementServiceSpec extends Specification {
def mapper = new ObjectMapper()
def PATH = 'ledger'

View File

@@ -0,0 +1,4 @@
create table LOGS (
LOG_ID int not null,
LOG_VALUE varchar(100) not null
);

4
settings.gradle Normal file
View File

@@ -0,0 +1,4 @@
include 'dbt-core'
include 'dbt-test'
include 'dbt-demo'