Skip to content

Commit

Permalink
Add functional tests xwikisas#16
Browse files Browse the repository at this point in the history
* Added functional tests for WebHome
* Added functional tests for modals
* Modified code to correct errors found using functional tests
  • Loading branch information
ChiuchiuSorin committed Nov 14, 2023
1 parent d629057 commit 1430526
Show file tree
Hide file tree
Showing 13 changed files with 694 additions and 300 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package com.xwiki.admintools.internal;

import java.util.ArrayList;
import java.util.List;

import javax.inject.Inject;
Expand Down Expand Up @@ -95,7 +94,7 @@ public String generateData(String hint)
*/
public List<String> getSupportedDBs()
{
return new ArrayList<>(this.currentServer.getSupportedDBs().values());
return this.currentServer.getSupportedDBs();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public Map<String, String> getDataAsJSON() throws Exception
systemInfo.put("databaseName", dbMetadata.get(METADATA_NAME));
systemInfo.put("databaseVersion", dbMetadata.get(METADATA_VERSION));
systemInfo.put("xwikiCfgPath", getCurrentServer().getXwikiCfgFolderPath());
systemInfo.put("serverPath", getCurrentServer().getServerPath());
systemInfo.put("tomcatConfPath", this.getCurrentServer().getServerCfgPath());
systemInfo.put("javaVersion", this.getJavaVersion());
Map<String, String> serverMetadata = this.currentServer.getServerMetadata();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package com.xwiki.admintools.internal.data.identifiers;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -74,19 +73,13 @@ public ServerIdentifier getCurrentServer()
}

/**
* Get a {@link Map} with the supported databases.
* Get a {@link List} with the supported databases.
*
* @return the supported databases.
*/
public Map<String, String> getSupportedDBs()
public List<String> getSupportedDBs()
{
Map<String, String> supportedDBs = new HashMap<>();
supportedDBs.put("mysql", "MySQL");
supportedDBs.put("hsqldb", "HSQLDB");
supportedDBs.put("mariadb", "MariaDB");
supportedDBs.put("postgresql", "PostgreSQL");
supportedDBs.put("oracle", "Oracle");
return supportedDBs;
return List.of("MySQL", "HSQL", "MariaDB", "PostgreSQL", "Oracle");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,28 @@
$configuration['osArch']</li>
</ul>
</li>
#if ($configuration['databaseName'] != $null)
<li>$escapetool.xml($services.localization.render('adminTools.dashboard.section.backend.usedDB'))
$configuration['databaseName'] - $configuration['databaseVersion']</li>
#set($databaseName = $configuration['databaseName'])
#if ($databaseName != $null)
<li>$escapetool.xml($services.localization.render('adminTools.dashboard.section.backend.usedDB'))
$databaseName - $configuration['databaseVersion']</li>
#set ($supportedDatabases = $services.admintools.getSupportedDatabases())
#set ($isSupported = false)
#databaseIsSupported($databaseName $supportedDatabases $isSupported)
#if (!$isSupported)
#set($warningDatabaseMessage = $escapetool.xml(
$services.localization.render('adminTools.dashboard.section.backend.supportedDB.error')) + ':')
#set($warningDatabaseMessage = $warningDatabaseMessage +
$stringtool.join($supportedDatabases, ', '))
#warning($warningDatabaseMessage)
#end
#else
#set($warningDatabaseMessage = $escapetool.xml(
$services.localization.render('adminTools.dashboard.section.backend.supportedDB.error')) + ':')
#set($warningDatabaseMessage = $warningDatabaseMessage +
$stringtool.join($services.admintools.getSupportedDatabases(), ', '))
<li>$escapetool.xml(
$services.localization.render('adminTools.dashboard.section.backend.usedDB')) #warning($warningDatabaseMessage)
</li>
<li>$escapetool.xml(
$services.localization.render('adminTools.dashboard.section.backend.usedDB')) #warning($warningDatabaseMessage)
</li>
#end
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
$escapetool.xml($services.localization.render('adminTools.dashboard.section.download.view.description'))
<ul>
<li>
<a href="$adminToolsFilesPath/xwikiConfig"
<a id="filesConfig" href="$adminToolsFilesPath/xwikiConfig"
target="_blank">
$escapetool.xml($services.localization.render('adminTools.dashboard.section.download.view.configuration'))
</a>
</li>
<li>
<a href="$adminToolsFilesPath/xwikiProperties"
<a id="filesProperties" href="$adminToolsFilesPath/xwikiProperties"
target="_blank">
$escapetool.xml($services.localization.render('adminTools.dashboard.section.download.view.properties'))
</a>
Expand Down
Loading

0 comments on commit 1430526

Please sign in to comment.