remove old module

This commit is contained in:
chernykhalexander 2016-08-06 22:59:54 +03:00
parent 6db9efda21
commit ffa78dc175
10 changed files with 0 additions and 195 deletions

View File

@ -1,52 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.baeldung</groupId>
<artifactId>cdiexample</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<spring.version>4.3.1.RELEASE</spring.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.jboss.weld.se/weld-se-core -->
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<version>2.3.5.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-context -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-test -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.9</version>
</dependency>
</dependencies>
</project>

View File

@ -1,12 +0,0 @@
package com.baeldung.cdi.interceptor;
import javax.interceptor.InterceptorBinding;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@InterceptorBinding
@Target( {ElementType.METHOD, ElementType.TYPE } )
@Retention(RetentionPolicy.RUNTIME )
public @interface Audited {}

View File

@ -1,20 +0,0 @@
package com.baeldung.cdi.interceptor;
import javax.interceptor.AroundInvoke;
import javax.interceptor.Interceptor;
import javax.interceptor.InvocationContext;
import java.lang.reflect.Method;
@Audited @Interceptor
public class AuditedInterceptor {
@AroundInvoke
public Object auditMethod(InvocationContext ctx) throws Exception {
Object[] parameters = ctx.getParameters();
Method method= ctx.getMethod();
String param = (String) parameters[0];
System.out.println("Method "+method.getName()+" invoked with parameter "+param);
Object result = ctx.proceed();
System.out.println("Method "+method.getName()+" exit");
return result;
}
}

View File

@ -1,11 +0,0 @@
package com.baeldung.cdi.service;
import com.baeldung.cdi.interceptor.Audited;
public class SuperService {
@Audited
public String deliverService(String uid) {
System.out.println("Service delivered for uid:" + uid);
return uid;
}
}

View File

@ -1,19 +0,0 @@
package com.baeldung.spring.aspect;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
@Aspect
public class SpringTestAspect {
@Around("execution(* com.baeldung.spring.service.SpringSuperService.*(..))")
public Object advice(ProceedingJoinPoint jp) throws Throwable {
String methodName = jp.getSignature().getName();
System.out.println("Call to "+methodName);
Object obj = jp.proceed();
System.out.println("Method called successfully: "+methodName);
return obj;
}
}

View File

@ -1,21 +0,0 @@
package com.baeldung.spring.configuration;
import com.baeldung.spring.aspect.SpringTestAspect;
import com.baeldung.spring.service.SpringSuperService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
@Configuration
@EnableAspectJAutoProxy
public class AppConfig {
@Bean
public SpringSuperService springSuperService() {
return new SpringSuperService();
}
@Bean
public SpringTestAspect springTestAspect(){
return new SpringTestAspect();
}
}

View File

@ -1,8 +0,0 @@
package com.baeldung.spring.service;
public class SpringSuperService {
public String getInfoFromService(String code){
System.out.println("Doing calculations");
return code;
}
}

View File

@ -1,8 +0,0 @@
<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_2.xsd">
<interceptors>
<class>com.baeldung.cdi.interceptor.AuditedInterceptor</class>
</interceptors>
</beans>

View File

@ -1,25 +0,0 @@
package com.baeldung.test;
import com.baeldung.spring.configuration.AppConfig;
import com.baeldung.spring.service.SpringSuperService;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import javax.inject.Inject;
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = {AppConfig.class})
public class SpringTestInterceptor {
@Inject
SpringSuperService springSuperService;
@Test
public void givenService_whenServiceAndAspectExecuted_thenOk(){
String code = "123456";
String result = springSuperService.getInfoFromService(code);
Assert.assertEquals(code,result);
}
}

View File

@ -1,19 +0,0 @@
package com.baeldung.test;
import com.baeldung.cdi.service.SuperService;
import org.jboss.weld.environment.se.Weld;
import org.jboss.weld.environment.se.WeldContainer;
import org.junit.Assert;
import org.junit.Test;
public class TestInterceptor {
@Test
public void givenTheService_whenMethodAndInterceptorExecuted_thenOK() {
Weld weld = new Weld();
WeldContainer container = weld.initialize();
SuperService superService = container.instance().select(SuperService.class).get();
String code = "123456";
superService.deliverService(code);
Assert.assertEquals("123456",code);
}
}