build.gradle 7.39 KB
Newer Older
1
2
buildscript {
    repositories {
Aaron Coburn's avatar
Aaron Coburn committed
3
      mavenCentral()
4
5
6
7
      jcenter()
    }

    dependencies {
Aaron Coburn's avatar
Aaron Coburn committed
8
        classpath 'org.akhikhl.gretty:gretty:2.0.0'
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
    }
}

apply plugin: 'org.akhikhl.gretty'

description = """OSGi Integration tests for repository services"""

def randomPort() {
    try {
        ServerSocket server = new ServerSocket()
        server.setReuseAddress(true)
        server.bind(new InetSocketAddress(0))
        int port = server.getLocalPort()
        server.close()
        return port
    } catch (IOException e) {
        throw new IOException('Failed to find random free port', e)
    }
}

repositories {
  jcenter()
  mavenLocal()
  mavenCentral()
}

configurations {
    karafDistro {
        description = 'Configuration used to isolate the dependency on the Karaf distro'
        transitive = false
    }
}

ext {
    fcrepoWebPort = randomPort()
    fcrepoJmsPort = randomPort()
    fcrepoStompPort = randomPort()
}

dependencies {
    testCompile project(':acrepo-connector-broadcast')
    testCompile project(':acrepo-connector-idiomatic')
    testCompile project(':acrepo-connector-idiomatic-pgsql')
52
    testCompile project(':acrepo-services-entailment')
53
54
    testCompile project(':acrepo-services-inference')
    testCompile project(':acrepo-services-mint')
acoburn's avatar
acoburn committed
55
    testCompile project(':acrepo-services-ore')
56
    testCompile project(':acrepo-services-pcdm')
57
    testCompile project(':acrepo-exts-entailment')
58
59
    testCompile project(':acrepo-exts-fits')
    testCompile project(':acrepo-exts-image')
acoburn's avatar
acoburn committed
60
    testCompile project(':acrepo-exts-ore')
61
62
63
64
65
    testCompile project(':acrepo-exts-pcdm')
    testCompile project(':acrepo-exts-serialize-xml')
    testCompile project(':acrepo-exts-template')
    testCompile project(':acrepo-karaf')

Aaron Coburn's avatar
Aaron Coburn committed
66
67
    testCompile group: 'org.osgi', name: 'org.osgi.core', version: osgiCoreVersion
    testCompile group: 'org.osgi', name: 'org.osgi.compendium', version: osgiCompendiumVersion
68
69
    testCompile group: 'org.apache.jena', name: 'jena-osgi', version: jenaVersion
    testCompile group: 'org.glassfish.hk2.external', name: 'javax.inject', version: hk2Version
70
71

    testCompile group: 'commons-io', name: 'commons-io', version: commonsIoVersion
72
73
74
75
76
77
78
79
    testCompile group: 'org.apache.httpcomponents', name: 'httpclient-osgi', version: httpclientVersion
    testCompile group: 'org.apache.httpcomponents', name: 'httpcore-osgi', version: httpcoreVersion
    testCompile group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: jacksonVersion
    testCompile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: jacksonVersion
    testCompile group: 'org.ops4j.pax.exam', name: 'pax-exam', version: paxExamVersion
    testCompile group: 'org.ops4j.pax.exam', name: 'pax-exam-junit4', version: paxExamVersion
    testCompile group: 'org.ops4j.pax.exam', name: 'pax-exam-container-karaf', version: paxExamVersion
    testCompile group: 'org.apache.karaf.features', name: 'org.apache.karaf.features.core', version: karafVersion
80
    testCompile group: 'org.apache.marmotta', name: 'ldcache-api', version: marmottaVersion
81

acoburn's avatar
acoburn committed
82
    testCompile group: 'org.fcrepo.camel', name: 'toolbox-features', version: fcrepoCamelToolboxVersion, classifier: 'features', ext: 'xml'
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
    testCompile group: 'org.apache.camel.karaf', name: 'apache-camel', version: camelVersion, classifier:'features', ext: 'xml'
    testCompile group: 'org.apache.activemq', name: 'activemq-karaf', version: activemqVersion, classifier:'features', ext: 'xml'
    testCompile group: 'org.apache.karaf.features', name: 'standard', version: karafVersion, classifier:'features', ext: 'xml'

    karafDistro group: 'org.apache.karaf', name: 'apache-karaf', version: karafVersion, ext: 'zip'
}


