Skip to content

Commit 63c74ad

Browse files
author
Nickolay Savchenko
committed
Move tests
1 parent 01681dd commit 63c74ad

File tree

12 files changed

+93
-150
lines changed

12 files changed

+93
-150
lines changed

.idea/compiler.xml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.idea/copyright/profiles_settings.xml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.idea/gradle.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 3 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

build.gradle

Lines changed: 0 additions & 30 deletions
This file was deleted.

example-client/build.gradle

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
buildscript {
2+
repositories {
3+
jcenter()
4+
maven {
5+
url "https://maven.google.com"
6+
}
7+
google()
8+
}
9+
dependencies {
10+
classpath 'com.android.tools.build:gradle:3.2.1'
11+
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
12+
}
13+
}
14+
15+
repositories {
16+
jcenter()
17+
maven { url "https://jitpack.io" }
18+
google()
19+
}
20+
121
apply plugin: 'com.android.application'
222

323
android {

lib/build.gradle

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
buildscript {
2+
repositories {
3+
jcenter()
4+
maven {
5+
url "https://maven.google.com"
6+
}
7+
google()
8+
}
9+
dependencies {
10+
classpath 'com.android.tools.build:gradle:3.2.1'
11+
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
12+
}
13+
}
14+
15+
repositories {
16+
jcenter()
17+
google()
18+
}
19+
120
apply plugin: 'com.android.library'
221
apply plugin: 'com.github.dcendents.android-maven'
322

@@ -34,6 +53,10 @@ dependencies {
3453
compileOnly 'com.squareup.okhttp3:okhttp:3.10.0'
3554

3655
implementation 'com.android.support:support-annotations:28.0.0'
56+
57+
testImplementation 'org.testcontainers:testcontainers:1.8.0'
58+
testImplementation 'org.spockframework:spock-core:1.1-groovy-2.4'
59+
testImplementation 'org.spockframework:spock-spring:1.1-groovy-2.4'
3760
}
3861

3962
task sourcesJar(type: Jar) {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package ua.naiksoftware.stomp
2+
3+
import org.testcontainers.containers.BindMode
4+
import org.testcontainers.containers.GenericContainer
5+
import org.testcontainers.containers.wait.strategy.Wait
6+
import spock.lang.Shared
7+
import spock.lang.Specification
8+
9+
class Configuration extends Specification implements ApplicationContextInitializer<ConfigurableApplicationContext> {
10+
11+
@Shared
12+
static GenericContainer testServer = setupServer()
13+
14+
GenericContainer setupServer() {
15+
16+
new ProcessBuilder('./gradlew bootJar')
17+
.start().waitForProcessOutput(System.out as Appendable, System.err as Appendable)
18+
19+
return new GenericContainer('openjdk:8-jre-alpine')
20+
.withClasspathResourceMapping('./build/artifacts/test-server-1.0.jar', '/app.jar', BindMode.READ_ONLY)
21+
.withCommand('java -jar /app.jar')
22+
.waitingFor(Wait.forHttp('/health'))
23+
.withExposedPorts(80)
24+
}
25+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package ua.naiksoftware.stomp
2+
3+
import ua.naiksoftware.stomp.Configuration
4+
import ua.naiksoftware.stomp.Stomp
5+
6+
class ConnectionTests extends Configuration {
7+
8+
def "connection must be recreated when reconnect"() {
9+
given:
10+
def client = Stomp.over(Stomp.ConnectionProvider.OKHTTP, 'localhost/websocket')
11+
client.connect()
12+
13+
when:
14+
client.disconnect()
15+
16+
then:
17+
client.isConnected() == false
18+
client.isConnecting() == false
19+
}
20+
}

0 commit comments

Comments
 (0)