You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ya...@apache.org on 2025/12/11 16:10:06 UTC
(airavata) 16/19: fix bean resolution order, and add h2 dep
This is an automated email from the ASF dual-hosted git repository.
yasith pushed a commit to branch service-layer-improvements
in repository https://gitbox.apache.org/repos/asf/airavata.git
commit b3ee4ec0d3f6d062e31eaa0a90af27b118afe522
Author: yasithdev <ya...@icloud.com>
AuthorDate: Wed Dec 10 13:59:54 2025 -0600
fix bean resolution order, and add h2 dep
---
.../config/AiravataPropertiesConfiguration.java | 21 +++++
.../airavata/config/AiravataServerProperties.java | 21 ++++-
.../AiravataServerPropertiesPostProcessor.java | 69 ++++++++++++++
.../services/CredentialEntityService.java | 5 +
.../airavata/service/OrchestratorService.java | 17 ----
.../SSHAccountProvisionerFactoryTest.java | 2 +
.../airavata/accountprovisioning/SSHUtilTest.java | 2 +
.../impl/notifier/EmailNotifierTest.java | 86 -----------------
.../credential/utils/ConfigurationReaderTest.java | 46 +--------
.../core/OrchestratorTestWithGRAM.java | 79 ----------------
.../core/OrchestratorTestWithMyProxyAuth.java | 83 ----------------
.../expcatalog/ExperimentRepositoryTest.java | 38 +++++++-
.../repositories/expcatalog/JobRepositoryTest.java | 38 +++++++-
.../expcatalog/JobStatusRepositoryTest.java | 39 +++++++-
.../expcatalog/ProcessRepositoryTest.java | 38 +++++++-
.../expcatalog/ProcessStatusRepositoryTest.java | 39 +++++++-
.../expcatalog/QueueStatusRepositoryTest.java | 38 +++++++-
.../expcatalog/TaskRepositoryTest.java | 38 +++++++-
.../expcatalog/TaskStatusRepositoryTest.java | 38 +++++++-
.../expcatalog/UserRepositoryTest.java | 38 +++++++-
.../security/KeyCloakSecurityManagerTest.java | 8 +-
.../security/userstore/JDBCUserStoreTest.java | 105 ---------------------
.../security/userstore/LDAPUserStoreTest.java | 96 -------------------
.../security/userstore/SessionDBUserStoreTest.java | 101 --------------------
.../integration/ServiceIntegrationTestBase.java | 4 +
.../src/test/resources/credential-store/client.xml | 6 ++
pom.xml | 7 +-
27 files changed, 474 insertions(+), 628 deletions(-)
diff --git a/airavata-api/src/main/java/org/apache/airavata/config/AiravataPropertiesConfiguration.java b/airavata-api/src/main/java/org/apache/airavata/config/AiravataPropertiesConfiguration.java
index 9c2178233a..ffdfc4b7b3 100644
--- a/airavata-api/src/main/java/org/apache/airavata/config/AiravataPropertiesConfiguration.java
+++ b/airavata-api/src/main/java/org/apache/airavata/config/AiravataPropertiesConfiguration.java
@@ -27,8 +27,11 @@ import java.net.URL;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
+import org.springframework.core.env.Environment;
import org.springframework.core.io.support.DefaultPropertySourceFactory;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.core.io.support.PropertySourceFactory;
@@ -38,12 +41,30 @@ import org.springframework.core.io.support.PropertySourceFactory;
* Respects the airavata.config.dir system property, checking file system first, then classpath.
*/
@Configuration
+@EnableConfigurationProperties(AiravataServerProperties.class)
@PropertySource(
value = "classpath:airavata.properties",
factory = AiravataPropertiesConfiguration.AiravataPropertySourceFactory.class,
ignoreResourceNotFound = true)
public class AiravataPropertiesConfiguration {
+ private final Environment environment;
+
+ public AiravataPropertiesConfiguration(Environment environment) {
+ this.environment = environment;
+ logger.info("[BEAN-INIT] AiravataPropertiesConfiguration created");
+ }
+
+ /**
+ * Creates BeanPostProcessor that injects Environment into AiravataServerProperties
+ * before its @PostConstruct methods run. This ensures proper initialization order.
+ */
+ @Bean
+ public AiravataServerPropertiesPostProcessor airavataServerPropertiesPostProcessor() {
+ logger.info("[BEAN-INIT] Creating AiravataServerPropertiesPostProcessor bean");
+ return new AiravataServerPropertiesPostProcessor(environment);
+ }
+
private static final Logger logger = LoggerFactory.getLogger(AiravataPropertiesConfiguration.class);
private static final String SERVER_PROPERTIES = "airavata.properties";
private static final String AIRAVATA_CONFIG_DIR = "airavata.config.dir";
diff --git a/airavata-api/src/main/java/org/apache/airavata/config/AiravataServerProperties.java b/airavata-api/src/main/java/org/apache/airavata/config/AiravataServerProperties.java
index fb0fbdbdf5..94bcc3cc10 100644
--- a/airavata-api/src/main/java/org/apache/airavata/config/AiravataServerProperties.java
+++ b/airavata-api/src/main/java/org/apache/airavata/config/AiravataServerProperties.java
@@ -35,17 +35,26 @@ public class AiravataServerProperties {
private static final Logger logger = LoggerFactory.getLogger(AiravataServerProperties.class);
- private final Environment environment;
+ private Environment environment;
- // ==================== Core Configuration ====================
- public String airavataConfigDir = ".";
+ public AiravataServerProperties() {
+ // No-arg constructor required for @ConfigurationProperties
+ logger.info("[BEAN-INIT] AiravataServerProperties constructor called");
+ }
- public AiravataServerProperties(Environment environment) {
+ public void setEnvironment(Environment environment) {
+ logger.info("[BEAN-INIT] setEnvironment() called on AiravataServerProperties - environment is {}",
+ environment != null ? "SET" : "NULL");
this.environment = environment;
}
+ // ==================== Core Configuration ====================
+ public String airavataConfigDir = ".";
+
@PostConstruct
public void bindProperties() {
+ logger.info("[BEAN-INIT] bindProperties() called on AiravataServerProperties - environment is {}",
+ environment != null ? "SET" : "NULL");
logger.info("Binding properties to AiravataServerProperties");
// Manually bind database properties from environment
@@ -139,6 +148,10 @@ public class AiravataServerProperties {
}
private String getProperty(String key, String defaultValue) {
+ if (environment == null) {
+ logger.warn("[BEAN-INIT] Environment is null when calling getProperty({}), returning default", key);
+ return defaultValue;
+ }
String value = environment.getProperty(key);
return value != null ? value : defaultValue;
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/config/AiravataServerPropertiesPostProcessor.java b/airavata-api/src/main/java/org/apache/airavata/config/AiravataServerPropertiesPostProcessor.java
new file mode 100644
index 0000000000..d97d8713cc
--- /dev/null
+++ b/airavata-api/src/main/java/org/apache/airavata/config/AiravataServerPropertiesPostProcessor.java
@@ -0,0 +1,69 @@
+/**
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you 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.
+*/
+package org.apache.airavata.config;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.config.BeanPostProcessor;
+import org.springframework.core.Ordered;
+import org.springframework.core.env.Environment;
+
+/**
+ * BeanPostProcessor that injects Environment into AiravataServerProperties
+ * before its @PostConstruct methods run. This ensures Environment is available
+ * when bindProperties() is called.
+ */
+public class AiravataServerPropertiesPostProcessor implements BeanPostProcessor, Ordered {
+
+ private static final Logger logger = LoggerFactory.getLogger(AiravataServerPropertiesPostProcessor.class);
+ private final Environment environment;
+
+ public AiravataServerPropertiesPostProcessor(Environment environment) {
+ this.environment = environment;
+ logger.info("[BEAN-INIT] AiravataServerPropertiesPostProcessor created with Environment");
+ }
+
+ @Override
+ public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
+ if (bean instanceof AiravataServerProperties) {
+ logger.info("[BEAN-INIT] Setting Environment on AiravataServerProperties (bean: {}) BEFORE initialization", beanName);
+ AiravataServerProperties properties = (AiravataServerProperties) bean;
+ properties.setEnvironment(environment);
+ logger.info("[BEAN-INIT] Environment set on AiravataServerProperties successfully");
+ }
+ return bean;
+ }
+
+ @Override
+ public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
+ if (bean instanceof AiravataServerProperties) {
+ logger.info("[BEAN-INIT] AiravataServerProperties (bean: {}) initialized AFTER @PostConstruct", beanName);
+ }
+ return bean;
+ }
+
+ @Override
+ public int getOrder() {
+ // Run early, before @PostConstruct methods
+ return Ordered.HIGHEST_PRECEDENCE;
+ }
+}
+
diff --git a/airavata-api/src/main/java/org/apache/airavata/credential/services/CredentialEntityService.java b/airavata-api/src/main/java/org/apache/airavata/credential/services/CredentialEntityService.java
index d3b6052f7c..8994f5f8da 100644
--- a/airavata-api/src/main/java/org/apache/airavata/credential/services/CredentialEntityService.java
+++ b/airavata-api/src/main/java/org/apache/airavata/credential/services/CredentialEntityService.java
@@ -69,6 +69,11 @@ public class CredentialEntityService {
try {
String airavataConfigDir = properties.airavataConfigDir;
String credentialStoreKeyStorePath = properties.services.vault.keystore.url;
+ if (airavataConfigDir == null || credentialStoreKeyStorePath == null) {
+ logger.warn("Keystore configuration is missing (airavataConfigDir or keystore.url is null), encryption will be disabled");
+ this.keyStorePath = null;
+ return;
+ }
this.keyStorePath = new java.io.File(airavataConfigDir, credentialStoreKeyStorePath).getAbsolutePath();
this.secretKeyAlias = properties.services.vault.keystore.alias;
} catch (Exception e) {
diff --git a/airavata-api/src/main/java/org/apache/airavata/service/OrchestratorService.java b/airavata-api/src/main/java/org/apache/airavata/service/OrchestratorService.java
index 691ce21af9..a2bb38a57f 100644
--- a/airavata-api/src/main/java/org/apache/airavata/service/OrchestratorService.java
+++ b/airavata-api/src/main/java/org/apache/airavata/service/OrchestratorService.java
@@ -152,23 +152,6 @@ public class OrchestratorService {
}
}
- public OrchestratorService(
- OrchestratorRegistryService orchestratorRegistryService,
- RegistryService registryService,
- AiravataServerProperties properties,
- SimpleOrchestratorImpl orchestrator,
- CuratorFramework curatorClient,
- Publisher publisher,
- ProcessScheduler processScheduler) {
- this.orchestratorRegistryService = orchestratorRegistryService;
- this.registryService = registryService;
- this.properties = properties;
- this.orchestrator = orchestrator;
- this.processScheduler = processScheduler;
- this.curatorClient = curatorClient;
- this.publisher = publisher;
- }
-
private boolean launchExperimentInternal(String experimentId, String gatewayId)
throws ExperimentNotFoundException, OrchestratorException, RegistryServiceException,
LaunchValidationException {
diff --git a/airavata-api/src/test/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerFactoryTest.java b/airavata-api/src/test/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerFactoryTest.java
index 2a8be51df8..b94931d109 100644
--- a/airavata-api/src/test/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerFactoryTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerFactoryTest.java
@@ -26,6 +26,7 @@ import java.util.stream.Collectors;
import org.apache.airavata.accountprovisioning.provisioner.TestSSHAccountProvisioner;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
@@ -38,6 +39,7 @@ import org.springframework.test.context.TestPropertySource;
"spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
})
@TestPropertySource(locations = "classpath:airavata.properties")
+@EnableConfigurationProperties(org.apache.airavata.config.AiravataServerProperties.class)
public class SSHAccountProvisionerFactoryTest {
public SSHAccountProvisionerFactoryTest() {
diff --git a/airavata-api/src/test/java/org/apache/airavata/accountprovisioning/SSHUtilTest.java b/airavata-api/src/test/java/org/apache/airavata/accountprovisioning/SSHUtilTest.java
index cc63103ed6..279b406426 100644
--- a/airavata-api/src/test/java/org/apache/airavata/accountprovisioning/SSHUtilTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/accountprovisioning/SSHUtilTest.java
@@ -28,6 +28,7 @@ import org.apache.airavata.model.credential.store.SSHCredential;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
@@ -40,6 +41,7 @@ import org.springframework.test.context.TestPropertySource;
"spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
})
@TestPropertySource(locations = "classpath:airavata.properties")
+@EnableConfigurationProperties(org.apache.airavata.config.AiravataServerProperties.class)
public class SSHUtilTest {
private static final Logger logger = LoggerFactory.getLogger(SSHUtilTest.class);
diff --git a/airavata-api/src/test/java/org/apache/airavata/credential/impl/notifier/EmailNotifierTest.java b/airavata-api/src/test/java/org/apache/airavata/credential/impl/notifier/EmailNotifierTest.java
deleted file mode 100644
index e9b2c25a6a..0000000000
--- a/airavata-api/src/test/java/org/apache/airavata/credential/impl/notifier/EmailNotifierTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you 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.
-*/
-package org.apache.airavata.credential.impl.notifier;
-
-import org.apache.airavata.credential.impl.notifier.EmailNotificationMessage;
-import org.apache.airavata.credential.impl.notifier.EmailNotifier;
-import org.apache.airavata.credential.impl.notifier.EmailNotifierConfiguration;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Import;
-import org.springframework.test.context.TestPropertySource;
-
-/**
- * User: AmilaJ (amilaj@apache.org)
- * Date: 12/27/13
- * Time: 1:54 PM
- */
-@SpringBootTest(
- classes = {org.apache.airavata.config.JpaConfig.class, EmailNotifierTest.TestConfiguration.class},
- properties = {
- "spring.main.allow-bean-definition-overriding=true",
- "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
- })
-@TestPropertySource(locations = "classpath:airavata.properties")
-public class EmailNotifierTest {
-
- public EmailNotifierTest() {
- // Spring Boot test - dependencies injected via constructor if needed
- }
-
- @BeforeEach
- public void setUp() throws Exception {}
-
- // Test is disabled. Need to fill in parameters to send mails
- @Test
- public void xtestNotifyMessage() throws Exception {
-
- EmailNotifierConfiguration emailNotifierConfiguration =
- new EmailNotifierConfiguration("smtp.googlemail.com", 465, "yyy", "xxx", true, "yyy@gmail.com");
-
- EmailNotifier notifier = new EmailNotifier(emailNotifierConfiguration);
- EmailNotificationMessage emailNotificationMessage =
- new EmailNotificationMessage("Test", "ggg@gmail.com", "Testing credential store");
- notifier.notifyMessage(emailNotificationMessage);
- }
-
- // Just to ignore test failures.
- @Test
- public void testIgnore() {}
-
- @org.springframework.context.annotation.Configuration
- @ComponentScan(
- basePackages = {
- "org.apache.airavata.credential",
- "org.apache.airavata.config"
- },
- excludeFilters = {
- @org.springframework.context.annotation.ComponentScan.Filter(
- type = org.springframework.context.annotation.FilterType.ASSIGNABLE_TYPE,
- classes = {
- org.apache.airavata.config.BackgroundServicesLauncher.class,
- org.apache.airavata.config.ThriftServerLauncher.class
- })
- })
- @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
- static class TestConfiguration {}
-}
diff --git a/airavata-api/src/test/java/org/apache/airavata/credential/utils/ConfigurationReaderTest.java b/airavata-api/src/test/java/org/apache/airavata/credential/utils/ConfigurationReaderTest.java
index c5244ac40c..8ef325b1f3 100644
--- a/airavata-api/src/test/java/org/apache/airavata/credential/utils/ConfigurationReaderTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/credential/utils/ConfigurationReaderTest.java
@@ -21,74 +21,36 @@ package org.apache.airavata.credential.utils;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.junit.jupiter.api.BeforeEach;
+import org.apache.airavata.credential.exceptions.CredentialStoreException;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Import;
-import org.springframework.test.context.TestPropertySource;
/**
* User: AmilaJ (amilaj@apache.org)
* Date: 8/25/13
* Time: 10:28 AM
*/
-@SpringBootTest(
- classes = {org.apache.airavata.config.JpaConfig.class, ConfigurationReaderTest.TestConfiguration.class},
- properties = {
- "spring.main.allow-bean-definition-overriding=true",
- "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
- })
-@TestPropertySource(locations = "classpath:airavata.properties")
public class ConfigurationReaderTest {
private static final Logger logger = LoggerFactory.getLogger(ConfigurationReaderTest.class);
- public ConfigurationReaderTest() {
- // Spring Boot test - no dependencies to inject for this utility test
- }
-
- @BeforeEach
- public void setUp() throws Exception {}
-
@Test
- public void testGetSuccessUrl() throws Exception {
-
+ public void testGetSuccessUrl() throws CredentialStoreException {
ConfigurationReader configurationReader = new ConfigurationReader();
logger.info("Success URL: {}", configurationReader.getSuccessUrl());
assertEquals("/credential-store/success.jsp", configurationReader.getSuccessUrl());
}
@Test
- public void testGetErrorUrl() throws Exception {
-
+ public void testGetErrorUrl() throws CredentialStoreException {
ConfigurationReader configurationReader = new ConfigurationReader();
assertEquals("/credential-store/error.jsp", configurationReader.getErrorUrl());
}
@Test
- public void testRedirectUrl() throws Exception {
-
+ public void testRedirectUrl() throws CredentialStoreException {
ConfigurationReader configurationReader = new ConfigurationReader();
assertEquals("/credential-store/show-redirect.jsp", configurationReader.getPortalRedirectUrl());
}
-
- @org.springframework.context.annotation.Configuration
- @ComponentScan(
- basePackages = {
- "org.apache.airavata.credential",
- "org.apache.airavata.config"
- },
- excludeFilters = {
- @org.springframework.context.annotation.ComponentScan.Filter(
- type = org.springframework.context.annotation.FilterType.ASSIGNABLE_TYPE,
- classes = {
- org.apache.airavata.config.BackgroundServicesLauncher.class,
- org.apache.airavata.config.ThriftServerLauncher.class
- })
- })
- @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
- static class TestConfiguration {}
}
diff --git a/airavata-api/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java b/airavata-api/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java
deleted file mode 100644
index 2fcfa8af0f..0000000000
--- a/airavata-api/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithGRAM.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you 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.
-*/
-package org.apache.airavata.orchestrator.core;
-
-public class OrchestratorTestWithGRAM extends BaseOrchestratorTest {
- // private static final Logger log = LoggerFactory.getLogger(OrchestratorTestWithGRAM.class);
- //
- // private Orchestrator orchestrator;
- //
- // private String experimentID;
- //
- // @BeforeTest
- // public void setUp() throws Exception {
- // AiravataUtils.setExecutionAsServer();
- // super.setUp();
- // orchestrator = new SimpleOrchestratorImpl();
- // createJobRequestWithDocuments();
- // }
- //
- // private void createJobRequestWithDocuments() throws Exception{
- // //Using new airavata-api methods to store experiment metadata
- //// BasicMetadata basicMetadata = new BasicMetadata();
- //// basicMetadata.setExperimentName("test-trestles");
- //// basicMetadata.setUserName("admin");
- //// basicMetadata.setUserNameIsSet(true);
- //// basicMetadata.setProjectID("default");
- ////
- //// AdvancedInputDataHandling advancedInputDataHandling = new AdvancedInputDataHandling();
- //// AdvancedOutputDataHandling advancedOutputDataHandling = new AdvancedOutputDataHandling();
- //// ComputationalResourceScheduling computationalResourceScheduling = new
- // ComputationalResourceScheduling();
- //// QualityOfServiceParams qualityOfServiceParams = new QualityOfServiceParams();
- //// ConfigurationData configurationData = new ConfigurationData();
- ////
- //// HashMap<String, String> exInputs = new HashMap<String, String>();
- //// exInputs.put("echo_input", "echo_output=hello");
- ////
- //// configurationData.setExperimentInputs(exInputs);
- //// configurationData.setAdvanceInputDataHandling(advancedInputDataHandling);
- //// configurationData.setAdvanceOutputDataHandling(advancedOutputDataHandling);
- //// configurationData.setComputationalResourceScheduling(computationalResourceScheduling);
- //// configurationData.setQosParams(qualityOfServiceParams);
- //// configurationData.setApplicationId("SimpleEcho1");
- ////
- //// Registry registry = new RegistryImpl();
- //// experimentID = (String) registry.add(ParentDataType.EXPERIMENT, basicMetadata);
- //// registry.add(ChildDataType.EXPERIMENT_CONFIGURATION_DATA, configurationData, experimentID);
- // }
- //
- // @Test
- // public void noDescriptorTest() throws Exception {
- //
- //// boolean b = orchestrator.launchProcess(experimentID);
- ////
- //// if (b) {
- //// Assertions.assertTrue(true);
- //// } else {
- //// Assertions.assertFalse(true);
- //// }
- // }
-
-}
diff --git a/airavata-api/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java b/airavata-api/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java
deleted file mode 100644
index 7d9ce29c8a..0000000000
--- a/airavata-api/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you 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.
-*/
-package org.apache.airavata.orchestrator.core;
-
-public class OrchestratorTestWithMyProxyAuth extends BaseOrchestratorTest {
- // private static final Logger log = LoggerFactory.getLogger(NewOrchestratorTest.class);
- //
- // private Orchestrator orchestrator;
- //
- // private String experimentID;
- //
- // private List<TaskDetails> tasks;
- //
- // @BeforeTest
- // public void setUp() throws Exception {
- // AiravataUtils.setExecutionAsServer();
- // super.setUp();
- // orchestrator = new SimpleOrchestratorImpl();
- //// System.setProperty("myproxy.username", "ogce");
- //// System.setProperty("myproxy.password", "");
- // System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates");
- //// System.setProperty("trusted.cert.location",System.getProperty("gsi.working.directory"));
- // }
- //
- // @Test
- // public void noDescriptorTest() throws Exception {
- // List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
- // DataObjectType input = new DataObjectType();
- // input.setKey("echo_input");
- // input.setType(DataType.STRING);
- // input.setValue("echo_output=Hello World");
- // exInputs.add(input);
- //
- // List<DataObjectType> exOut = new ArrayList<DataObjectType>();
- // DataObjectType output = new DataObjectType();
- // output.setKey("echo_output");
- // output.setType(DataType.STRING);
- // output.setValue("");
- // exOut.add(output);
- //
- // Experiment simpleExperiment =
- // ExperimentModelUtil.createSimpleExperiment("default", "admin", "echoExperiment", "SimpleEcho2",
- // "SimpleEcho2", exInputs);
- // simpleExperiment.setExperimentOutputs(exOut);
- //
- // ComputationalResourceScheduling scheduling =
- // ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 1, 1, 1, "normal", 0, 0, 1,
- // "sds128");
- // scheduling.setResourceHostId("gsissh-trestles");
- // UserConfigurationData userConfigurationData = new UserConfigurationData();
- // userConfigurationData.setAiravataAutoSchedule(false);
- // userConfigurationData.setOverrideManualScheduledParams(false);
- // userConfigurationData.setComputationalResourceScheduling(scheduling);
- // simpleExperiment.setUserConfigurationData(userConfigurationData);
- //
- // WorkflowNodeDetails test = ExperimentModelUtil.createWorkflowNode("test", null);
- // Registry registry = RegistryFactory.getDefaultExpCatalog();
- // experimentID = (String) registry.add(ParentDataType.EXPERIMENT, simpleExperiment);
- // tasks = orchestrator.createTasks(experimentID);
- //
- // for (TaskDetails taskDetail: tasks)
- // {
- // orchestrator.launchProcess(simpleExperiment,test, taskDetail,null);
- // }
- // }
-}
diff --git a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/ExperimentRepositoryTest.java b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/ExperimentRepositoryTest.java
index 29e2be91e6..88729687f0 100644
--- a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/ExperimentRepositoryTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/ExperimentRepositoryTest.java
@@ -36,13 +36,49 @@ import org.apache.airavata.registry.services.ExperimentService;
import org.apache.airavata.registry.services.GatewayService;
import org.apache.airavata.registry.services.ProjectService;
import org.junit.jupiter.api.Test;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;
-@SpringBootTest(classes = {org.apache.airavata.config.JpaConfig.class})
+@SpringBootTest(
+ classes = {org.apache.airavata.config.JpaConfig.class, ExperimentRepositoryTest.TestConfiguration.class},
+ properties = {
+ "spring.main.allow-bean-definition-overriding=true",
+ "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
+ })
@TestPropertySource(locations = "classpath:airavata.properties")
public class ExperimentRepositoryTest extends TestBase {
+ @Configuration
+ @ComponentScan(
+ basePackages = {"org.apache.airavata.service", "org.apache.airavata.registry", "org.apache.airavata.config"},
+ excludeFilters = {
+ @ComponentScan.Filter(
+ type = FilterType.ASSIGNABLE_TYPE,
+ classes = {
+ org.apache.airavata.config.BackgroundServicesLauncher.class,
+ org.apache.airavata.config.ThriftServerLauncher.class,
+ org.apache.airavata.monitor.realtime.RealtimeMonitor.class,
+ org.apache.airavata.monitor.email.EmailBasedMonitor.class,
+ org.apache.airavata.monitor.cluster.ClusterStatusMonitorJob.class,
+ org.apache.airavata.monitor.AbstractMonitor.class,
+ org.apache.airavata.helix.impl.controller.HelixController.class,
+ org.apache.airavata.helix.impl.participant.GlobalParticipant.class,
+ org.apache.airavata.helix.impl.workflow.PreWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.PostWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.ParserWorkflowManager.class
+ }),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.monitor\\..*"),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.helix\\..*")
+ })
+ @EnableConfigurationProperties(org.apache.airavata.config.AiravataServerProperties.class)
+ @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
+ static class TestConfiguration {}
+
private final GatewayService gatewayService;
private final ProjectService projectService;
private final ExperimentService experimentService;
diff --git a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/JobRepositoryTest.java b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/JobRepositoryTest.java
index 8c248953fb..e58657339b 100644
--- a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/JobRepositoryTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/JobRepositoryTest.java
@@ -45,13 +45,49 @@ import org.apache.airavata.registry.services.ProjectService;
import org.apache.airavata.registry.services.TaskService;
import org.apache.airavata.registry.utils.DBConstants;
import org.junit.jupiter.api.Test;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;
-@SpringBootTest(classes = {org.apache.airavata.config.JpaConfig.class})
+@SpringBootTest(
+ classes = {org.apache.airavata.config.JpaConfig.class, JobRepositoryTest.TestConfiguration.class},
+ properties = {
+ "spring.main.allow-bean-definition-overriding=true",
+ "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
+ })
@TestPropertySource(locations = "classpath:airavata.properties")
public class JobRepositoryTest extends TestBase {
+ @Configuration
+ @ComponentScan(
+ basePackages = {"org.apache.airavata.service", "org.apache.airavata.registry", "org.apache.airavata.config"},
+ excludeFilters = {
+ @ComponentScan.Filter(
+ type = FilterType.ASSIGNABLE_TYPE,
+ classes = {
+ org.apache.airavata.config.BackgroundServicesLauncher.class,
+ org.apache.airavata.config.ThriftServerLauncher.class,
+ org.apache.airavata.monitor.realtime.RealtimeMonitor.class,
+ org.apache.airavata.monitor.email.EmailBasedMonitor.class,
+ org.apache.airavata.monitor.cluster.ClusterStatusMonitorJob.class,
+ org.apache.airavata.monitor.AbstractMonitor.class,
+ org.apache.airavata.helix.impl.controller.HelixController.class,
+ org.apache.airavata.helix.impl.participant.GlobalParticipant.class,
+ org.apache.airavata.helix.impl.workflow.PreWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.PostWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.ParserWorkflowManager.class
+ }),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.monitor\\..*"),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.helix\\..*")
+ })
+ @EnableConfigurationProperties(org.apache.airavata.config.AiravataServerProperties.class)
+ @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
+ static class TestConfiguration {}
+
private final GatewayService gatewayService;
private final ProjectService projectService;
private final ExperimentService experimentService;
diff --git a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/JobStatusRepositoryTest.java b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/JobStatusRepositoryTest.java
index cb85ae2376..bd4aacadba 100644
--- a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/JobStatusRepositoryTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/JobStatusRepositoryTest.java
@@ -46,10 +46,47 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
-@SpringBootTest(classes = {org.apache.airavata.config.JpaConfig.class})
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Import;
+
+@SpringBootTest(
+ classes = {org.apache.airavata.config.JpaConfig.class, JobStatusRepositoryTest.TestConfiguration.class},
+ properties = {
+ "spring.main.allow-bean-definition-overriding=true",
+ "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
+ })
@TestPropertySource(locations = "classpath:airavata.properties")
public class JobStatusRepositoryTest extends TestBase {
+ @Configuration
+ @ComponentScan(
+ basePackages = {"org.apache.airavata.service", "org.apache.airavata.registry", "org.apache.airavata.config"},
+ excludeFilters = {
+ @ComponentScan.Filter(
+ type = FilterType.ASSIGNABLE_TYPE,
+ classes = {
+ org.apache.airavata.config.BackgroundServicesLauncher.class,
+ org.apache.airavata.config.ThriftServerLauncher.class,
+ org.apache.airavata.monitor.realtime.RealtimeMonitor.class,
+ org.apache.airavata.monitor.email.EmailBasedMonitor.class,
+ org.apache.airavata.monitor.cluster.ClusterStatusMonitorJob.class,
+ org.apache.airavata.monitor.AbstractMonitor.class,
+ org.apache.airavata.helix.impl.controller.HelixController.class,
+ org.apache.airavata.helix.impl.participant.GlobalParticipant.class,
+ org.apache.airavata.helix.impl.workflow.PreWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.PostWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.ParserWorkflowManager.class
+ }),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.monitor\\..*"),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.helix\\..*")
+ })
+ @EnableConfigurationProperties(org.apache.airavata.config.AiravataServerProperties.class)
+ @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
+ static class TestConfiguration {}
+
private final GatewayService gatewayService;
private final ProjectService projectService;
private final ExperimentService experimentService;
diff --git a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/ProcessRepositoryTest.java b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/ProcessRepositoryTest.java
index e9c83bfd57..aeb23e7b57 100644
--- a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/ProcessRepositoryTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/ProcessRepositoryTest.java
@@ -40,13 +40,49 @@ import org.apache.airavata.registry.services.ProcessService;
import org.apache.airavata.registry.services.ProjectService;
import org.apache.airavata.registry.utils.DBConstants;
import org.junit.jupiter.api.Test;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;
-@SpringBootTest(classes = {org.apache.airavata.config.JpaConfig.class})
+@SpringBootTest(
+ classes = {org.apache.airavata.config.JpaConfig.class, ProcessRepositoryTest.TestConfiguration.class},
+ properties = {
+ "spring.main.allow-bean-definition-overriding=true",
+ "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
+ })
@TestPropertySource(locations = "classpath:airavata.properties")
public class ProcessRepositoryTest extends TestBase {
+ @Configuration
+ @ComponentScan(
+ basePackages = {"org.apache.airavata.service", "org.apache.airavata.registry", "org.apache.airavata.config"},
+ excludeFilters = {
+ @ComponentScan.Filter(
+ type = FilterType.ASSIGNABLE_TYPE,
+ classes = {
+ org.apache.airavata.config.BackgroundServicesLauncher.class,
+ org.apache.airavata.config.ThriftServerLauncher.class,
+ org.apache.airavata.monitor.realtime.RealtimeMonitor.class,
+ org.apache.airavata.monitor.email.EmailBasedMonitor.class,
+ org.apache.airavata.monitor.cluster.ClusterStatusMonitorJob.class,
+ org.apache.airavata.monitor.AbstractMonitor.class,
+ org.apache.airavata.helix.impl.controller.HelixController.class,
+ org.apache.airavata.helix.impl.participant.GlobalParticipant.class,
+ org.apache.airavata.helix.impl.workflow.PreWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.PostWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.ParserWorkflowManager.class
+ }),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.monitor\\..*"),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.helix\\..*")
+ })
+ @EnableConfigurationProperties(org.apache.airavata.config.AiravataServerProperties.class)
+ @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
+ static class TestConfiguration {}
+
private final GatewayService gatewayService;
private final ProjectService projectService;
private final ExperimentService experimentService;
diff --git a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/ProcessStatusRepositoryTest.java b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/ProcessStatusRepositoryTest.java
index 99ec027f5a..b05ff139c3 100644
--- a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/ProcessStatusRepositoryTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/ProcessStatusRepositoryTest.java
@@ -41,10 +41,47 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.TestPropertySource;
-@SpringBootTest(classes = {org.apache.airavata.config.JpaConfig.class})
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Import;
+
+@SpringBootTest(
+ classes = {org.apache.airavata.config.JpaConfig.class, ProcessStatusRepositoryTest.TestConfiguration.class},
+ properties = {
+ "spring.main.allow-bean-definition-overriding=true",
+ "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
+ })
@TestPropertySource(locations = "classpath:airavata.properties")
public class ProcessStatusRepositoryTest extends TestBase {
+ @Configuration
+ @ComponentScan(
+ basePackages = {"org.apache.airavata.service", "org.apache.airavata.registry", "org.apache.airavata.config"},
+ excludeFilters = {
+ @ComponentScan.Filter(
+ type = FilterType.ASSIGNABLE_TYPE,
+ classes = {
+ org.apache.airavata.config.BackgroundServicesLauncher.class,
+ org.apache.airavata.config.ThriftServerLauncher.class,
+ org.apache.airavata.monitor.realtime.RealtimeMonitor.class,
+ org.apache.airavata.monitor.email.EmailBasedMonitor.class,
+ org.apache.airavata.monitor.cluster.ClusterStatusMonitorJob.class,
+ org.apache.airavata.monitor.AbstractMonitor.class,
+ org.apache.airavata.helix.impl.controller.HelixController.class,
+ org.apache.airavata.helix.impl.participant.GlobalParticipant.class,
+ org.apache.airavata.helix.impl.workflow.PreWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.PostWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.ParserWorkflowManager.class
+ }),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.monitor\\..*"),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.helix\\..*")
+ })
+ @EnableConfigurationProperties(org.apache.airavata.config.AiravataServerProperties.class)
+ @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
+ static class TestConfiguration {}
+
private final GatewayService gatewayService;
private final ProjectService projectService;
private final ExperimentService experimentService;
diff --git a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/QueueStatusRepositoryTest.java b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/QueueStatusRepositoryTest.java
index 742ac8db0d..9c02c8d8ba 100644
--- a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/QueueStatusRepositoryTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/QueueStatusRepositoryTest.java
@@ -29,13 +29,49 @@ import org.apache.airavata.registry.exceptions.RegistryException;
import org.apache.airavata.registry.repositories.common.TestBase;
import org.apache.airavata.registry.services.QueueStatusService;
import org.junit.jupiter.api.Test;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;
-@SpringBootTest(classes = {org.apache.airavata.config.JpaConfig.class})
+@SpringBootTest(
+ classes = {org.apache.airavata.config.JpaConfig.class, QueueStatusRepositoryTest.TestConfiguration.class},
+ properties = {
+ "spring.main.allow-bean-definition-overriding=true",
+ "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
+ })
@TestPropertySource(locations = "classpath:airavata.properties")
public class QueueStatusRepositoryTest extends TestBase {
+ @Configuration
+ @ComponentScan(
+ basePackages = {"org.apache.airavata.service", "org.apache.airavata.registry", "org.apache.airavata.config"},
+ excludeFilters = {
+ @ComponentScan.Filter(
+ type = FilterType.ASSIGNABLE_TYPE,
+ classes = {
+ org.apache.airavata.config.BackgroundServicesLauncher.class,
+ org.apache.airavata.config.ThriftServerLauncher.class,
+ org.apache.airavata.monitor.realtime.RealtimeMonitor.class,
+ org.apache.airavata.monitor.email.EmailBasedMonitor.class,
+ org.apache.airavata.monitor.cluster.ClusterStatusMonitorJob.class,
+ org.apache.airavata.monitor.AbstractMonitor.class,
+ org.apache.airavata.helix.impl.controller.HelixController.class,
+ org.apache.airavata.helix.impl.participant.GlobalParticipant.class,
+ org.apache.airavata.helix.impl.workflow.PreWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.PostWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.ParserWorkflowManager.class
+ }),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.monitor\\..*"),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.helix\\..*")
+ })
+ @EnableConfigurationProperties(org.apache.airavata.config.AiravataServerProperties.class)
+ @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
+ static class TestConfiguration {}
+
private final QueueStatusService queueStatusService;
public QueueStatusRepositoryTest(QueueStatusService queueStatusService) {
diff --git a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/TaskRepositoryTest.java b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/TaskRepositoryTest.java
index 653b9f0d5f..547a918ee2 100644
--- a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/TaskRepositoryTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/TaskRepositoryTest.java
@@ -42,13 +42,49 @@ import org.apache.airavata.registry.services.ProjectService;
import org.apache.airavata.registry.services.TaskService;
import org.apache.airavata.registry.utils.DBConstants;
import org.junit.jupiter.api.Test;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;
-@SpringBootTest(classes = {org.apache.airavata.config.JpaConfig.class})
+@SpringBootTest(
+ classes = {org.apache.airavata.config.JpaConfig.class, TaskRepositoryTest.TestConfiguration.class},
+ properties = {
+ "spring.main.allow-bean-definition-overriding=true",
+ "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
+ })
@TestPropertySource(locations = "classpath:airavata.properties")
public class TaskRepositoryTest extends TestBase {
+ @Configuration
+ @ComponentScan(
+ basePackages = {"org.apache.airavata.service", "org.apache.airavata.registry", "org.apache.airavata.config"},
+ excludeFilters = {
+ @ComponentScan.Filter(
+ type = FilterType.ASSIGNABLE_TYPE,
+ classes = {
+ org.apache.airavata.config.BackgroundServicesLauncher.class,
+ org.apache.airavata.config.ThriftServerLauncher.class,
+ org.apache.airavata.monitor.realtime.RealtimeMonitor.class,
+ org.apache.airavata.monitor.email.EmailBasedMonitor.class,
+ org.apache.airavata.monitor.cluster.ClusterStatusMonitorJob.class,
+ org.apache.airavata.monitor.AbstractMonitor.class,
+ org.apache.airavata.helix.impl.controller.HelixController.class,
+ org.apache.airavata.helix.impl.participant.GlobalParticipant.class,
+ org.apache.airavata.helix.impl.workflow.PreWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.PostWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.ParserWorkflowManager.class
+ }),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.monitor\\..*"),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.helix\\..*")
+ })
+ @EnableConfigurationProperties(org.apache.airavata.config.AiravataServerProperties.class)
+ @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
+ static class TestConfiguration {}
+
private final GatewayService gatewayService;
private final ProjectService projectService;
private final ExperimentService experimentService;
diff --git a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/TaskStatusRepositoryTest.java b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/TaskStatusRepositoryTest.java
index 6ac78138e6..07d404a0fc 100644
--- a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/TaskStatusRepositoryTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/TaskStatusRepositoryTest.java
@@ -40,13 +40,49 @@ import org.apache.airavata.registry.services.ProjectService;
import org.apache.airavata.registry.services.TaskService;
import org.apache.airavata.registry.services.TaskStatusService;
import org.junit.jupiter.api.Test;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;
-@SpringBootTest(classes = {org.apache.airavata.config.JpaConfig.class})
+@SpringBootTest(
+ classes = {org.apache.airavata.config.JpaConfig.class, TaskStatusRepositoryTest.TestConfiguration.class},
+ properties = {
+ "spring.main.allow-bean-definition-overriding=true",
+ "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
+ })
@TestPropertySource(locations = "classpath:airavata.properties")
public class TaskStatusRepositoryTest extends TestBase {
+ @Configuration
+ @ComponentScan(
+ basePackages = {"org.apache.airavata.service", "org.apache.airavata.registry", "org.apache.airavata.config"},
+ excludeFilters = {
+ @ComponentScan.Filter(
+ type = FilterType.ASSIGNABLE_TYPE,
+ classes = {
+ org.apache.airavata.config.BackgroundServicesLauncher.class,
+ org.apache.airavata.config.ThriftServerLauncher.class,
+ org.apache.airavata.monitor.realtime.RealtimeMonitor.class,
+ org.apache.airavata.monitor.email.EmailBasedMonitor.class,
+ org.apache.airavata.monitor.cluster.ClusterStatusMonitorJob.class,
+ org.apache.airavata.monitor.AbstractMonitor.class,
+ org.apache.airavata.helix.impl.controller.HelixController.class,
+ org.apache.airavata.helix.impl.participant.GlobalParticipant.class,
+ org.apache.airavata.helix.impl.workflow.PreWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.PostWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.ParserWorkflowManager.class
+ }),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.monitor\\..*"),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.helix\\..*")
+ })
+ @EnableConfigurationProperties(org.apache.airavata.config.AiravataServerProperties.class)
+ @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
+ static class TestConfiguration {}
+
private final GatewayService gatewayService;
private final ProjectService projectService;
private final ExperimentService experimentService;
diff --git a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/UserRepositoryTest.java b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/UserRepositoryTest.java
index fca30103e6..2edc4d07fb 100644
--- a/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/UserRepositoryTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/registry/repositories/expcatalog/UserRepositoryTest.java
@@ -35,13 +35,49 @@ import org.apache.airavata.registry.services.UserService;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;
-@SpringBootTest(classes = {org.apache.airavata.config.JpaConfig.class})
+@SpringBootTest(
+ classes = {org.apache.airavata.config.JpaConfig.class, UserRepositoryTest.TestConfiguration.class},
+ properties = {
+ "spring.main.allow-bean-definition-overriding=true",
+ "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
+ })
@TestPropertySource(locations = "classpath:airavata.properties")
public class UserRepositoryTest extends TestBase {
+ @Configuration
+ @ComponentScan(
+ basePackages = {"org.apache.airavata.service", "org.apache.airavata.registry", "org.apache.airavata.config"},
+ excludeFilters = {
+ @ComponentScan.Filter(
+ type = FilterType.ASSIGNABLE_TYPE,
+ classes = {
+ org.apache.airavata.config.BackgroundServicesLauncher.class,
+ org.apache.airavata.config.ThriftServerLauncher.class,
+ org.apache.airavata.monitor.realtime.RealtimeMonitor.class,
+ org.apache.airavata.monitor.email.EmailBasedMonitor.class,
+ org.apache.airavata.monitor.cluster.ClusterStatusMonitorJob.class,
+ org.apache.airavata.monitor.AbstractMonitor.class,
+ org.apache.airavata.helix.impl.controller.HelixController.class,
+ org.apache.airavata.helix.impl.participant.GlobalParticipant.class,
+ org.apache.airavata.helix.impl.workflow.PreWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.PostWorkflowManager.class,
+ org.apache.airavata.helix.impl.workflow.ParserWorkflowManager.class
+ }),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.monitor\\..*"),
+ @ComponentScan.Filter(type = FilterType.REGEX, pattern = "org\\.apache\\.airavata\\.helix\\..*")
+ })
+ @EnableConfigurationProperties(org.apache.airavata.config.AiravataServerProperties.class)
+ @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
+ static class TestConfiguration {}
+
private final GatewayService gatewayService;
private final UserService userService;
diff --git a/airavata-api/src/test/java/org/apache/airavata/security/KeyCloakSecurityManagerTest.java b/airavata-api/src/test/java/org/apache/airavata/security/KeyCloakSecurityManagerTest.java
index 0e177843c6..f3d67e2be3 100644
--- a/airavata-api/src/test/java/org/apache/airavata/security/KeyCloakSecurityManagerTest.java
+++ b/airavata-api/src/test/java/org/apache/airavata/security/KeyCloakSecurityManagerTest.java
@@ -42,8 +42,6 @@ import org.apache.airavata.service.SharingRegistryService;
import org.apache.airavata.sharing.models.UserGroup;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
@@ -56,7 +54,7 @@ import org.springframework.test.context.bean.override.mockito.MockitoBean;
@SpringBootTest(classes = {KeyCloakSecurityManagerTest.TestConfiguration.class})
@TestPropertySource(properties = {"security.tls.enabled=true", "security.iam.server-url=https://iam.server/auth"})
public class KeyCloakSecurityManagerTest {
- private static final Logger logger = LoggerFactory.getLogger(KeyCloakSecurityManagerTest.class);
+
public static final String TEST_USERNAME = "test-user";
public static final String TEST_GATEWAY = "test-gateway";
public static final String TEST_ACCESS_TOKEN = "abc123";
@@ -94,7 +92,8 @@ public class KeyCloakSecurityManagerTest {
@Bean
@Primary
public AiravataServerProperties airavataServerProperties(org.springframework.core.env.Environment environment) {
- AiravataServerProperties properties = new AiravataServerProperties(environment);
+ AiravataServerProperties properties = new AiravataServerProperties();
+ properties.setEnvironment(environment);
properties.security.tls.enabled = true;
return properties;
}
@@ -102,7 +101,6 @@ public class KeyCloakSecurityManagerTest {
@BeforeEach
public void setUp() throws AiravataSecurityException, ApplicationSettingsException {
- // Reset mocks
reset(mockRegistryService, mockSharingRegistryService, mockAuthzCacheManagerFactory, mockAuthzCacheManager);
}
diff --git a/airavata-api/src/test/java/org/apache/airavata/security/userstore/JDBCUserStoreTest.java b/airavata-api/src/test/java/org/apache/airavata/security/userstore/JDBCUserStoreTest.java
deleted file mode 100644
index 49769191ce..0000000000
--- a/airavata-api/src/test/java/org/apache/airavata/security/userstore/JDBCUserStoreTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you 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.
-*/
-package org.apache.airavata.security.userstore;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.airavata.security.UserStore;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Import;
-import org.springframework.test.context.TestPropertySource;
-import org.springframework.transaction.annotation.Transactional;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-/**
- * Test class for JDBC user store.
- */
-@SpringBootTest(
- classes = {org.apache.airavata.config.JpaConfig.class, JDBCUserStoreTest.TestConfiguration.class},
- properties = {
- "spring.main.allow-bean-definition-overriding=true",
- "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
- })
-@TestPropertySource(locations = "classpath:airavata.properties")
-@Transactional
-public class JDBCUserStoreTest {
-
- /**
- * <specificConfigurations>
- * <database>
- * <!--jdbcUrl>jdbc:h2:modules/commons/airavata-registry-rest/src/test/resources/testdb/test</jdbcUrl-->
- * <jdbcUrl>jdbc:h2:src/test/resources/testdb/test</jdbcUrl>
- * <userName>sa</userName>
- * <password>sa</password>
- * <databaseDriver>org.h2.Driver</databaseDriver>
- * <userTableName>AIRAVATA_USER</userTableName>
- * <userNameColumnName>USERID</userNameColumnName>
- * <passwordColumnName>PASSWORD</passwordColumnName>
- * </database>
- * </specificConfigurations>
- * @throws Exception
- */
- public JDBCUserStoreTest() {
- // Spring Boot test - no dependencies to inject for this utility test
- }
-
- @BeforeEach
- public void setUp() throws Exception {}
-
- @Test
- public void testAuthenticate() throws Exception {
-
- DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
- Document doc = dBuilder.parse(this.getClass().getClassLoader().getResourceAsStream("jdbc-authenticator.xml"));
- doc.getDocumentElement().normalize();
-
- NodeList configurations = doc.getElementsByTagName("specificConfigurations");
- UserStore userStore = new JDBCUserStore();
- userStore.configure(configurations.item(0));
-
- assertTrue(userStore.authenticate("amilaj", "secret"));
- assertFalse(userStore.authenticate("amilaj", "1secret"));
- assertFalse(userStore.authenticate("lahiru", "1234"));
- }
-
- @org.springframework.context.annotation.Configuration
- @ComponentScan(
- basePackages = {
- "org.apache.airavata.security",
- "org.apache.airavata.config"
- },
- excludeFilters = {
- @org.springframework.context.annotation.ComponentScan.Filter(
- type = org.springframework.context.annotation.FilterType.ASSIGNABLE_TYPE,
- classes = {
- org.apache.airavata.config.BackgroundServicesLauncher.class,
- org.apache.airavata.config.ThriftServerLauncher.class
- })
- })
- @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
- static class TestConfiguration {}
-}
diff --git a/airavata-api/src/test/java/org/apache/airavata/security/userstore/LDAPUserStoreTest.java b/airavata-api/src/test/java/org/apache/airavata/security/userstore/LDAPUserStoreTest.java
deleted file mode 100644
index 52d862b7d0..0000000000
--- a/airavata-api/src/test/java/org/apache/airavata/security/userstore/LDAPUserStoreTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you 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.
-*/
-package org.apache.airavata.security.userstore;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.airavata.security.UserStore;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Import;
-import org.springframework.test.context.TestPropertySource;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-/**
- * User store test 2
- */
-@Disabled("Need LDAP server to run these tests")
-@SpringBootTest(
- classes = {org.apache.airavata.config.JpaConfig.class, LDAPUserStoreTest.TestConfiguration.class},
- properties = {
- "spring.main.allow-bean-definition-overriding=true",
- "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
- })
-@TestPropertySource(locations = "classpath:airavata.properties")
-public class LDAPUserStoreTest {
-
- private LDAPUserStore ldapUserStore;
-
- public LDAPUserStoreTest() {
- // Spring Boot test - no dependencies to inject for this utility test
- }
-
- @Test
- public void setUp() {
- ldapUserStore = new LDAPUserStore();
- ldapUserStore.initializeLDAP("ldap://localhost:10389", "admin", "secret", "uid={0},ou=system");
- }
-
- @Test
- public void testAuthenticate() throws Exception {
- setUp();
- assertTrue(ldapUserStore.authenticate("amilaj", "secret"));
- assertFalse(ldapUserStore.authenticate("amilaj", "secret1"));
- }
-
- @Test
- public void testConfigure() throws Exception {
- DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
- Document doc = dBuilder.parse(this.getClass().getClassLoader().getResourceAsStream("ldap-authenticator.xml"));
- doc.getDocumentElement().normalize();
- NodeList configurations = doc.getElementsByTagName("specificConfigurations");
- UserStore userStore = new LDAPUserStore();
- userStore.configure(configurations.item(0));
- assertTrue(userStore.authenticate("amilaj", "secret"));
- }
-
- @org.springframework.context.annotation.Configuration
- @ComponentScan(
- basePackages = {
- "org.apache.airavata.security",
- "org.apache.airavata.config"
- },
- excludeFilters = {
- @org.springframework.context.annotation.ComponentScan.Filter(
- type = org.springframework.context.annotation.FilterType.ASSIGNABLE_TYPE,
- classes = {
- org.apache.airavata.config.BackgroundServicesLauncher.class,
- org.apache.airavata.config.ThriftServerLauncher.class
- })
- })
- @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
- static class TestConfiguration {}
-}
diff --git a/airavata-api/src/test/java/org/apache/airavata/security/userstore/SessionDBUserStoreTest.java b/airavata-api/src/test/java/org/apache/airavata/security/userstore/SessionDBUserStoreTest.java
deleted file mode 100644
index c46986e83b..0000000000
--- a/airavata-api/src/test/java/org/apache/airavata/security/userstore/SessionDBUserStoreTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you 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.
-*/
-package org.apache.airavata.security.userstore;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.InputStream;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.context.annotation.Import;
-import org.springframework.test.context.TestPropertySource;
-import org.springframework.transaction.annotation.Transactional;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-/**
- * Test class for session DB authenticator.
- */
-@SpringBootTest(
- classes = {org.apache.airavata.config.JpaConfig.class, SessionDBUserStoreTest.TestConfiguration.class},
- properties = {
- "spring.main.allow-bean-definition-overriding=true",
- "spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
- })
-@TestPropertySource(locations = "classpath:airavata.properties")
-@Transactional
-public class SessionDBUserStoreTest {
-
- private SessionDBUserStore sessionDBUserStore;
-
- private InputStream configurationFileStream =
- this.getClass().getClassLoader().getResourceAsStream("session-authenticator.xml");
-
- public SessionDBUserStoreTest() {
- // Spring Boot test - no dependencies to inject for this utility test
- }
-
- @BeforeEach
- public void setUp() throws Exception {
- sessionDBUserStore = new SessionDBUserStore();
- loadConfigurations();
- }
-
- private void loadConfigurations() throws Exception {
- DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
- Document doc = dBuilder.parse(configurationFileStream);
- doc.getDocumentElement().normalize();
-
- NodeList specificConfigurations = doc.getElementsByTagName("specificConfigurations");
- sessionDBUserStore.configure(specificConfigurations.item(0));
- }
-
- @Test
- public void testAuthenticate() throws Exception {
- assertTrue(sessionDBUserStore.authenticate("1234"));
- }
-
- @Test
- public void testAuthenticateFailure() throws Exception {
- assertFalse(sessionDBUserStore.authenticate("12345"));
- }
-
- @org.springframework.context.annotation.Configuration
- @ComponentScan(
- basePackages = {
- "org.apache.airavata.security",
- "org.apache.airavata.config"
- },
- excludeFilters = {
- @org.springframework.context.annotation.ComponentScan.Filter(
- type = org.springframework.context.annotation.FilterType.ASSIGNABLE_TYPE,
- classes = {
- org.apache.airavata.config.BackgroundServicesLauncher.class,
- org.apache.airavata.config.ThriftServerLauncher.class
- })
- })
- @Import(org.apache.airavata.config.AiravataPropertiesConfiguration.class)
- static class TestConfiguration {}
-}
diff --git a/airavata-api/src/test/java/org/apache/airavata/service/integration/ServiceIntegrationTestBase.java b/airavata-api/src/test/java/org/apache/airavata/service/integration/ServiceIntegrationTestBase.java
index 8fe5340919..5860dc1b62 100644
--- a/airavata-api/src/test/java/org/apache/airavata/service/integration/ServiceIntegrationTestBase.java
+++ b/airavata-api/src/test/java/org/apache/airavata/service/integration/ServiceIntegrationTestBase.java
@@ -24,9 +24,11 @@ import java.util.Map;
import org.apache.airavata.common.utils.Constants;
import org.apache.airavata.model.security.AuthzToken;
import org.junit.jupiter.api.BeforeEach;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
+import org.springframework.test.context.TestConstructor;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.transaction.TestTransaction;
import org.springframework.transaction.annotation.Transactional;
@@ -43,6 +45,8 @@ import org.springframework.transaction.annotation.Transactional;
"spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration"
})
@TestPropertySource(locations = "classpath:airavata.properties")
+@EnableConfigurationProperties(org.apache.airavata.config.AiravataServerProperties.class)
+@TestConstructor(autowireMode = TestConstructor.AutowireMode.ALL)
@Transactional
public abstract class ServiceIntegrationTestBase {
diff --git a/airavata-api/src/test/resources/credential-store/client.xml b/airavata-api/src/test/resources/credential-store/client.xml
new file mode 100644
index 0000000000..e018720201
--- /dev/null
+++ b/airavata-api/src/test/resources/credential-store/client.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<credential-store>
+ <successUri>/credential-store/success.jsp</successUri>
+ <errorUri>/credential-store/error.jsp</errorUri>
+ <redirectUri>/credential-store/show-redirect.jsp</redirectUri>
+</credential-store>
diff --git a/pom.xml b/pom.xml
index d5cc2be601..1a91ac20c1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -330,6 +330,11 @@ under the License.
<artifactId>mariadb-java-client</artifactId>
<version>3.5.4</version>
</dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>2.2.224</version>
+ </dependency>
<!-- Jakarta -->
<dependency>
@@ -612,7 +617,7 @@ under the License.
<skipTests>${skipTests}</skipTests>
<workingDirectory>${project.build.testOutputDirectory}</workingDirectory>
<useSystemClassLoader>false</useSystemClassLoader>
- <argLine>-Xmx1024m -XX:MaxPermSize=256m --add-opens java.base/java.lang=ALL-UNNAMED
+ <argLine>-Xmx1024m --add-opens java.base/java.lang=ALL-UNNAMED
-javaagent:${settings.localRepository}/org/jmockit/jmockit/1.50/jmockit-1.50.jar
</argLine>
<reuseForks>false</reuseForks>