build.gradle 7.24 KB
Newer Older
1

2
apply plugin: 'org.gretty'
3
4
5
6
7
8
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

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')
42
    testCompile project(':acrepo-services-entailment')
43
44
    testCompile project(':acrepo-services-inference')
    testCompile project(':acrepo-services-mint')
acoburn's avatar
acoburn committed
45
    testCompile project(':acrepo-services-ore')
46
    testCompile project(':acrepo-services-pcdm')
47
    testCompile project(':acrepo-exts-entailment')
48
49
    testCompile project(':acrepo-exts-fits')
    testCompile project(':acrepo-exts-image')
acoburn's avatar
acoburn committed
50
    testCompile project(':acrepo-exts-ore')
51
52
53
54
55
    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
56
57
    testCompile group: 'org.osgi', name: 'org.osgi.core', version: osgiCoreVersion
    testCompile group: 'org.osgi', name: 'org.osgi.compendium', version: osgiCompendiumVersion
58
59
    testCompile group: 'org.apache.jena', name: 'jena-osgi', version: jenaVersion
    testCompile group: 'org.glassfish.hk2.external', name: 'javax.inject', version: hk2Version
60
61

    testCompile group: 'commons-io', name: 'commons-io', version: commonsIoVersion
62
63
64
65
66
67
68
69
    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
70
    testCompile group: 'org.apache.marmotta', name: 'ldcache-api', version: marmottaVersion
71

acoburn's avatar
acoburn committed
72
    testCompile group: 'org.fcrepo.camel', name: 'toolbox-features', version: fcrepoCamelToolboxVersion, classifier: 'features', ext: 'xml'
73
74
75
76
77
78
79
80
81
82
    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
83
    File outputFileDir = project.file( "${project.buildDir}/classes/java/test/META-INF/maven/" )
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
    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
128
    systemProperty 'karaf.commonsIo.version', commonsIoVersion
Aaron Coburn's avatar
Aaron Coburn committed
129
    systemProperty 'karaf.jena.version', jenaVersion
130
131
132
133
134
135

    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
136
    systemProperty 'karaf.ore.port', randomPort()
137
    systemProperty 'karaf.entailment.port', randomPort()
138
139
140
141
    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
142
    systemProperty 'karaf.ldpath.port', randomPort()
143
144
145
146
147
148
149

    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
150
    httpPort = fcrepoWebPort
151
152
    integrationTestTask = 'integrationTest'
    systemProperty 'fcrepo.home', 'build/tmp/fcrepo-data'
acoburn's avatar
acoburn committed
153
    systemProperty 'fcrepo.modeshape.configuration', 'classpath:/config/file-simple/repository.json'
154
155
156
157
158
    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'
159
    webapp "org.apache.jena:jena-fuseki-war:${jenaVersion}@war", contextPath: '/fuseki'
160
161
162
163
164
165
166
167
168
169
170
171
}

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
172
    tasks.test.dependsOn p.tasks.install
173
}
acoburn's avatar
acoburn committed
174