task generateDependsFile {
    // This is useful for the org.ops4j.pax.exam.CoreOptions.maven() stuff
    File outputFileDir = project.file( 'build/classes/test/META-INF/maven/' )
    File outputFile = new File( outputFileDir, 'dependencies.properties' )
    outputs.file outputFile

    doFirst {
        outputFileDir.mkdirs()
        Properties properties = new Properties();

        // first we add our GAV info
        properties.setProperty( "groupId", "${project.group}" );
        properties.setProperty( "artifactId", project.name );
        properties.setProperty( "version", "${project.version}" );
        properties.setProperty( "${project.group}/${project.name}/version", "${project.version}" );

        // then for all our deps
        project.configurations.testRuntime.resolvedConfiguration.resolvedArtifacts.each {
            final String keyBase = it.moduleVersion.id.group + '/' + it.moduleVersion.id.name;
            properties.setProperty( "${keyBase}/scope", "compile" )
            properties.setProperty( "${keyBase}/type", it.extension )
            properties.setProperty( "${keyBase}/version", it.moduleVersion.id.version )
        }

        FileOutputStream outputStream = new FileOutputStream( outputFile );
        try {
            properties.store( outputStream, "Generated from Gradle for PaxExam testing" )
        }
        finally {
            outputStream.close()
        }
    }
}

task copyTestResources(type: Copy) {
    from "${projectDir}/src/test/resources"
    into "${buildDir}/classes/test"
}

task integrationTest(type: Test) {
    systemProperty 'fcrepo.dynamic.test.port', fcrepoWebPort
    systemProperty 'fcrepo.dynamic.jms.port', fcrepoJmsPort
    systemProperty 'fcrepo.dynamic.stomp.port', fcrepoStompPort
}

test {
    systemProperty 'karaf.version', karafVersion
138
    systemProperty 'karaf.commonsIo.version', commonsIoVersion
Aaron Coburn's avatar
Aaron Coburn committed
139
    systemProperty 'karaf.jena.version', jenaVersion
140
141
142
143
144
145

    systemProperty 'karaf.ssh.port', randomPort()
    systemProperty 'karaf.rmiServer.port', randomPort()
    systemProperty 'karaf.rmiRegistry.port', randomPort()
    systemProperty 'karaf.template.port', randomPort()
    systemProperty 'karaf.metadata.port', randomPort()
acoburn's avatar
acoburn committed
146
    systemProperty 'karaf.ore.port', randomPort()
147
    systemProperty 'karaf.entailment.port', randomPort()
148
149
150
151
    systemProperty 'karaf.pcdm.port', randomPort()
    systemProperty 'karaf.image.port', randomPort()
    systemProperty 'karaf.idiomatic.port', randomPort()
    systemProperty 'karaf.fits.port', randomPort()
acoburn's avatar
acoburn committed
152
    systemProperty 'karaf.ldpath.port', randomPort()
153
154
155
156
157
158
159

    systemProperty 'fcrepo.dynamic.test.port', fcrepoWebPort
    systemProperty 'fcrepo.dynamic.jms.port', fcrepoJmsPort
    systemProperty 'fcrepo.dynamic.stomp.port', fcrepoStompPort
}

farm {
Aaron Coburn's avatar
Aaron Coburn committed
160
    httpPort = fcrepoWebPort
161
162
    integrationTestTask = 'integrationTest'
    systemProperty 'fcrepo.home', 'build/tmp/fcrepo-data'
acoburn's avatar
acoburn committed
163
    systemProperty 'fcrepo.modeshape.configuration', 'classpath:/config/file-simple/repository.json'
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
    systemProperty 'fcrepo.dynamic.test.port', fcrepoWebPort
    systemProperty 'fcrepo.dynamic.jms.port', fcrepoJmsPort
    systemProperty 'fcrepo.dynamic.stomp.port', fcrepoStompPort
    systemProperty 'FUSEKI_BASE', 'build/fuseki_home'
    webapp "org.fcrepo:fcrepo-webapp:${fcrepoVersion}@war", contextPath: '/fcrepo'
    webapp "org.apache.jena:jena-fuseki-war:${fusekiVersion}@war", contextPath: '/fuseki'
}

processTestResources.dependsOn copyTestResources
tasks.test.dependsOn tasks.generateDependsFile

project.afterEvaluate {
    tasks.test.dependsOn tasks.farmIntegrationTest
    tasks.test.mustRunAfter farmBeforeIntegrationTest
    tasks.farmAfterIntegrationTest.mustRunAfter tasks.test
}

rootProject.childProjects.findAll { n, p -> p != project }.each { n, p ->
acoburn's avatar
acoburn committed
182
    tasks.test.dependsOn p.tasks.install
183
}
acoburn's avatar
acoburn committed
184