mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-08-26 20:27:23 +02:00
Use static method for new StoreParameters instance
This commit is contained in:
@@ -50,6 +50,7 @@ import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static sonia.scm.store.StoreParameters.forType;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -69,11 +70,11 @@ public abstract class BlobStoreTestBase extends AbstractTestBase
|
||||
@Before
|
||||
public void createBlobStore()
|
||||
{
|
||||
store = createBlobStoreFactory().getStore(new StoreParameters()
|
||||
.withType(Blob.class)
|
||||
.withName("test")
|
||||
.forRepository(RepositoryTestData.createHeartOfGold())
|
||||
.build()
|
||||
store = createBlobStoreFactory().getStore(
|
||||
forType(Blob.class)
|
||||
.withName("test")
|
||||
.forRepository(RepositoryTestData.createHeartOfGold())
|
||||
.build()
|
||||
);
|
||||
store.clear();
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ package sonia.scm.store;
|
||||
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
import static sonia.scm.store.StoreParameters.forType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -51,8 +53,7 @@ public abstract class ConfigurationEntryStoreTestBase extends KeyValueStoreTestB
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
@Override
|
||||
protected ConfigurationEntryStore getDataStore(Class type) {
|
||||
StoreParameters params = new StoreParameters()
|
||||
.withType(type)
|
||||
StoreParameters params = forType(type)
|
||||
.withName(storeName)
|
||||
.build();
|
||||
return this.createConfigurationStoreFactory().getStore(params);
|
||||
@@ -60,8 +61,7 @@ public abstract class ConfigurationEntryStoreTestBase extends KeyValueStoreTestB
|
||||
|
||||
@Override
|
||||
protected ConfigurationEntryStore getDataStore(Class type, Repository repository) {
|
||||
StoreParameters params = new StoreParameters()
|
||||
.withType(type)
|
||||
StoreParameters params = forType(type)
|
||||
.withName(repoStoreName)
|
||||
.forRepository(repository)
|
||||
.build();
|
||||
|
||||
@@ -39,6 +39,7 @@ import sonia.scm.repository.RepositoryTestData;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static sonia.scm.store.StoreParameters.forType;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -56,9 +57,8 @@ public abstract class DataStoreTestBase extends KeyValueStoreTestBase
|
||||
protected abstract DataStoreFactory createDataStoreFactory();
|
||||
|
||||
|
||||
protected StoreParameters getStoreParametersWithRepository(Repository repository) {
|
||||
return new StoreParameters()
|
||||
.withType(StoreObject.class)
|
||||
protected StoreParameters getStoreParametersWithRepository(Repository repository) {
|
||||
return forType(StoreObject.class)
|
||||
.withName("test")
|
||||
.forRepository(repository)
|
||||
.build();
|
||||
|
||||
@@ -36,11 +36,11 @@ package sonia.scm.store;
|
||||
|
||||
import org.junit.Test;
|
||||
import sonia.scm.AbstractTestBase;
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static sonia.scm.store.StoreParameters.forType;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -60,13 +60,6 @@ public abstract class StoreTestBase extends AbstractTestBase
|
||||
*/
|
||||
protected abstract ConfigurationStoreFactory createStoreFactory();
|
||||
|
||||
protected StoreParameters getStoreParameters() {
|
||||
return new StoreParameters()
|
||||
.withType(StoreObject.class)
|
||||
.withName("test")
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -74,7 +67,7 @@ public abstract class StoreTestBase extends AbstractTestBase
|
||||
@Test
|
||||
public void testGet()
|
||||
{
|
||||
ConfigurationStore<StoreObject> store = createStoreFactory().getStore(getStoreParameters());
|
||||
ConfigurationStore<StoreObject> store = createStoreFactory().getStore(forType(StoreObject.class).withName("test").build());
|
||||
|
||||
assertNotNull(store);
|
||||
|
||||
@@ -90,7 +83,7 @@ public abstract class StoreTestBase extends AbstractTestBase
|
||||
@Test
|
||||
public void testSet()
|
||||
{
|
||||
ConfigurationStore<StoreObject> store = createStoreFactory().getStore(getStoreParameters());
|
||||
ConfigurationStore<StoreObject> store = createStoreFactory().getStore(forType(StoreObject.class).withName("test").build());
|
||||
|
||||
assertNotNull(store);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user