Revision 51032
Added by Argiro Kokogiannaki about 6 years ago
UoaAdminToolsApplicationTests.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.uoaadmintools; |
2 | 2 |
|
3 | 3 |
import eu.dnetlib.uoaadmintools.dao.*; |
4 |
import eu.dnetlib.uoaadmintools.entities.Community; |
|
5 |
import eu.dnetlib.uoaadmintools.entities.Entity; |
|
6 |
import eu.dnetlib.uoaadmintools.entities.Page; |
|
7 |
import eu.dnetlib.uoaadmintools.entities.PageHelpContent; |
|
4 |
import eu.dnetlib.uoaadmintools.entities.*; |
|
8 | 5 |
import org.junit.Test; |
9 | 6 |
import org.junit.runner.RunWith; |
10 | 7 |
import org.springframework.beans.factory.annotation.Autowired; |
11 | 8 |
import org.springframework.boot.test.context.SpringBootTest; |
12 | 9 |
import org.springframework.test.context.junit4.SpringRunner; |
13 | 10 |
|
14 |
import java.util.ArrayList; |
|
15 | 11 |
import java.util.HashMap; |
16 | 12 |
import java.util.List; |
17 | 13 |
import java.util.Map; |
18 | 14 |
|
19 |
import static javax.swing.text.html.HTML.Tag.P; |
|
20 |
|
|
21 | 15 |
@RunWith(SpringRunner.class) |
22 | 16 |
@SpringBootTest |
23 | 17 |
public class UoaAdminToolsApplicationTests { |
... | ... | |
34 | 28 |
@Autowired |
35 | 29 |
private PageHelpContentDAO pageHelpContentDAO; |
36 | 30 |
|
31 |
@Autowired |
|
32 |
private StatisticsDAO statisticsDAO; |
|
33 |
|
|
37 | 34 |
/* |
38 | 35 |
|
39 | 36 |
@Test |
... | ... | |
167 | 164 |
@Test |
168 | 165 |
public void contextLoads() { |
169 | 166 |
} |
167 |
@Test |
|
168 |
public void testStatistics() { |
|
169 |
// Statistics stats= new Statistics("openiare"); |
|
170 |
// Statistics saved = statisticsDAO.save(stats); |
|
171 |
// System.out.println(saved); |
|
172 |
// Statistics stats = statisticsDAO.findByPid("openaire"); |
|
173 |
// System.out.println(stats.toString()); |
|
174 |
List<Statistics> statisticsList = statisticsDAO.findAll(); |
|
175 |
for(Statistics stat:statisticsList){ |
|
176 |
System.out.println(stat.toString()); |
|
177 |
} |
|
178 |
// statisticsDAO.delete("5a9d0c71f9084558aad0fb3d"); |
|
179 |
// statisticsList = statisticsDAO.findAll(); |
|
180 |
// for(Statistics stats:statisticsList){ |
|
181 |
// System.out.println(stats.toString()); |
|
182 |
// } |
|
183 |
// statisticsDAO.deleteAll(); |
|
184 |
} |
|
185 |
@Test |
|
186 |
public void createStatistics() { |
|
187 |
List<Community> communities = communityDAO.findAll(); |
|
188 |
for(Community c:communities){ |
|
170 | 189 |
|
190 |
String pid = c.getPid(); |
|
191 |
System.out.println("Community :" +pid); |
|
192 |
Statistics stats = statisticsDAO.findByPid(pid); |
|
193 |
if(stats == null){ |
|
194 |
Statistics statistics = new Statistics(pid); |
|
195 |
statisticsDAO.save(statistics); |
|
196 |
System.out.println("Saved stats for :" +pid); |
|
197 |
} |
|
198 |
} |
|
199 |
|
|
200 |
} |
|
171 | 201 |
} |
Also available in: Unified diff
A first for statistics collection and methods