1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-02 06:45:59 +01:00

Renamed DefaultRosterStore to DirectoryRosterStore

This commit is contained in:
Florian Schmaus 2014-03-20 13:36:08 +01:00
parent 1bf57cb6a1
commit 6b4c53bfc5
3 changed files with 16 additions and 16 deletions

View file

@ -40,7 +40,7 @@ import org.xmlpull.v1.XmlPullParserException;
* @author Lars Noschinski
* @author Fabian Schuetz
*/
public class DefaultRosterStore implements RosterStore {
public class DirectoryRosterStore implements RosterStore {
private final File fileDir;
@ -65,7 +65,7 @@ public class DefaultRosterStore implements RosterStore {
* There is also one special file '__version__' that contains the
* current version string.
*/
private DefaultRosterStore(final File baseDir) {
private DirectoryRosterStore(final File baseDir) {
this.fileDir = baseDir;
}
@ -75,11 +75,11 @@ public class DefaultRosterStore implements RosterStore {
* @param baseDir
* The directory to create the store in. The directory should
* be empty
* @return A {@link DefaultRosterStore} instance if successful,
* @return A {@link DirectoryRosterStore} instance if successful,
* <code>null</code> else.
*/
public static DefaultRosterStore init(final File baseDir) {
DefaultRosterStore store = new DefaultRosterStore(baseDir);
public static DirectoryRosterStore init(final File baseDir) {
DirectoryRosterStore store = new DirectoryRosterStore(baseDir);
if (store.setRosterVersion("")) {
return store;
}
@ -92,11 +92,11 @@ public class DefaultRosterStore implements RosterStore {
* Opens a roster store
* @param baseDir
* The directory containing the roster store.
* @return A {@link DefaultRosterStore} instance if successful,
* @return A {@link DirectoryRosterStore} instance if successful,
* <code>null</code> else.
*/
public static DefaultRosterStore open(final File baseDir) {
DefaultRosterStore store = new DefaultRosterStore(baseDir);
public static DirectoryRosterStore open(final File baseDir) {
DirectoryRosterStore store = new DirectoryRosterStore(baseDir);
String s = FileUtils.readFile(store.getVersionFile());
if (s != null && s.startsWith(STORE_ID + "\n")) {
return store;

View file

@ -36,11 +36,11 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
/**
* Tests the implementation of {@link DefaultRosterStore}.
* Tests the implementation of {@link DirectoryRosterStore}.
*
* @author Lars Noschinski
*/
public class DefaultRosterStoreTest {
public class DirectoryRosterStoreTest {
@Rule
public TemporaryFolder tmpFolder = new TemporaryFolder();
@ -59,7 +59,7 @@ public class DefaultRosterStoreTest {
@Test
public void testStoreUninitialized() throws IOException {
File storeDir = tmpFolder.newFolder();
assertNull(DefaultRosterStore.open(storeDir));
assertNull(DirectoryRosterStore.open(storeDir));
}
/**
@ -68,7 +68,7 @@ public class DefaultRosterStoreTest {
@Test
public void testStoreInitializedEmpty() throws IOException {
File storeDir = tmpFolder.newFolder();
DefaultRosterStore store = DefaultRosterStore.init(storeDir);
DirectoryRosterStore store = DirectoryRosterStore.init(storeDir);
assertNotNull("Initialization returns store", store);
assertEquals("Freshly initialized store must have empty version",
"", store.getRosterVersion());
@ -82,7 +82,7 @@ public class DefaultRosterStoreTest {
@Test
public void testStoreAddRemove() throws IOException {
File storeDir = tmpFolder.newFolder();
DefaultRosterStore store = DefaultRosterStore.init(storeDir);
DirectoryRosterStore store = DirectoryRosterStore.init(storeDir);
assertEquals("Initial roster version", "", store.getRosterVersion());
@ -193,7 +193,7 @@ public class DefaultRosterStoreTest {
@Test
public void testAddEvilChars() throws IOException {
File storeDir = tmpFolder.newFolder();
DefaultRosterStore store = DefaultRosterStore.init(storeDir);
DirectoryRosterStore store = DirectoryRosterStore.init(storeDir);
String user = "../_#;\"'\\&@example.com";
String name = "\n../_#\0\t;\"'&@\\";

View file

@ -59,7 +59,7 @@ public class RosterVersioningTest {
// Uncomment this to enable debug output
//XMPPConnection.DEBUG_ENABLED = true;
DefaultRosterStore store = DefaultRosterStore.init(tmpFolder.newFolder("store"));
DirectoryRosterStore store = DirectoryRosterStore.init(tmpFolder.newFolder("store"));
populateStore(store);
ConnectionConfiguration conf = new ConnectionConfiguration("dummy");
@ -99,7 +99,7 @@ public class RosterVersioningTest {
for (RosterEntry entry : entries) {
items.add(RosterEntry.toRosterItem(entry));
}
RosterStore store = DefaultRosterStore.init(tmpFolder.newFolder());
RosterStore store = DirectoryRosterStore.init(tmpFolder.newFolder());
populateStore(store);
assertEquals("Elements of the roster", new HashSet<Item>(store.getEntries()), items);