diff --git a/server-application-server/source/java/ch/systemsx/cisd/openbis/generic/server/AfsRegistrator.java b/server-application-server/source/java/ch/systemsx/cisd/openbis/generic/server/AfsRegistrator.java index a301c29f25b4bb55aed223c6c5beaa9fb0f329b9..fff034c4d26436e54c84244cdfdae6d75b4353a3 100644 --- a/server-application-server/source/java/ch/systemsx/cisd/openbis/generic/server/AfsRegistrator.java +++ b/server-application-server/source/java/ch/systemsx/cisd/openbis/generic/server/AfsRegistrator.java @@ -37,6 +37,8 @@ public class AfsRegistrator implements IAfsRegistrator, ApplicationListener<Appl @Autowired IAfsRegistrator self; + private boolean registered; + @Override public void onApplicationEvent(final ApplicationEvent event) { Object source = event.getSource(); @@ -45,11 +47,8 @@ public class AfsRegistrator implements IAfsRegistrator, ApplicationListener<Appl AbstractApplicationContext appContext = (AbstractApplicationContext) source; if ((event instanceof ContextStartedEvent) || (event instanceof ContextRefreshedEvent)) { - if (appContext.getParent() != null) - { - // call the bean with transaction support - self.registerAfs(); - } + // call the bean with transaction support + self.registerAfs(); } } } @@ -57,6 +56,15 @@ public class AfsRegistrator implements IAfsRegistrator, ApplicationListener<Appl @Transactional public void registerAfs() { + synchronized (this) + { + if (registered) + { + return; + } + registered = true; + } + IDataStoreDAO dataStoreDAO = daoFactory.getDataStoreDAO(); DataStorePE existingDataStore = dataStoreDAO.tryToFindDataStoreByCode(AFS_DATA_STORE_CODE); diff --git a/server-application-server/source/java/service.properties b/server-application-server/source/java/service.properties index 716c82e074721f4530a577bc9ae59850fae7de49..2dd7a5a6b6a9bfac5dac96cabe29f2b328d2cda1 100644 --- a/server-application-server/source/java/service.properties +++ b/server-application-server/source/java/service.properties @@ -75,7 +75,7 @@ crowd.application.password = # The database instance local unique identifier. Used when the new database is created. database-instance = CISD -dss-rpc.put.dss-code = DSS1 +dss-rpc.put.dss-code = STANDARD openbis.support.email=openbis-support@id.ethz.ch trusted-cross-origin-domains= * diff --git a/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchDataStoreTest.java b/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchDataStoreTest.java index 7fa622f69f679166054da08a017a751d7ba73839..f1fbe4386583b50f5066ef533a864088cc515619 100644 --- a/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchDataStoreTest.java +++ b/server-application-server/sourceTest/java/ch/ethz/sis/openbis/systemtest/asapi/v3/SearchDataStoreTest.java @@ -35,7 +35,7 @@ public class SearchDataStoreTest extends AbstractTest @Test public void testSearchWithEmptyCriteria() { - testSearch(TEST_USER, new DataStoreSearchCriteria(), "STANDARD"); + testSearch(TEST_USER, new DataStoreSearchCriteria(), "AFS", "STANDARD"); } @Test diff --git a/server-application-server/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/CommonServerTest.java b/server-application-server/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/CommonServerTest.java index 9a71dfdb826575eb1d1fcc386da7ccc8bbfee71a..4b295e8652c9cff52609042a42a6ff5c774eaea6 100644 --- a/server-application-server/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/CommonServerTest.java +++ b/server-application-server/sourceTest/java/ch/systemsx/cisd/openbis/systemtest/CommonServerTest.java @@ -3549,8 +3549,10 @@ public class CommonServerTest extends SystemTestCase if (user.isInstanceUserOrSpaceUserOrEnabledProjectUser()) { List<DataStore> stores = commonServer.listDataStores(session.getSessionToken()); - assertEquals(stores.size(), 1); - assertEquals(stores.get(0).getCode(), "STANDARD"); + stores.sort(Comparator.comparing(DataStore::getCode)); + assertEquals(stores.size(), 2); + assertEquals(stores.get(0).getCode(), "AFS"); + assertEquals(stores.get(1).getCode(), "STANDARD"); } else { try