Skip to content

Commit

Permalink
Streamline tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mp911de committed Oct 13, 2017
1 parent 6735981 commit 42da4f8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
23 changes: 8 additions & 15 deletions src/test/java/com/lambdaworks/redis/support/CdiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

import javax.enterprise.inject.Disposes;
import javax.enterprise.inject.Produces;

import org.apache.webbeans.cditest.CdiTestContainer;
Expand Down Expand Up @@ -50,14 +49,21 @@ public static void setUp() throws Exception {
container.startApplicationScope();
}

@AfterClass
public static void afterClass() throws Exception {

container.stopApplicationScope();
container.shutdownContainer();
}

@Produces
public RedisURI redisURI() {
return RedisURI.Builder.redis(AbstractRedisClientTest.host, AbstractRedisClientTest.port).build();
}

@Produces
public ClientResources clientResources() {
return DefaultClientResources.create();
return TestClientResources.get();
}

@Produces
Expand All @@ -66,10 +72,6 @@ public ClientResources personClientResources() {
return DefaultClientResources.create();
}

public void shutdownClientResources(@Disposes ClientResources clientResources) throws Exception {
FastShutdown.shutdown(clientResources);
}

@PersonDB
@Produces
public RedisURI redisURIQualified() {
Expand Down Expand Up @@ -97,13 +99,4 @@ public void testInjection() {

injectedClient.pingRedis();
}

@AfterClass
public static void afterClass() throws Exception {

container.stopApplicationScope();
container.shutdownContainer();

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public void validUri() throws Exception {
sut.afterPropertiesSet();
assertThat(getRedisURI().getHost()).isEqualTo("host");
assertThat(getRedisURI().getPassword()).isEqualTo("password".toCharArray());

sut.destroy();
}

@Test
Expand All @@ -64,6 +66,8 @@ public void validUriPasswordOverride() throws Exception {
sut.afterPropertiesSet();
assertThat(getRedisURI().getHost()).isEqualTo("host");
assertThat(getRedisURI().getPassword()).isEqualTo("thepassword".toCharArray());

sut.destroy();
}

@Test
Expand All @@ -84,6 +88,8 @@ public void multiNodeUri() throws Exception {

assertThat(host2.getHost()).isEqualTo("host2");
assertThat(host2.getPassword()).isEqualTo("password".toCharArray());

sut.destroy();
}

@Test
Expand All @@ -106,6 +112,8 @@ public void multiNodeUriPasswordOverride() throws Exception {

assertThat(host2.getHost()).isEqualTo("host2");
assertThat(host2.getPassword()).isEqualTo("thepassword".toCharArray());

sut.destroy();
}

@Test
Expand All @@ -118,6 +126,8 @@ public void supportsSsl() throws Exception {
assertThat(getRedisURI().getPassword()).isEqualTo("password".toCharArray());
assertThat(getRedisURI().isVerifyPeer()).isFalse();
assertThat(getRedisURI().isSsl()).isTrue();

sut.destroy();
}

private RedisURI getRedisURI() {
Expand Down

0 comments on commit 42da4f8

Please sign in to comment.