Skip to content

Commit 4c74625

Browse files
committed
update version && travis-ci
1 parent 067785d commit 4c74625

File tree

8 files changed

+50
-44
lines changed

8 files changed

+50
-44
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
language: java
2+
jdk:
3+
- oraclejdk8
4+
- openjdk8

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
<groupId>io.github.lvyahui8</groupId>
2222
<artifactId>spring-boot-data-aggregator</artifactId>
23-
<version>1.0.5</version>
23+
<version>1.1.0-SNAPSHOT</version>
2424
<modules>
2525
<module>spring-boot-data-aggregator-core</module>
2626
<module>spring-boot-data-aggregator-autoconfigure</module>

spring-boot-data-aggregator-autoconfigure/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-boot-data-aggregator</artifactId>
77
<groupId>io.github.lvyahui8</groupId>
8-
<version>1.0.5</version>
8+
<version>1.1.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

spring-boot-data-aggregator-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-boot-data-aggregator</artifactId>
77
<groupId>io.github.lvyahui8</groupId>
8-
<version>1.0.5</version>
8+
<version>1.1.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

spring-boot-data-aggregator-example/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-boot-data-aggregator</artifactId>
77
<groupId>io.github.lvyahui8</groupId>
8-
<version>1.0.5</version>
8+
<version>1.1.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
package io.github.lvyahui8.spring.example;
22

3-
import io.github.lvyahui8.spring.aggregate.facade.DataBeanAggregateQueryFacade;
4-
import io.github.lvyahui8.spring.example.facade.UserQueryFacade;
5-
import io.github.lvyahui8.spring.example.model.User;
63
import lombok.extern.slf4j.Slf4j;
74
import org.springframework.boot.SpringApplication;
85
import org.springframework.boot.autoconfigure.SpringBootApplication;
96
import org.springframework.context.ConfigurableApplicationContext;
10-
import org.springframework.util.Assert;
117

12-
import java.util.Collections;
138
import java.util.concurrent.ExecutorService;
149

1510
/**
@@ -21,39 +16,16 @@
2116
@Slf4j
2217
public class ExampleApplication {
2318

24-
private static final int NUM = 100;
25-
2619
public static void main(String[] args) throws Exception {
27-
ConfigurableApplicationContext context = SpringApplication.run(ExampleApplication.class);
20+
ConfigurableApplicationContext context = null;
2821
try{
29-
DataBeanAggregateQueryFacade queryFacade = context.getBean(DataBeanAggregateQueryFacade.class);
30-
31-
{
32-
User user = queryFacade.get("userWithPosts", Collections.singletonMap("userId",1L), User.class);
33-
Assert.notNull(user,"user not null");
34-
Assert.notNull(user.getPosts(),"user posts not null");
35-
log.info("user.name:{},user.posts.size:{}",
36-
user.getUsername(),user.getPosts().size());
37-
}
38-
39-
log.info("------------------------------------------------------------------");
40-
41-
{
42-
User user = context.getBean(UserQueryFacade.class).getUserFinal(1L);
43-
Assert.notNull(user.getFollowers(),"user followers not null");
44-
}
45-
46-
log.info("------------------------------------------------------------------");
47-
48-
{
49-
for (int i = 0; i < NUM; i ++) {
50-
String s = queryFacade.get("categoryTitle", Collections.singletonMap("categoryId", 1L), String.class);
51-
Assert.isTrue(org.apache.commons.lang3.StringUtils.isNotEmpty(s),"s not null");
52-
}
53-
}
22+
context = SpringApplication.run(ExampleApplication.class);
5423
} finally {
55-
ExecutorService executorService = (ExecutorService) context.getBean("aggregateExecutorService");
56-
executorService.shutdown();
24+
if(context != null) {
25+
ExecutorService executorService = (ExecutorService) context.getBean("aggregateExecutorService");
26+
executorService.shutdown();
27+
}
5728
}
5829
}
30+
5931
}

spring-boot-data-aggregator-example/src/test/java/io/github/lvyahui8/spring/example/DataBeanAggregateQueryFacadeTest.java

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import io.github.lvyahui8.spring.autoconfigure.BeanAggregateProperties;
88
import io.github.lvyahui8.spring.example.context.ExampleAppContext;
99
import io.github.lvyahui8.spring.example.context.RequestContext;
10+
import io.github.lvyahui8.spring.example.facade.UserQueryFacade;
1011
import io.github.lvyahui8.spring.example.model.Category;
1112
import io.github.lvyahui8.spring.example.model.Post;
1213
import io.github.lvyahui8.spring.example.model.User;
@@ -31,12 +32,44 @@
3132
@Slf4j
3233
public class DataBeanAggregateQueryFacadeTest {
3334

35+
private static final int NUM = 100;
36+
3437
@Autowired
3538
private DataBeanAggregateQueryFacade dataBeanAggregateQueryFacade;
3639

3740
@Autowired
3841
private BeanAggregateProperties beanAggregateProperties;
3942

43+
@Autowired
44+
UserQueryFacade userQueryFacade;
45+
46+
@Test
47+
public void testSample() throws Exception {
48+
{
49+
User user = dataBeanAggregateQueryFacade.get("userWithPosts", Collections.singletonMap("userId",1L), User.class);
50+
Assert.notNull(user,"user not null");
51+
Assert.notNull(user.getPosts(),"user posts not null");
52+
log.info("user.name:{},user.posts.size:{}",
53+
user.getUsername(),user.getPosts().size());
54+
}
55+
56+
log.info("------------------------------------------------------------------");
57+
58+
{
59+
User user = userQueryFacade.getUserFinal(1L);
60+
Assert.notNull(user.getFollowers(),"user followers not null");
61+
}
62+
63+
log.info("------------------------------------------------------------------");
64+
65+
{
66+
for (int i = 0; i < NUM; i ++) {
67+
String s = dataBeanAggregateQueryFacade.get("categoryTitle", Collections.singletonMap("categoryId", 1L), String.class);
68+
Assert.isTrue(org.apache.commons.lang3.StringUtils.isNotEmpty(s),"s not null");
69+
}
70+
}
71+
}
72+
4073
@Test
4174
public void testExceptionProcessing() throws Exception {
4275
boolean success = false;
@@ -46,15 +79,12 @@ public void testExceptionProcessing() throws Exception {
4679
Collections.singletonMap("userId", 1L), User.class);
4780
} catch (Exception e) {
4881
log.info("default settings is SUSPEND, catch an exception: {}",e.getMessage(),e);
49-
success = true;
5082
}
5183
} else {
5284
User user = dataBeanAggregateQueryFacade.get("userWithPosts",
5385
Collections.singletonMap("userId", 1L), User.class);
54-
System.out.println(user);
55-
success = true;
86+
Assert.notNull(user,"user must be not null!");
5687
}
57-
Assert.isTrue(success,"exception handle success");
5888
}
5989

6090
@Test

spring-boot-data-aggregator-starter/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>spring-boot-data-aggregator</artifactId>
77
<groupId>io.github.lvyahui8</groupId>
8-
<version>1.0.5</version>
8+
<version>1.1.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

0 commit comments

Comments
 (0)