Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
8fefa740
Commit
8fefa740
authored
9 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
no-jira: hardened the confluence test
parent
ce2d9f6b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/org/olat/core/commons/services/help/spi/ConfluenceLinkSPITest.java
+23
-13
23 additions, 13 deletions
...core/commons/services/help/spi/ConfluenceLinkSPITest.java
with
23 additions
and
13 deletions
src/test/java/org/olat/core/commons/services/help/spi/ConfluenceLinkSPITest.java
+
23
−
13
View file @
8fefa740
...
...
@@ -24,6 +24,8 @@ import java.util.Locale;
import
org.junit.Assert
;
import
org.junit.Test
;
import
org.olat.core.helpers.SettingsTest
;
import
org.olat.core.logging.OLog
;
import
org.olat.core.logging.Tracing
;
/**
*
...
...
@@ -33,6 +35,8 @@ import org.olat.core.helpers.SettingsTest;
*/
public
class
ConfluenceLinkSPITest
{
private
static
final
OLog
log
=
Tracing
.
createLoggerFor
(
ConfluenceLinkSPITest
.
class
);
@Test
public
void
getURL_confluence
()
{
ConfluenceLinkSPI
linkSPI
=
new
ConfluenceLinkSPI
();
...
...
@@ -79,9 +83,9 @@ public class ConfluenceLinkSPITest {
ConfluenceLinkSPI
linkSPI
=
new
ConfluenceLinkSPI
();
// Standard Case in German - same as in english
String
url
1
=
linkSPI
.
getURL
(
Locale
.
GERMAN
,
"Data Management"
);
Assert
.
assertNotNull
(
url
1
);
Assert
.
assertTrue
(
url
1
.
endsWith
(
"Data%20Management"
));
String
url
=
linkSPI
.
getURL
(
Locale
.
GERMAN
,
"Data Management"
);
Assert
.
assertNotNull
(
url
);
Assert
.
assertTrue
(
url
.
endsWith
(
"Data%20Management"
));
// Special handing for anchors in confluence
// Here some magic is needed since the CustomWare Redirection Plugin
...
...
@@ -89,17 +93,23 @@ public class ConfluenceLinkSPITest {
// anchor is deleted.
// We have to translate this here
// First time it won't return the translated link as it does the translation asynchronously in a separate thread to not block the UI
String
url2
=
linkSPI
.
getURL
(
Locale
.
GERMAN
,
"Data Management#qb_import"
);
Assert
.
assertNotNull
(
url2
);
Assert
.
assertTrue
(
url2
.
endsWith
(
"Data%20Management#DataManagement-qb_import"
));
String
notTranslatedUrl
=
linkSPI
.
getURL
(
Locale
.
GERMAN
,
"Data Management#qb_import"
);
Assert
.
assertNotNull
(
notTranslatedUrl
);
Assert
.
assertTrue
(
notTranslatedUrl
.
endsWith
(
"Data%20Management#DataManagement-qb_import"
));
// Wait 5secs and try it again, should be translated now
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
boolean
found
=
false
;
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
String
translatedUrl
=
linkSPI
.
getURL
(
Locale
.
GERMAN
,
"Data Management#qb_import"
);
if
(
translatedUrl
!=
null
&&
translatedUrl
.
endsWith
(
"Handhabung%20der%20Daten#HandhabungderDaten-qb_import"
))
{
found
=
true
;
}
else
{
try
{
Thread
.
sleep
(
100
);
}
catch
(
InterruptedException
e
)
{
log
.
error
(
""
,
e
);
}
}
}
url2
=
linkSPI
.
getURL
(
Locale
.
GERMAN
,
"Data Management#qb_import"
);
Assert
.
assertNotNull
(
url2
);
Assert
.
assertTrue
(
url2
.
endsWith
(
"Handhabung%20der%20Daten#HandhabungderDaten-qb_import"
));
Assert
.
assertTrue
(
"German translation cannot be found after 10s"
,
found
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment