1 21 package com.db4o.test; 22 23 import java.io.*; 24 25 import com.db4o.*; 26 import com.db4o.query.*; 27 28 public class EncryptionWrongPassword { 29 30 public String name; 31 32 public void storeOne() { 33 name = "hi"; 34 } 35 36 public void testOne() { 37 Db4o.configure().password("wrong"); 38 Db4o.configure().encrypt(true); 39 PrintStream nulout=new PrintStream(new ByteArrayOutputStream()); 40 Db4o.configure().setOut(nulout); 41 try { 42 Test.reOpenServer(); 43 44 47 } 49 catch(Exception exc) { 50 } 52 Db4o.configure().encrypt(false); 53 Db4o.configure().password(null); 54 55 Db4o.configure().setOut(null); 56 Test.reOpenServer(); 57 58 Query query=Test.query(); 59 query.constrain(this.getClass()); 60 Test.ensure(((EncryptionWrongPassword)query.execute().next()).name.equals(name)); 61 } 62 } 63 | Popular Tags |