mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-08 05:02:11 +00:00
DATAES-211 - Fix tests for CDI (jar hell)
This commit is contained in:
parent
42fc41b2eb
commit
4930415302
36
pom.xml
36
pom.xml
@ -108,12 +108,22 @@
|
||||
<version>${spring}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.apache.openwebbeans.test</groupId>-->
|
||||
<!--<artifactId>cditest-owb</artifactId>-->
|
||||
<!--<version>${webbeans}</version>-->
|
||||
<!--<scope>test</scope>-->
|
||||
<!--</dependency>-->
|
||||
<dependency>
|
||||
<groupId>org.apache.openwebbeans.test</groupId>
|
||||
<artifactId>cditest-owb</artifactId>
|
||||
<version>${webbeans}</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-jcdi_1.0_spec</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.apache.geronimo.specs</groupId>
|
||||
<artifactId>geronimo-atinject_1.0_spec</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
@ -128,20 +138,6 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.codehaus.groovy</groupId>-->
|
||||
<!--<artifactId>groovy-all</artifactId>-->
|
||||
<!--<version>2.4.4</version>-->
|
||||
<!--<scope>test</scope>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>org.elasticsearch.module</groupId>-->
|
||||
<!--<artifactId>lang-groovy</artifactId>-->
|
||||
<!--<version>${elasticsearch}</version>-->
|
||||
<!--<!–<scope>test</scope>–>-->
|
||||
<!--</dependency>-->
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -76,9 +76,7 @@ public class NodeClientFactoryBean implements FactoryBean<NodeClient>, Initializ
|
||||
nodeClient = (NodeClient) nodeBuilder().settings(Settings.builder().put(loadConfig())
|
||||
.put("http.enabled", String.valueOf(this.enableHttp))
|
||||
.put("path.home", this.pathHome)
|
||||
.put("path.data", this.pathData)
|
||||
.put("script.inline", "on")
|
||||
)
|
||||
.put("path.data", this.pathData))
|
||||
.clusterName(this.clusterName).local(this.local).node()
|
||||
.client();
|
||||
}
|
||||
|
@ -1,95 +1,95 @@
|
||||
///*
|
||||
// * Copyright 2014 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.
|
||||
// * You may obtain a copy of the License at
|
||||
// *
|
||||
// * http://www.apache.org/licenses/LICENSE-2.0
|
||||
// *
|
||||
// * Unless required by applicable law or agreed to in writing, software
|
||||
// * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// * See the License for the specific language governing permissions and
|
||||
// * limitations under the License.
|
||||
// */
|
||||
//package org.springframework.data.elasticsearch.repositories.cdi;
|
||||
//
|
||||
//import static org.hamcrest.CoreMatchers.is;
|
||||
//import static org.junit.Assert.*;
|
||||
//
|
||||
//import org.apache.webbeans.cditest.CdiTestContainer;
|
||||
//import org.apache.webbeans.cditest.CdiTestContainerLoader;
|
||||
//import org.junit.AfterClass;
|
||||
//import org.junit.Before;
|
||||
//import org.junit.BeforeClass;
|
||||
//import org.junit.Test;
|
||||
//import org.springframework.data.elasticsearch.entities.Product;
|
||||
//
|
||||
///**
|
||||
// * @author Mohsin Husen
|
||||
// */
|
||||
//TODO: ako cdi - jar hell
|
||||
//public class CdiRepositoryTests {
|
||||
//
|
||||
// private static CdiTestContainer cdiContainer;
|
||||
// private CdiProductRepository repository;
|
||||
// private SamplePersonRepository personRepository;
|
||||
//
|
||||
// @BeforeClass
|
||||
// public static void init() throws Exception {
|
||||
// cdiContainer = CdiTestContainerLoader.getCdiContainer();
|
||||
// cdiContainer.startApplicationScope();
|
||||
// cdiContainer.bootContainer();
|
||||
// }
|
||||
//
|
||||
// @AfterClass
|
||||
// public static void shutdown() throws Exception {
|
||||
// cdiContainer.stopContexts();
|
||||
// cdiContainer.shutdownContainer();
|
||||
// }
|
||||
//
|
||||
// @Before
|
||||
// public void setUp() {
|
||||
// CdiRepositoryClient client = cdiContainer.getInstance(CdiRepositoryClient.class);
|
||||
// repository = client.getRepository();
|
||||
// personRepository = client.getSamplePersonRepository();
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testCdiRepository() {
|
||||
// assertNotNull(repository);
|
||||
//
|
||||
// Product bean = new Product();
|
||||
// bean.setId("id-1");
|
||||
// bean.setName("cidContainerTest-1");
|
||||
//
|
||||
// repository.save(bean);
|
||||
//
|
||||
// assertTrue(repository.exists(bean.getId()));
|
||||
//
|
||||
// Product retrieved = repository.findOne(bean.getId());
|
||||
// assertNotNull(retrieved);
|
||||
// assertEquals(bean.getId(), retrieved.getId());
|
||||
// assertEquals(bean.getName(), retrieved.getName());
|
||||
//
|
||||
// assertEquals(1, repository.count());
|
||||
//
|
||||
// assertTrue(repository.exists(bean.getId()));
|
||||
//
|
||||
// repository.delete(bean);
|
||||
//
|
||||
// assertEquals(0, repository.count());
|
||||
// retrieved = repository.findOne(bean.getId());
|
||||
// assertNull(retrieved);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @see DATAES-113
|
||||
// */
|
||||
// @Test
|
||||
// public void returnOneFromCustomImpl() {
|
||||
//
|
||||
// assertThat(personRepository.returnOne(), is(1));
|
||||
// }
|
||||
//}
|
||||
/*
|
||||
* Copyright 2014 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.elasticsearch.repositories.cdi;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.apache.webbeans.cditest.CdiTestContainer;
|
||||
import org.apache.webbeans.cditest.CdiTestContainerLoader;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.elasticsearch.entities.Product;
|
||||
|
||||
/**
|
||||
* @author Mohsin Husen
|
||||
*/
|
||||
|
||||
public class CdiRepositoryTests {
|
||||
|
||||
private static CdiTestContainer cdiContainer;
|
||||
private CdiProductRepository repository;
|
||||
private SamplePersonRepository personRepository;
|
||||
|
||||
@BeforeClass
|
||||
public static void init() throws Exception {
|
||||
cdiContainer = CdiTestContainerLoader.getCdiContainer();
|
||||
cdiContainer.startApplicationScope();
|
||||
cdiContainer.bootContainer();
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void shutdown() throws Exception {
|
||||
cdiContainer.stopContexts();
|
||||
cdiContainer.shutdownContainer();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
CdiRepositoryClient client = cdiContainer.getInstance(CdiRepositoryClient.class);
|
||||
repository = client.getRepository();
|
||||
personRepository = client.getSamplePersonRepository();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCdiRepository() {
|
||||
assertNotNull(repository);
|
||||
|
||||
Product bean = new Product();
|
||||
bean.setId("id-1");
|
||||
bean.setName("cidContainerTest-1");
|
||||
|
||||
repository.save(bean);
|
||||
|
||||
assertTrue(repository.exists(bean.getId()));
|
||||
|
||||
Product retrieved = repository.findOne(bean.getId());
|
||||
assertNotNull(retrieved);
|
||||
assertEquals(bean.getId(), retrieved.getId());
|
||||
assertEquals(bean.getName(), retrieved.getName());
|
||||
|
||||
assertEquals(1, repository.count());
|
||||
|
||||
assertTrue(repository.exists(bean.getId()));
|
||||
|
||||
repository.delete(bean);
|
||||
|
||||
assertEquals(0, repository.count());
|
||||
retrieved = repository.findOne(bean.getId());
|
||||
assertNull(retrieved);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATAES-113
|
||||
*/
|
||||
@Test
|
||||
public void returnOneFromCustomImpl() {
|
||||
|
||||
assertThat(personRepository.returnOne(), is(1));
|
||||
}
|
||||
}
|
||||
|
@ -1,20 +1,3 @@
|
||||
#enabled scripts - this require groovy
|
||||
script.inline: true
|
||||
script.indexed: true
|
||||
#script.groovy.sandbox.enabled: true
|
||||
#script.groovy.sandbox.enabled: true
|
||||
#script.engine.groovy.file.aggs: true
|
||||
#script.engine.groovy.file.mapping: true
|
||||
#script.engine.groovy.file.search: true
|
||||
#script.engine.groovy.file.update: true
|
||||
#script.engine.groovy.file.plugin: true
|
||||
#script.engine.groovy.indexed.aggs: true
|
||||
#script.engine.groovy.indexed.mapping: true
|
||||
#script.engine.groovy.indexed.search: true
|
||||
#script.engine.groovy.indexed.update: true
|
||||
#script.engine.groovy.indexed.plugin: true
|
||||
#script.engine.groovy.inline.aggs: true
|
||||
#script.engine.groovy.inline.mapping: true
|
||||
#script.engine.groovy.inline.search: true
|
||||
#script.engine.groovy.inline.update: true
|
||||
#script.engine.groovy.inline.plugin: true
|
||||
script.indexed: true
|
Loading…
x
Reference in New Issue
Block a user