Revision 639 org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/test/java/org/gvsig/tools/persistence/AbstractBasicTest.java
AbstractBasicTest.java | ||
---|---|---|
26 | 26 |
manager.saveState(state, out); |
27 | 27 |
out.close(); |
28 | 28 |
} |
29 |
|
|
29 |
|
|
30 | 30 |
protected PersistentState saveAndRestoreState(Object obj) throws Exception { |
31 | 31 |
PersistentState state1 = manager.getState(obj); |
32 | 32 |
|
... | ... | |
40 | 40 |
return state2; |
41 | 41 |
} |
42 | 42 |
|
43 |
protected void saveObject(Object obj) throws Exception { |
|
44 |
File f = File.createTempFile("gvsig-test-pers-"+getTestId(), "OS.zip"); |
|
45 |
OutputStream out = new FileOutputStream(f); |
|
46 |
manager.putObject(out,obj); |
|
47 |
out.close(); |
|
48 |
} |
|
49 |
|
|
50 |
protected Object saveAndRestoreObject(Object obj) throws Exception { |
|
51 |
File f = File.createTempFile("gvsig-test-pers-"+getTestId(), "OSR.zip"); |
|
52 |
OutputStream out = new FileOutputStream(f); |
|
53 |
manager.putObject(out,obj); |
|
54 |
out.close(); |
|
55 |
|
|
56 |
InputStream in = new FileInputStream(f); |
|
57 |
Object obj2 = manager.getObject(in); |
|
58 |
in.close(); |
|
59 |
return obj2; |
|
60 |
} |
|
61 |
|
|
43 | 62 |
public void doSetUp() throws Exception { |
44 | 63 |
this.manager = ToolsLocator.getPersistenceManager(); |
45 | 64 |
manager.setAutoValidation(PersistenceManager.MANDATORY); |
Also available in: Unified diff