Skip to content

Commit

Permalink
changes for predefined variable processing. changed git workflow yaml
Browse files Browse the repository at this point in the history
Signed-off-by: Arun Venmany <[email protected]>
  • Loading branch information
arunvenmany-ibm committed Feb 12, 2025
1 parent b8b62d7 commit 3637b14
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
with:
repository: OpenLiberty/ci.common
path: ci.common
ref: variable_resolution_fix
- name: Set up Java
uses: actions/setup-java@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion lemminx-liberty/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
<dependency>
<groupId>io.openliberty.tools</groupId>
<artifactId>ci.common</artifactId>
<version>1.8.36</version>
<version>1.8.37-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,38 @@ public void testGetVariables() throws BadLocationException {
XMLAssert.testCompletionFor(serverXML, null, serverXmlFile.toURI().toString(), TOTAL_ITEMS, httpCompletion,
httpsCompletion);

serverXML = String.join(newLine, //
"<server description=\"Sample Liberty server\">", //
" <featureManager>", //
" <platform>javaee-6.0</platform>", //
" <feature>acmeCA-2.0</feature>", //
" </featureManager>", //
" <webApplication contextRoot=\"/app-name\" location=\"${server.|}\" />",//
"</server>" //
);

CompletionItem serverConfigDirCompletion= c("${server.config.dir}", "${server.config.dir}");
CompletionItem serverOutputDirCompletion = c("${server.output.dir}", "${server.output.dir}");

XMLAssert.testCompletionFor(serverXML, null, serverXmlFile.toURI().toString(), TOTAL_ITEMS, serverConfigDirCompletion,
serverOutputDirCompletion);

serverXML = String.join(newLine, //
"<server description=\"Sample Liberty server\">", //
" <featureManager>", //
" <platform>javaee-6.0</platform>", //
" <feature>acmeCA-2.0</feature>", //
" </featureManager>", //
" <webApplication contextRoot=\"/app-name\" location=\"${wlp.|}\" />",//
"</server>" //
);

CompletionItem wlpInstallDirCompletion = c("${wlp.install.dir}", "${wlp.install.dir}");
CompletionItem wlpUsrDirCompletion = c("${wlp.user.dir}", "${wlp.user.dir}");

XMLAssert.testCompletionFor(serverXML, null, serverXmlFile.toURI().toString(), TOTAL_ITEMS, wlpInstallDirCompletion,
wlpUsrDirCompletion);

}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ public void populateVariablesForWorkspace(LibertyWorkspace workspace) {
File installDirectory = LibertyUtils.getFileFromLibertyPluginXml(pluginConfigFilePath, "installDirectory");
File serverDirectory = LibertyUtils.getFileFromLibertyPluginXml(pluginConfigFilePath, "serverDirectory");
File userDirectory = LibertyUtils.getFileFromLibertyPluginXml(pluginConfigFilePath, "userDirectory");
if (serverDirectory != null && installDirectory != null && userDirectory != null) {
File serverOutputDirectory = LibertyUtils.getFileFromLibertyPluginXml(pluginConfigFilePath, "serverOutputDirectory");
if (serverDirectory != null && installDirectory != null && userDirectory != null && serverOutputDirectory !=null) {
try {
ServerConfigDocument serverConfigDocument = new ServerConfigDocument(
new CommonLogger(LOGGER), null, installDirectory, userDirectory, serverDirectory);
new CommonLogger(LOGGER), null, installDirectory, userDirectory, serverDirectory, serverOutputDirectory);
variablesForWorkspace.putAll(serverConfigDocument.getDefaultProperties());
variablesForWorkspace.putAll(serverConfigDocument.getProperties());
LOGGER.finest("Populated variables for workspace: " + workspace.getWorkspaceString() + ". Number of variables found: " + variablesForWorkspace.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public void setupWorkspace() {
.thenReturn(installDir);
libertyUtils.when(() -> LibertyUtils.getFileFromLibertyPluginXml(any(), eq("userDirectory")))
.thenReturn(userDir);
libertyUtils.when(() -> LibertyUtils.getFileFromLibertyPluginXml(any(), eq("serverOutputDirectory")))
.thenReturn(serverDir);
}

@AfterEach
Expand Down

0 comments on commit 3637b14

Please sign in to comment.