BAEL-696 - Implement OR in the REST API Query Language (#1404)
* Dependency Injection Types, XML-Config, Java-Config, Test Classes * Formatting done with Formatter Configuration in Eclipse * REST Query Lang - Adv Search Ops - Improvement - C1 * REST Query Lang - Adv Search Ops - Improvement - C2 * add update to rest api (#1401) * upgrade to spring boot 1.5.2 * add full update to REST API * BAEL-634 javassist (#1349) * BEEL-634 javassist dependency * BEEL-634 code for javassist article * BEEL-634 test refinement * BEEL-634 increment lib to newest version * add test that uses reflection to verify * add field * add bytecode to different class * adding following modules with updated testcase : DB, Filter, Json (#1410) * adding ratpack module * adding pom.xml * adding following modules with updated testcase : DB, Filter, Json * add entry points (#1413) * spring boot custom banner (#1412) * adding ratpack module * adding pom.xml * adding following modules with updated testcase : DB, Filter, Json * adding spring-boot custom banner tutorial * BALE-707 Refactoring changes (#1418) * BAEL-707 Add the changes as per review comment * BAEL-707 Refactored the code as per review comments * BAEL-696 Code formatting
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
package com.baeldung.test.beaninjection;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.baeldung.beaninjection.AnotherSampleDAOBean;
|
||||
import com.baeldung.beaninjection.ExampleDAOBean;
|
||||
import com.baeldung.beaninjection.ExampleServiceBean;
|
||||
import com.baeldung.configuration.ApplicationContextTestBeanInjectionTypes;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = ApplicationContextTestBeanInjectionTypes.class)
|
||||
public class BeanInjectionJavaConfigTest implements ApplicationContextAware {
|
||||
|
||||
private ApplicationContext beanInjectedContext;
|
||||
|
||||
@Test
|
||||
public void testDAOInjectionByJava() {
|
||||
ExampleServiceBean serviceBean = beanInjectedContext.getBean(ExampleServiceBean.class);
|
||||
assertNotNull("Failed: Constructor Injection,Bean Reference Injection,Java Config, ExampleServiceBean", serviceBean.getExampleDAO());
|
||||
assertNotNull("Failed: Constructor Injection,Bean Reference Injection,Java Config, ExampleServiceBean", serviceBean.getAnotherSampleDAO());
|
||||
assertTrue("Failed: Constructor Injection,String Property , Java Config", serviceBean.getPropertyX()
|
||||
.equals("Some Service Property X"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPropertyInjectioninDAOByJava() {
|
||||
ExampleDAOBean daoBean = beanInjectedContext.getBean(ExampleDAOBean.class);
|
||||
assertTrue("Failed: Constructor Injection,String Property , Java Config", daoBean.getPropertyX()
|
||||
.equals("Mandatory DAO Property X"));
|
||||
|
||||
AnotherSampleDAOBean anotherDAOBean = beanInjectedContext.getBean(AnotherSampleDAOBean.class);
|
||||
assertTrue("Failed: Constructor Injection,String Property , XML Config", anotherDAOBean.getPropertyY()
|
||||
.equals("Mandatory DAO Property Y"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
// TODO Auto-generated method stub
|
||||
this.beanInjectedContext = applicationContext;
|
||||
}
|
||||
}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
package com.baeldung.test.beaninjection;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.baeldung.beaninjection.AnotherSampleDAOBean;
|
||||
import com.baeldung.beaninjection.ExampleDAOBean;
|
||||
import com.baeldung.beaninjection.ExampleServiceBean;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = "classpath:beaninjectiontypes-context.xml")
|
||||
public class BeanInjectionXMLConfigTest implements ApplicationContextAware {
|
||||
|
||||
private ApplicationContext beanInjectedContext;
|
||||
|
||||
@Test
|
||||
public void testDAOInjectionByXML() {
|
||||
ExampleServiceBean serviceBean = beanInjectedContext.getBean(ExampleServiceBean.class);
|
||||
assertNotNull("Failed: Constructor Injection,Bean Reference Injection,XML Config, ExampleServiceBean", serviceBean.getExampleDAO());
|
||||
assertNotNull("Failed: Constructor Injection,Bean Reference Injection,XML Config, ExampleServiceBean", serviceBean.getAnotherSampleDAO());
|
||||
assertTrue("Failed: Constructor Injection,String Property , XML Config", serviceBean.getPropertyX()
|
||||
.equals("Some Service Property X"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPropertyInjectioninDAOByXML() {
|
||||
ExampleDAOBean daoBean = beanInjectedContext.getBean(ExampleDAOBean.class);
|
||||
assertTrue("Failed: Constructor Injection,String Property , XML Config", daoBean.getPropertyX()
|
||||
.equals("Mandatory DAO Property X"));
|
||||
|
||||
AnotherSampleDAOBean anotherDAOBean = beanInjectedContext.getBean(AnotherSampleDAOBean.class);
|
||||
assertTrue("Failed: Constructor Injection,String Property , XML Config", anotherDAOBean.getPropertyY()
|
||||
.equals("Mandatory DAO Property Y"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
// TODO Auto-generated method stub
|
||||
this.beanInjectedContext = applicationContext;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user