TestRevocerReaderpublic class TestRevocerReader extends TestCase Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
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.
See the License for the specific language governing permissions and
limitations under the License. |
Fields Summary |
---|
private RecoverReader | recReader | private static final String | feedId | private static final String | entryId | private static final Long | timestamp | private String | title | private static final com.google.gdata.data.DateTime | dateTime | private String | delete | private String | insert |
Methods Summary |
---|
protected void | setUp()
this.recReader = new RecoverReader();
GDataServerRegistry.getRegistry().registerService(new ProvidedServiceStub());
| protected void | tearDown()
super.tearDown();
| public void | testRecoverDeletedEntries()
StringReader reader = new StringReader(this.delete);
assertNotNull(this.recReader.recoverEntries(new BufferedReader(reader)));
reader = new StringReader(this.delete);
List<StorageEntryWrapper> recList = this.recReader.recoverEntries(new BufferedReader(reader));
assertEquals(1,recList.size());
StorageEntryWrapper delWrapper = recList.get(0);
assertEquals(StorageOperation.DELETE,delWrapper.getOperation());
assertEquals(feedId,delWrapper.getFeedId());
assertEquals(entryId,delWrapper.getEntryId());
| public void | testRecoverInsertedEntries()
StringReader reader = new StringReader(this.insert);
List<StorageEntryWrapper> recList = this.recReader.recoverEntries(new BufferedReader(reader));
assertEquals(1,recList.size());
StorageEntryWrapper insWrapper = recList.get(0);
assertEquals(StorageOperation.INSERT,insWrapper.getOperation());
assertEquals(feedId,insWrapper.getFeedId());
assertEquals(entryId,insWrapper.getEntryId());
assertEquals(dateTime,insWrapper.getEntry().getUpdated());
assertEquals(this.title,insWrapper.getEntry().getTitle().getPlainText());
| public void | testRecoverReader()
StringReader reader = new StringReader(this.insert+this.delete);
List<StorageEntryWrapper> recList = this.recReader.recoverEntries(new BufferedReader(reader));
assertEquals(2,recList.size());
assertEquals(StorageOperation.INSERT,recList.get(0).getOperation());
assertEquals(StorageOperation.DELETE,recList.get(1).getOperation());
reader = new StringReader("some corrupted\n###########\n"+this.insert);
recList = this.recReader.recoverEntries(new BufferedReader(reader));
assertEquals(1,recList.size());
assertEquals(StorageOperation.INSERT,recList.get(0).getOperation());
|
|