Skip to content

Commit

Permalink
Created java8-test module
Browse files Browse the repository at this point in the history
  • Loading branch information
lioolli committed Aug 26, 2015
1 parent 3074d69 commit d006802
Show file tree
Hide file tree
Showing 10 changed files with 446 additions and 0 deletions.
4 changes: 4 additions & 0 deletions java8-test/.gitignore
@@ -0,0 +1,4 @@
/target/
/.settings/
/.classpath
/.project
5 changes: 5 additions & 0 deletions java8-test/clover.license
@@ -0,0 +1,5 @@
RMRqrdbgbKFhbaVnDxHUdDQvrOQXxIBklnvcmahheubVC
mh2KM35CLkwUHS4DH7QVhxy52J5hnWbyEm6Cyd3KkF<mV
RmmnSVOqOMnOnMMrmMqwXomoroNrqPNRrPSsWwtUxXuUU
sRONqpnmqmUUnqonmstsmmmmmUUnqonmstsmmmmmUUGfk
mlfkqUUnmmmm
75 changes: 75 additions & 0 deletions java8-test/pom.xml
@@ -0,0 +1,75 @@
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.navercorp.pinpoint</groupId>
<artifactId>pinpoint-naver</artifactId>
<version>1.5.0-SNAPSHOT</version>
</parent>

<artifactId>pinpoint-java8-test</artifactId>
<name>pinpoint-integration-test-java8</name>
<!-- this module contains integration tests. if we set packaging to pom,
tests are not run. so we set it to jar even though the project will not be
packaged as a jar. -->
<packaging>jar</packaging>

<properties>
<jdk.version>1.8</jdk.version>
<jdk.home>${env.JAVA_8_HOME}</jdk.home>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
<resource>
<filtering>true</filtering>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${basedir}/src/main/resources-${env}</directory>
</resource>
</resources>

<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.18.1</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- AbstractPinpointPluginTestSuite needs this to resolve
path of required jars -->
<useSystemClassLoader>false</useSystemClassLoader>
<failIfNoTests>true</failIfNoTests>
</configuration>
</plugin>
</plugins>
</build>
</project>
@@ -0,0 +1,47 @@
/*
* Copyright 2014 NAVER Corp.
*
* 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 com.navercorp.pinpoint.jdk8.lambda;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class LambdaTest {

@Test
public void test() throws Exception {
ApplicationContext context = new ClassPathXmlApplicationContext("lambda-test.xml");

Maru maru = context.getBean(Maru.class);
Morae morae = context.getBean(Morae.class);
maru.test(morae);

// PluginTestVerifier verifier = PluginTestVerifierHolder.getInstance();
// verifier.printCache();
//
// verifier.verifyTrace(Expectations.event("SPRING_BEAN", Maru.class.getMethod("test", Morae.class)));
// verifier.verifyTrace(Expectations.event("SPRING_BEAN", Morae.class.getMethod("test", Predicate.class)));
// verifier.verifyTrace(Expectations.event("SPRING_BEAN", Mozzi.class.getMethod("getAge")));
//
// verifier.verifyTraceCount(0);
}

public static void main(String args[]) throws Exception {
new LambdaTest().test();
}

}
@@ -0,0 +1,25 @@
/**
* Copyright 2014 NAVER Corp.
* 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 com.navercorp.pinpoint.jdk8.lambda;

/**
* @author Jongho Moon
*
*/
public class Maru {
public boolean test(Morae morae) {
return morae.test((m) -> m.getAge() > 1);
}
}
@@ -0,0 +1,32 @@
/*
* Copyright 2014 NAVER Corp.
*
* 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 com.navercorp.pinpoint.jdk8.lambda;

import java.util.function.Predicate;

public class Morae {

private final Mozzi mozzi;

public Morae(Mozzi mozzi) {
this.mozzi = mozzi;
}

public boolean test(Predicate<Mozzi> predicate) {
return predicate.test(mozzi);
}
}
@@ -0,0 +1,32 @@
/*
* Copyright 2014 NAVER Corp.
*
* 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 com.navercorp.pinpoint.jdk8.lambda;

import org.springframework.stereotype.Controller;

@Controller
public class Mozzi {
private final int age;

public Mozzi(int age) {
this.age = age;
}

public int getAge() {
return age;
}
}
16 changes: 16 additions & 0 deletions java8-test/src/test/resources/lambda-test.xml
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

<bean id="maru" class="com.navercorp.pinpoint.jdk8.lambda.Maru"/>

<bean id="morae" class="com.navercorp.pinpoint.jdk8.lambda.Morae">
<constructor-arg ref="mozzi"/>
</bean>

<bean id="mozzi" class="com.navercorp.pinpoint.jdk8.lambda.Mozzi" scope="prototype">
<constructor-arg value="4"/>
</bean>

</beans>

0 comments on commit d006802

Please sign in to comment.