TestDataView.java
2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.view;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.beans.TestDataBeanLocal;
import fi.insomnia.bortal.beans.UserBeanLocal;
import fi.insomnia.bortal.handler.SessionHandler;
import fi.insomnia.bortal.model.EventMap;
import fi.insomnia.bortal.model.User;
/**
*
* @author tuukka
*/
@ManagedBean(name = "TestDataView")
@RequestScoped
public class TestDataView {
private static final Logger logger = LoggerFactory.getLogger(TestDataView.class);
@EJB
private TestDataBeanLocal testdatabean;
@EJB
private UserBeanLocal userbean;
@ManagedProperty("#{sessionHandler}")
private SessionHandler sessionhandler;
public void generateData() {
User user = testdatabean.createUser();
User admin = testdatabean.createAdmin();
testdatabean.createBill( user);
EventMap map = testdatabean.generateTestMap();
testdatabean.generateTestPlaces(map);
// testdatabean.generateTestCompos(event);
}
public void generateMapTests() {
testdatabean.flushMaps();
testdatabean.generateTestMap();
for (long i = 100; i < 1024 * 100; i += 100) {
logger.debug("Writing data with {} chars", i);
testdatabean.writeMap( i);
}
}
public void executeMapTests() {
for (long i = 100; i < 1024 * 100; i += 100) {
logger.debug("Trying to read {} chars", i);
EventMap map = testdatabean.readMap(i);
logger.debug("Got map {} with {} chars", new Object[] { map, map.getMapData().length() });
}
logger.warn("All succeded Testing for original image");
EventMap map = testdatabean.readMap(0);
logger.info("Got orig image: {}", map);
}
/** Creates a new instance of TestDataView */
public TestDataView() {
}
public void setSessionhandler(SessionHandler sessionhandler) {
this.sessionhandler = sessionhandler;
}
public SessionHandler getSessionhandler() {
return sessionhandler;
}
public String printPlacesInfo() {
testdatabean.printPlacesInfo();
return null;
}
public void contextTest()
{
testdatabean.contextTest();
}
}