DATAGEODE-42 - Upgrade to OpenWebBeans 2.0.1

This commit is contained in:
Mark Paluch
2017-09-18 15:48:48 +02:00
parent 35df6902fa
commit d52bea06c1
3 changed files with 27 additions and 36 deletions

18
pom.xml
View File

@@ -22,7 +22,6 @@
<assertj.version>3.6.2</assertj.version>
<geode.version>1.2.0</geode.version>
<multithreadedtc.version>1.01</multithreadedtc.version>
<servlet-api.version>2.5</servlet-api.version>
<springdata.commons>2.0.0.BUILD-SNAPSHOT</springdata.commons>
<spring-shell.version>1.2.0.RELEASE</spring-shell.version>
<source.level>1.8</source.level>
@@ -165,16 +164,9 @@
<!-- Test -->
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>${cdi}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api.version}</version>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${javax-annotation-api}</version>
<scope>test</scope>
</dependency>
@@ -193,8 +185,8 @@
</dependency>
<dependency>
<groupId>org.apache.openwebbeans.test</groupId>
<artifactId>cditest-owb</artifactId>
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-se</artifactId>
<version>${webbeans}</version>
<scope>test</scope>
</dependency>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,48 +24,50 @@ import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import javax.enterprise.inject.se.SeContainer;
import javax.enterprise.inject.se.SeContainerInitializer;
import org.apache.geode.cache.CacheClosedException;
import org.apache.geode.cache.CacheFactory;
import org.apache.webbeans.cditest.CdiTestContainer;
import org.apache.webbeans.cditest.CdiTestContainerLoader;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.data.gemfire.repository.sample.Person;
/**
* The CdiExtensionIntegrationTest class...
*
* @author John Blum
* @author Mark Paluch
* @see org.junit.Test
* @see org.springframework.data.gemfire.repository.cdi.GemfireRepositoryBean
* @see org.springframework.data.gemfire.repository.cdi.GemfireRepositoryExtension
* @see org.apache.webbeans.cditest.CdiTestContainer
* @see org.apache.webbeans.cditest.CdiTestContainerLoader
* @since 1.8.0
*/
public class CdiExtensionIntegrationTest {
static CdiTestContainer container;
static SeContainer container;
@BeforeClass
public static void setUp() throws Exception {
container = CdiTestContainerLoader.getCdiContainer();
container.bootContainer();
public static void setUp() {
container = SeContainerInitializer.newInstance() //
.disableDiscovery() //
.addPackages(RepositoryClient.class) //
.initialize();
}
@AfterClass
public static void tearDown() throws Exception {
container.shutdownContainer();
public static void tearDown() {
container.close();
closeGemfireCache();
}
private static void closeGemfireCache() {
try {
CacheFactory.getAnyInstance().close();
}
catch (CacheClosedException ignore) {
}
} catch (CacheClosedException ignore) {}
}
protected void assertIsExpectedPerson(Person actual, Person expected) {
@@ -74,9 +76,10 @@ public class CdiExtensionIntegrationTest {
assertThat(actual.getLastname(), is(equalTo(expected.getLastname())));
}
@Test
@Test // DATAGEODE-42
public void bootstrapsRepositoryCorrectly() {
RepositoryClient repositoryClient = container.getInstance(RepositoryClient.class);
RepositoryClient repositoryClient = container.select(RepositoryClient.class).get();
assertThat(repositoryClient.getPersonRepository(), is(notNullValue()));
@@ -98,9 +101,10 @@ public class CdiExtensionIntegrationTest {
assertThat(repositoryClient.find(foundJonDoe.getId()), is(nullValue()));
}
@Test
@Test // DATAGEODE-42
public void returnOneFromCustomImplementation() {
RepositoryClient repositoryClient = container.getInstance(RepositoryClient.class);
RepositoryClient repositoryClient = container.select(RepositoryClient.class).get();
assertThat(repositoryClient.getPersonRepository().returnOne(), is(equalTo(1)));
}

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</beans>