* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- TextIndex textIndex;
- Iter iter;
- Trans trans;
- DataFile datafile;
- @Mock
- File file;
-
- private class AbsDataStub extends AbsData {
-
-
- public AbsDataStub(File dataf, char sepChar, int maxLineSize, int fieldOffset) {
- super(dataf, sepChar, maxLineSize, fieldOffset);
- // TODO Auto-generated constructor stub
-
- }
-
- }
-
- @Before
- public void setUp() throws IOException{
- char character = 'x';
- String filePath = "test/output_key";
- File keyfile = new File(filePath);
- FileOutputStream is = new FileOutputStream(keyfile);
+ TextIndex textIndex;
+ Iter iter;
+ Trans trans;
+ DataFile datafile;
+ @Mock
+ File file;
+
+ private class AbsDataStub extends AbsData {
+
+
+ public AbsDataStub(File dataf, char sepChar, int maxLineSize, int fieldOffset) {
+ super(dataf, sepChar, maxLineSize, fieldOffset);
+ // TODO Auto-generated constructor stub
+
+ }
+
+ }
+
+ @Before
+ public void setUp() throws IOException{
+ char character = 'x';
+ String filePath = "test/output_key";
+ File keyfile = new File(filePath);
+ FileOutputStream is = new FileOutputStream(keyfile);
-
- datafile = new DataFile(keyfile, "r");
- datafile.open();
- datafile = new DataFile(keyfile, "rws");// "S" for synchronized
- datafile.open();
-
- trans = mock(Trans.class);
- TimeTaken ttMock = mock(TimeTaken.class);
- TimeTaken ttMock1 = mock(TimeTaken.class);
- when(trans.start("Open Files", Env.SUB)).thenReturn(ttMock);
- when(trans.start("Read", Env.SUB)).thenReturn(ttMock);
- textIndex = new TextIndex(keyfile);
- textIndex.close();
- textIndex.open();
- //textIndex.create(trans, datafile, 4, character, 2, 0); //TODO: AAF-111 once actual input is aquired
- keyfile.delete();
-
- iter = textIndex.new Iter();
- }
-
- @Test
- public void testClose() throws IOException {
- textIndex.close();
- }
-
- @Test
- public void testFind() throws IOException {
- char character = 'x';
- String filePath = "test/output_.key";
- File keyfile = new File(filePath);
- AbsDataStub ads = new AbsDataStub(keyfile, character, 0, 0);
- Reuse reuse = ads.reuse();
- textIndex.find("a", reuse , 0);
- }
-
- @Test
- public void testIterNext() {
- iter.next();
- iter.hasNext();
- }
-
- @Test
- public void testIdx() throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
- TextIndex outerObject = new TextIndex(file);
+
+ datafile = new DataFile(keyfile, "r");
+ datafile.open();
+ datafile = new DataFile(keyfile, "rws");// "S" for synchronized
+ datafile.open();
+
+ trans = mock(Trans.class);
+ TimeTaken ttMock = mock(TimeTaken.class);
+ TimeTaken ttMock1 = mock(TimeTaken.class);
+ when(trans.start("Open Files", Env.SUB)).thenReturn(ttMock);
+ when(trans.start("Read", Env.SUB)).thenReturn(ttMock);
+ textIndex = new TextIndex(keyfile);
+ textIndex.close();
+ textIndex.open();
+ //textIndex.create(trans, datafile, 4, character, 2, 0); //TODO: AAF-111 once actual input is aquired
+ keyfile.delete();
+
+ iter = textIndex.new Iter();
+ }
+
+ @Test
+ public void testClose() throws IOException {
+ textIndex.close();
+ }
+
+ @Test
+ public void testFind() throws IOException {
+ char character = 'x';
+ String filePath = "test/output_.key";
+ File keyfile = new File(filePath);
+ AbsDataStub ads = new AbsDataStub(keyfile, character, 0, 0);
+ Reuse reuse = ads.reuse();
+ textIndex.find("a", reuse , 0);
+ }
+
+ @Test
+ public void testIterNext() {
+ iter.next();
+ iter.hasNext();
+ }
+
+ @Test
+ public void testIdx() throws ClassNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
+ TextIndex outerObject = new TextIndex(file);