Make type optional

This commit is contained in:
René Pfeuffer
2018-12-03 16:30:19 +01:00
parent 923cd75ff1
commit 33f3216164
21 changed files with 70 additions and 79 deletions

View File

@@ -65,10 +65,10 @@ public class XmlGroupDAO extends AbstractXmlDAO<Group, XmlGroupDatabase>
*/
@Inject
public XmlGroupDAO(ConfigurationStoreFactory storeFactory) {
super(storeFactory.
forType(XmlGroupDatabase.class)
.withName(STORE_NAME)
.build());
super(storeFactory
.withName(STORE_NAME)
.withType(XmlGroupDatabase.class)
.build());
}
//~--- methods --------------------------------------------------------------

View File

@@ -64,9 +64,10 @@ public class XmlUserDAO extends AbstractXmlDAO<User, XmlUserDatabase>
@Inject
public XmlUserDAO(ConfigurationStoreFactory storeFactory)
{
super(storeFactory.forType(XmlUserDatabase.class)
.withName(STORE_NAME)
.build());
super(storeFactory
.withName(STORE_NAME)
.withType(XmlUserDatabase.class)
.build());
}
//~--- methods --------------------------------------------------------------

View File

@@ -65,11 +65,11 @@ public class FileBlobStoreTest extends BlobStoreTestBase
@Test
@SuppressWarnings("unchecked")
public void shouldStoreAndLoadInRepository() {
BlobStore store = createBlobStoreFactory().
forType(StoreObject.class)
.withName("test")
.forRepository(new Repository("id", "git", "ns", "n"))
.build();
BlobStore store = createBlobStoreFactory()
.withName("test")
.withType(StoreObject.class)
.forRepository(new Repository("id", "git", "ns", "n"))
.build();
Blob createdBlob = store.create("abc");
List<Blob> storedBlobs = store.getAll();
@@ -78,6 +78,6 @@ public class FileBlobStoreTest extends BlobStoreTestBase
assertThat(storedBlobs)
.isNotNull()
.hasSize(1)
.usingElementComparatorOnFields("id").containsExactly(createdBlob);
.usingElementComparatorOnFields("id").containsExactly(createdBlob);
}
}

View File

@@ -132,10 +132,10 @@ public class JAXBConfigurationEntryStoreTest
ConfigurationEntryStore<AssignedPermission> store = createPermissionStore(RESOURCE_FIXED, name);
store.put("a45", new AssignedPermission("tuser4", "repository:create"));
store = createConfigurationStoreFactory().
forType(AssignedPermission.class)
.withName(name)
.build();
store = createConfigurationStoreFactory()
.withName(name)
.withType(AssignedPermission.class)
.build();
AssignedPermission ap = store.get("a45");
@@ -231,9 +231,9 @@ public class JAXBConfigurationEntryStoreTest
}
copy(resource, name);
return createConfigurationStoreFactory().
forType(AssignedPermission.class)
.withName(name)
.build();
return createConfigurationStoreFactory()
.withName(name)
.withType(AssignedPermission.class)
.build();
}
}

View File

@@ -56,11 +56,11 @@ public class JAXBConfigurationStoreTest extends StoreTestBase {
@SuppressWarnings("unchecked")
public void shouldStoreAndLoadInRepository()
{
ConfigurationStore<StoreObject> store = createStoreFactory().
forType(StoreObject.class)
.withName("test")
.forRepository(new Repository("id", "git", "ns", "n"))
.build();
ConfigurationStore<StoreObject> store = createStoreFactory()
.withName("test")
.withType(StoreObject.class)
.forRepository(new Repository("id", "git", "ns", "n"))
.build();
store.set(new StoreObject("value"));
StoreObject storeObject = store.get();

View File

@@ -61,16 +61,18 @@ public class JAXBDataStoreTest extends DataStoreTestBase {
@Override
protected DataStore getDataStore(Class type, Repository repository) {
return createDataStoreFactory().forType(type)
return createDataStoreFactory()
.withName("test")
.withType(type)
.forRepository(repository)
.build();
}
@Override
protected DataStore getDataStore(Class type) {
return createDataStoreFactory().forType(type)
return createDataStoreFactory()
.withName("test")
.withType(type)
.build();
}