View Javadoc

1   package net.obsearch.storage.bdb;
2   
3   import java.io.File;
4   
5   import junit.framework.TestCase;
6   
7   
8   import net.obsearch.index.utils.Directory;
9   import net.obsearch.storage.StorageValidationDouble;
10  import net.obsearch.storage.OBStorageConfig;
11  import org.junit.Before;
12  import org.junit.Test;
13  /*
14  		OBSearch: a distributed similarity search engine This project is to
15   similarity search what 'bit-torrent' is to downloads. 
16      Copyright (C) 2008 Arnoldo Jose Muller Molina
17  
18    	This program is free software: you can redistribute it and/or modify
19      it under the terms of the GNU General Public License as published by
20      the Free Software Foundation, either version 3 of the License, or
21      (at your option) any later version.
22  
23      This program is distributed in the hope that it will be useful,
24      but WITHOUT ANY WARRANTY; without even the implied warranty of
25      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26      GNU General Public License for more details.
27  
28      You should have received a copy of the GNU General Public License
29      along with this program.  If not, see <http://www.gnu.org/licenses/>.
30  */
31  
32  /** 
33  	*  TestBDBOBStoreDouble 
34  	*  
35    *  @author      Arnoldo Jose Muller Molina    
36    */
37  public class TestBDBOBStoreJeDouble extends TestCase{
38  
39      @Before
40      public void setUp() throws Exception {
41      }
42  
43  
44      @Test
45      public void testAll() throws Exception{
46          
47          BDBFactoryJe fact = Utils.getFactoryJe();
48  				 OBStorageConfig conf = new OBStorageConfig();
49  				 conf.setTemp(false);
50  				 conf.setDuplicates(false);
51  				 conf.setBulkMode(false);
52  				 StorageValidationDouble.validate(fact.createOBStoreDouble("testDouble1", conf));
53  				    conf = new OBStorageConfig();
54  				 conf.setTemp(false);
55  				 conf.setDuplicates(false);
56  				 conf.setBulkMode(true);
57  				 StorageValidationDouble.validate(fact.createOBStoreDouble("testDouble2", conf));
58  				   conf = new OBStorageConfig();
59  				 conf.setTemp(true);
60  				 conf.setDuplicates(false);
61  				 conf.setBulkMode(false);
62  				 StorageValidationDouble.validate(fact.createOBStoreDouble("testDouble3", conf));
63      }
64  
65  
66  		public void testDuplicates() throws Exception{
67                   
68  				 BDBFactoryJe fact = Utils.getFactoryJe();
69  				 OBStorageConfig conf = new OBStorageConfig();
70  				 conf.setTemp(false);
71  				 conf.setDuplicates(true);
72  				 conf.setBulkMode(false);
73  				 conf.setRecordSize(StorageValidationDouble.STORAGE_SIZE);
74  				 StorageValidationDouble.validateDuplicates(fact.createOBStoreDouble("testDouble1D", conf));
75  				    conf = new OBStorageConfig();
76  				 conf.setTemp(false);
77  				 conf.setDuplicates(true);
78  				 conf.setBulkMode(true);
79  				 conf.setRecordSize(StorageValidationDouble.STORAGE_SIZE);
80  				 StorageValidationDouble.validateDuplicates(fact.createOBStoreDouble("testDouble2D", conf));
81  				   conf = new OBStorageConfig();
82  				 conf.setTemp(true);
83  				 conf.setDuplicates(true);
84  				 conf.setBulkMode(false);
85  				 conf.setRecordSize(StorageValidationDouble.STORAGE_SIZE);
86  				 StorageValidationDouble.validateDuplicates(fact.createOBStoreDouble("testDouble3D", conf));
87      }
88  
89  
90  }