Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JDK Modules Export to JUnit Test to run Integration Tests via IDE #864

Merged
merged 7 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/codeStyles/codeStyleConfig.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [2023.3.3]

### `Tests` enhancements
- Add JDK Export Properties to JUnit Tests to run Integration Tests[#864](https://github.com/epam/sap-commerce-intellij-idea-plugin/pull/864)

## [2023.3.2]

### `Project Import` enhancements
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@
- Rustam Burmenskyi
- Oleksandr Dihtiar
- Andrei Lisetskii
- Eugeni Kalenchuk
- Eugeni Kalenchuk
- Stefan Kruk
12 changes: 9 additions & 3 deletions src/com/intellij/idea/plugin/hybris/common/HybrisConstants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ object HybrisConstants {
const val PROPERTY_LANG_PACKS = "lang.packs"
const val PROPERTY_IMPEX_HEADER_REPLACEMENT = "impex.header.replacement"

const val PROPERTY_STANDALONE_JDKMODULESEXPORTS = "standalone.jdkmodulesexports";

const val DEFAULT_LANGUAGE_ISOCODE = "en"

const val DEFAULT_DEPLOYMENT_TABLENAME_MAXLENGTH = 24
Expand Down Expand Up @@ -301,13 +303,17 @@ object HybrisConstants {
const val LIB_DIRECTORY = "lib"
const val BIN_DIRECTORY = "bin"
const val RESOURCES_DIRECTORY = "resources"
const val LOCAL_PROPERTIES = "local.properties"
const val PROJECT_PROPERTIES = "project.properties"
const val LOCAL_PROPERTIES_FILE = "local.properties"
const val PROJECT_PROPERTIES_FILE = "project.properties"
const val ENV_PROPERTIES_FILE = "env.properties"
const val ADVANCED_PROPERTIES_FILE = "advanced.properties"
const val SPRING_WEB_FILE_SET_NAME = "web application context"
const val APPLICATION_CONTEXT_SPRING_FILES = "application-context"
const val ADDITIONAL_WEB_SPRING_CONFIG_FILES = "additionalWebSpringConfigs"
const val GLOBAL_CONTEXT_SPRING_FILES = "global-context"
const val HYBRIS_CONFIG_DIR_KEY = "HYBRIS_CONFIG_DIR"
const val HYBRIS_CONFIG_DIR_ENV = "HYBRIS_CONFIG_DIR"
const val HYBRIS_RUNTIME_PROPERTIES_ENV = "HYBRIS_RUNTIME_PROPERTIES"
const val HYBRIS_OPT_CONFIG_DIR_ENV = "HYBRIS_OPT_CONFIG_DIR"
const val HYBRIS_API_VERSION_KEY = "version.api"
const val HYBRIS_VERSION_KEY = "version"
const val JAVADOC_FALLBACK_URL = "https://help.sap.com/docs/SAP_COMMERCE/c5613bd3cc9942efb74d017b40eb0892/179bbc9b35274d7ca784e46b3beb40b2.html"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ private String getDebugPort(
) {
final var commonIdeaService = CommonIdeaService.getInstance();
final ConfigModuleDescriptor configDescriptor = hybrisProjectDescriptor.getConfigHybrisModuleDescriptor();
String port = findPortProperty(configDescriptor, HybrisConstants.LOCAL_PROPERTIES, cache);
String port = findPortProperty(configDescriptor, HybrisConstants.LOCAL_PROPERTIES_FILE, cache);

if (port != null) {
return port;
}
final PlatformModuleDescriptor platformDescriptor = commonIdeaService.getPlatformDescriptor(hybrisProjectDescriptor);

if (platformDescriptor != null) {
port = findPortProperty(platformDescriptor, HybrisConstants.PROJECT_PROPERTIES, cache);
port = findPortProperty(platformDescriptor, HybrisConstants.PROJECT_PROPERTIES_FILE, cache);

if (port != null) {
return port;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ private static String findBuildCompilerProperty(
final ConfigModuleDescriptor configDescriptor = descriptor.getConfigHybrisModuleDescriptor();

if (configDescriptor != null) {
propertyFiles.add(new File(configDescriptor.getModuleRootDirectory(), HybrisConstants.LOCAL_PROPERTIES));
propertyFiles.add(new File(configDescriptor.getModuleRootDirectory(), HybrisConstants.LOCAL_PROPERTIES_FILE));
}
final PlatformModuleDescriptor platformDescriptor = descriptor.getPlatformHybrisModuleDescriptor();
propertyFiles.add(new File(platformDescriptor.getModuleRootDirectory(), HybrisConstants.ADVANCED_PROPERTIES));
propertyFiles.add(new File(platformDescriptor.getModuleRootDirectory(), HybrisConstants.PROJECT_PROPERTIES));
propertyFiles.add(new File(platformDescriptor.getModuleRootDirectory(), HybrisConstants.PROJECT_PROPERTIES_FILE));

return cache.findPropertyInFiles(propertyFiles, HybrisConstants.PROPERTY_BUILD_COMPILER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class DefaultSpringConfigurator : SpringConfigurator {
moduleDescriptor.addSpringFile(advancedProperties.absolutePath)

hybrisProjectDescriptor.configHybrisModuleDescriptor
?.let { File(it.moduleRootDirectory, HybrisConstants.LOCAL_PROPERTIES) }
?.let { File(it.moduleRootDirectory, HybrisConstants.LOCAL_PROPERTIES_FILE) }
?.let { moduleDescriptor.addSpringFile(it.absolutePath) }
}

Expand Down Expand Up @@ -120,7 +120,7 @@ class DefaultSpringConfigurator : SpringConfigurator {
moduleDescriptor: YRegularModuleDescriptor
) {
val projectProperties = Properties()
val propFile = File(moduleDescriptor.moduleRootDirectory, HybrisConstants.PROJECT_PROPERTIES)
val propFile = File(moduleDescriptor.moduleRootDirectory, HybrisConstants.PROJECT_PROPERTIES_FILE)
moduleDescriptor.addSpringFile(propFile.absolutePath)
try {
projectProperties.load(propFile.inputStream())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ private File getExpectedConfigDir(final PlatformModuleDescriptor platformHybrisM
if (!expectedConfigDir.isDirectory()) {
return null;
}
final File propertiesFile = new File(expectedConfigDir, HybrisConstants.LOCAL_PROPERTIES);
final File propertiesFile = new File(expectedConfigDir, HybrisConstants.LOCAL_PROPERTIES_FILE);
if (!propertiesFile.exists()) {
return expectedConfigDir;
}
Expand All @@ -266,7 +266,7 @@ private File getExpectedConfigDir(final PlatformModuleDescriptor platformHybrisM
return expectedConfigDir;
}

String hybrisConfig = (String) properties.get(HybrisConstants.HYBRIS_CONFIG_DIR_KEY);
String hybrisConfig = (String) properties.get(HybrisConstants.HYBRIS_CONFIG_DIR_ENV);
if (hybrisConfig == null) {
return expectedConfigDir;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public boolean isConfigModule(@NotNull final File file) {
Validate.notNull(file);

return new File(file, HybrisConstants.LOCAL_EXTENSIONS_XML).isFile()
&& new File(file, HybrisConstants.LOCAL_PROPERTIES).isFile();
&& new File(file, HybrisConstants.LOCAL_PROPERTIES_FILE).isFile();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,4 @@ interface PropertiesService {
@JvmStatic
fun getInstance(project: Project): PropertiesService? = project.getService(PropertiesService::class.java)
}

fun getProperty(key: String): IProperty?
}
Loading