Skip to content

Commit f601e61

Browse files
switch tp maven 3.3.9
1 parent 309e49a commit f601e61

File tree

3 files changed

+26
-54
lines changed

3 files changed

+26
-54
lines changed

src/test/java/org/woehlke/twitterwall/frontend/controller/TickerSymbolControllerTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
1010
import org.springframework.boot.test.context.SpringBootTest;
1111
import org.springframework.security.test.context.support.WithMockUser;
12-
import org.springframework.test.annotation.Commit;
1312
import org.springframework.test.context.junit4.SpringRunner;
1413
import org.springframework.test.web.servlet.MockMvc;
1514
import org.springframework.test.web.servlet.MvcResult;
@@ -38,14 +37,12 @@ public class TickerSymbolControllerTest {
3837
@Autowired
3938
private MockMvc mockMvc;
4039

41-
//@Commit
4240
@Test
4341
public void controllerIsPresentTest(){
4442
log.info("controllerIsPresentTest");
4543
assertThat(controller).isNotNull();
4644
}
4745

48-
//@Commit
4946
@Test
5047
public void setupTestData() throws Exception {
5148
String msg = "setupTestData: ";
@@ -55,7 +52,6 @@ public void setupTestData() throws Exception {
5552
}
5653

5754
@WithMockUser
58-
//@Commit
5955
@Test
6056
public void getAllTest() throws Exception {
6157
String msg = "getAllTest: ";

src/test/java/org/woehlke/twitterwall/oodm/service/TickerSymbolServiceTest.java

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,53 +11,46 @@
1111
import org.springframework.data.domain.Page;
1212
import org.springframework.data.domain.PageRequest;
1313
import org.springframework.data.domain.Pageable;
14-
import org.springframework.test.annotation.Commit;
1514
import org.springframework.test.context.junit4.SpringRunner;
16-
import org.springframework.transaction.annotation.Propagation;
17-
import org.springframework.transaction.annotation.Transactional;
1815
import org.woehlke.twitterwall.conf.properties.TestdataProperties;
1916
import org.woehlke.twitterwall.oodm.entities.TickerSymbol;
2017

2118
@RunWith(SpringRunner.class)
2219
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
23-
//@Transactional(propagation= Propagation.REQUIRES_NEW,readOnly=false)
2420
public class TickerSymbolServiceTest {
2521

2622
private static final Logger log = LoggerFactory.getLogger(TaskServiceTest.class);
2723

2824
@Autowired
2925
private TickerSymbolService tickerSymbolService;
3026

31-
//TODO: #198 https://github.com/phasenraum2010/twitterwall2/issues/198
3227
@Autowired
3328
private TestdataProperties testdataProperties;
3429

35-
//@Commit
3630
@Test
3731
public void areDependenciesLoaded() throws Exception {
3832
Assert.assertNotNull(tickerSymbolService);
3933
Assert.assertNotNull(testdataProperties);
4034
}
4135

42-
//@Commit
4336
@Test
4437
public void fetchTestData() throws Exception {
4538
String msg = "fetchTestData: ";
4639
int page=1;
47-
int size=1;
40+
int size=20;
4841
Pageable pageRequest = new PageRequest(page,size);
4942
Page<TickerSymbol> myPage = tickerSymbolService.getAll(pageRequest);
5043
if(myPage.getTotalElements()>0){
51-
TickerSymbol myTask = myPage.getContent().iterator().next();
52-
Assert.assertNotNull(msg,myTask);
53-
Assert.assertNotNull(msg,myTask.getUniqueId());
54-
log.debug(msg+" found: "+myTask.getUniqueId());
44+
for(TickerSymbol myTask :myPage.getContent()){
45+
Assert.assertNotNull(msg,myTask);
46+
Assert.assertNotNull(msg,myTask.getUniqueId());
47+
log.debug(msg+" found: "+myTask.getUniqueId());
48+
}
5549
} else {
5650
log.debug(msg+" found: myPage.getTotalElements() == 0");
5751
}
5852
}
5953

60-
//@Commit
6154
@Test
6255
public void findByUrl() throws Exception {
6356
String msg = "findByUrl: ";
@@ -66,12 +59,13 @@ public void findByUrl() throws Exception {
6659
Pageable pageRequest = new PageRequest(page,size);
6760
Page<TickerSymbol> myPage = tickerSymbolService.getAll(pageRequest);
6861
if(myPage.getTotalElements()>0){
69-
TickerSymbol myMedia = myPage.getContent().iterator().next();
70-
String expectedUrl = myMedia.getUrl();
71-
TickerSymbol myFoundMedia = tickerSymbolService.findByUrl(expectedUrl);
72-
String foundUrl = myFoundMedia.getUrl();
73-
Assert.assertEquals(msg, expectedUrl, foundUrl);
74-
log.debug(msg+" found: "+foundUrl);
62+
for(TickerSymbol myMedia :myPage.getContent()){
63+
String expectedUrl = myMedia.getUrl();
64+
TickerSymbol myFoundMedia = tickerSymbolService.findByUrl(expectedUrl);
65+
String foundUrl = myFoundMedia.getUrl();
66+
log.debug(msg+" found: "+foundUrl);
67+
Assert.assertEquals(msg, expectedUrl, foundUrl);
68+
}
7569
} else {
7670
log.debug(msg+" found: myPage.getTotalElements() == 0");
7771
}

src/test/java/org/woehlke/twitterwall/oodm/service/TweetServiceTest.java

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.woehlke.twitterwall.oodm.service;
22

33
import org.junit.Assert;
4-
import org.junit.Ignore;
54
import org.junit.Test;
65
import org.junit.runner.RunWith;
76
import org.slf4j.Logger;
@@ -11,10 +10,7 @@
1110
import org.springframework.data.domain.Page;
1211
import org.springframework.data.domain.PageRequest;
1312
import org.springframework.data.domain.Pageable;
14-
import org.springframework.test.annotation.Commit;
1513
import org.springframework.test.context.junit4.SpringRunner;
16-
import org.springframework.transaction.annotation.Propagation;
17-
import org.springframework.transaction.annotation.Transactional;
1814
import org.woehlke.twitterwall.conf.properties.TestdataProperties;
1915
import org.woehlke.twitterwall.oodm.entities.*;
2016
import org.woehlke.twitterwall.oodm.entities.transients.Object2Entity;
@@ -23,7 +19,6 @@
2319

2420
@RunWith(SpringRunner.class)
2521
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE)
26-
//@Transactional(propagation= Propagation.REQUIRES_NEW,readOnly=false)
2722
public class TweetServiceTest {
2823

2924
private static final Logger log = LoggerFactory.getLogger(TweetServiceTest.class);
@@ -49,36 +44,35 @@ public class TweetServiceTest {
4944
@Autowired
5045
private UserService userService;
5146

52-
//TODO: #198 https://github.com/phasenraum2010/twitterwall2/issues/198
5347
@Autowired
5448
private TestdataProperties testdataProperties;
5549

56-
//@Commit
5750
@Test
5851
public void areDependenciesLoaded() throws Exception {
5952
Assert.assertNotNull(tweetService);
6053
Assert.assertNotNull(testdataProperties);
6154
}
6255

63-
//@Commit
6456
@Test
6557
public void fetchTestData() throws Exception {
6658
String msg = "fetchTestData: ";
59+
log.info(msg+"START TEST");
6760
int page=1;
68-
int size=1;
61+
int size=20;
6962
Pageable pageRequest = new PageRequest(page,size);
7063
Page<Tweet> myPage = tweetService.getAll(pageRequest);
7164
if(myPage.getTotalElements()>0){
72-
Tweet myTweet = myPage.getContent().iterator().next();
73-
Assert.assertNotNull(msg,myTweet);
74-
Assert.assertNotNull(msg,myTweet.getUniqueId());
75-
log.info(msg+" found: "+myTweet.getUniqueId());
65+
for(Tweet myTweet :myPage.getContent()){
66+
Assert.assertNotNull(msg,myTweet);
67+
Assert.assertNotNull(msg,myTweet.getUniqueId());
68+
log.info(msg+" found: "+myTweet.getUniqueId());
69+
}
7670
} else {
7771
log.info(msg+" found: myPage.getTotalElements() == 0");
7872
}
73+
log.info(msg+"FINISHED TEST");
7974
}
8075

81-
//@Commit
8276
@Test
8377
public void findByIdTwitter() throws Exception {
8478
String msg = "findByIdTwitter: ";
@@ -90,18 +84,17 @@ public void findByIdTwitter() throws Exception {
9084
for(Tweet tweet: myPage.getContent()){
9185
long expectedIdTwitter = tweet.getIdTwitter();
9286
Tweet myFoundTweet = tweetService.findByIdTwitter(expectedIdTwitter);
93-
long foundIdTwitter = myFoundTweet.getIdTwitter();
94-
Assert.assertEquals(msg, expectedIdTwitter,foundIdTwitter);
95-
log.info(msg+" found: "+myFoundTweet.getUniqueId());
87+
if(myFoundTweet != null) {
88+
long foundIdTwitter = myFoundTweet.getIdTwitter();
89+
Assert.assertEquals(msg, expectedIdTwitter, foundIdTwitter);
90+
log.info(msg + " found: " + myFoundTweet.getUniqueId());
91+
}
9692
}
9793
} else {
9894
log.error(msg+" found: myPage.getTotalElements() == 0");
9995
}
10096
}
10197

102-
103-
//TODO: #160 https://github.com/phasenraum2010/twitterwall2/issues/160
104-
//@Commit
10598
@Test
10699
public void findTweetsForHashTag() throws Exception {
107100
String msg = "findTweetsForHashTag: ";
@@ -120,9 +113,6 @@ public void findTweetsForHashTag() throws Exception {
120113
log.info(msg);
121114
}
122115

123-
//TODO: #216 https://github.com/phasenraum2010/twitterwall2/issues/216
124-
//@Ignore
125-
//@Commit
126116
@Test
127117
public void findTweetsForUser() throws Exception {
128118
String msg = "findTweetsForUser: ";
@@ -149,7 +139,6 @@ public void findTweetsForUser() throws Exception {
149139
log.info(msg+" FINISHED TEST. Tested Users "+loopUser+" and Tweets "+loopTweet);
150140
}
151141

152-
//@Commit
153142
@Test
154143
public void findAllTweet2HashTag() throws Exception {
155144
String msg = "findAllTweet2HashTag: ";
@@ -175,8 +164,6 @@ public void findAllTweet2HashTag() throws Exception {
175164
}
176165
}
177166

178-
//@Commit
179-
//@Ignore
180167
@Test
181168
public void findAllTweet2Media() throws Exception {
182169
String msg = "findAllTweet2Media: ";
@@ -202,8 +189,6 @@ public void findAllTweet2Media() throws Exception {
202189
}
203190
}
204191

205-
//@Commit
206-
//@Ignore
207192
@Test
208193
public void findAllTweet2Mention() throws Exception {
209194
String msg = "findAllTweet2Mention: ";
@@ -231,8 +216,6 @@ public void findAllTweet2Mention() throws Exception {
231216
}
232217
}
233218

234-
//@Commit
235-
//@Ignore
236219
@Test
237220
public void findAllTweet2Url() throws Exception {
238221
String msg = "findAllTweet2Url: ";
@@ -258,7 +241,6 @@ public void findAllTweet2Url() throws Exception {
258241
}
259242
}
260243

261-
//@Commit
262244
@Test
263245
public void findAllTweet2TickerSymbol() throws Exception {
264246
String msg = "findAllTweet2TickerSymbol: ";

0 commit comments

Comments
 (0)