Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xwiki-platform
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository 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
XWiki
xwiki-platform
Commits
33ddf80f
Commit
33ddf80f
authored
3 years ago
by
Vincent Massol
Browse files
Options
Downloads
Patches
Plain Diff
[Misc] Fix bug in PageTest's setup when loading template resources
parent
d5707407
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-page/src/main/java/org/xwiki/test/page/PageTest.java
+13
-4
13 additions, 4 deletions
...test-page/src/main/java/org/xwiki/test/page/PageTest.java
with
13 additions
and
4 deletions
xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-page/src/main/java/org/xwiki/test/page/PageTest.java
+
13
−
4
View file @
33ddf80f
...
...
@@ -86,6 +86,8 @@ public class PageTest
{
private
static
final
String
SKIN_PROPERTIES_PATH
=
"/skins/flamingo/skin.properties"
;
private
static
final
String
SKIN_FLAMINGO_PREFIX_PATH
=
"/skins/flamingo"
;
@InjectMockitoOldcore
protected
MockitoOldcore
oldcore
;
...
...
@@ -269,7 +271,7 @@ void setUpForPageTest() throws Exception
when
(
oldcore
.
getMockContextualAuthorizationManager
().
hasAccess
(
same
(
Right
.
VIEW
),
any
())).
thenReturn
(
true
);
// Set up URL Factory
URLFactorySetup
.
setUp
(
xwiki
,
context
);
URLFactorySetup
.
setUp
(
context
);
// Set up Localization
LocalizationSetup
.
setUp
(
componentManager
);
...
...
@@ -342,7 +344,10 @@ protected void initializeEnvironmentResources() throws Exception
// - If not found, then let tests be able to override {@code getEnvironmentResource()}.
URL
url
=
getClass
().
getResource
(
resourceName
);
if
(
url
==
null
)
{
url
=
getClass
().
getResource
(
getShortTemplateResourceName
(
resourceName
));
String
shortName
=
getShortTemplateResourceName
(
resourceName
);
if
(
shortName
!=
null
)
{
url
=
getClass
().
getResource
(
shortName
);
}
if
(
url
==
null
)
{
url
=
getEnvironmentResource
(
resourceName
);
}
...
...
@@ -359,7 +364,10 @@ protected void initializeEnvironmentResources() throws Exception
// - If not found, then let tests be able to override {@code getEnvironmentResource()}.
InputStream
is
=
getClass
().
getResourceAsStream
(
resourceName
);
if
(
is
==
null
)
{
is
=
getClass
().
getResourceAsStream
(
getShortTemplateResourceName
(
resourceName
));
String
shortName
=
getShortTemplateResourceName
(
resourceName
);
if
(
shortName
!=
null
)
{
is
=
getClass
().
getResourceAsStream
(
shortName
);
}
if
(
is
==
null
)
{
is
=
getEnvironmentResourceAsStream
(
resourceName
);
}
...
...
@@ -370,7 +378,8 @@ protected void initializeEnvironmentResources() throws Exception
private
String
getShortTemplateResourceName
(
String
resourceName
)
{
return
StringUtils
.
substringAfter
(
resourceName
,
"/skins/flamingo"
);
return
resourceName
.
startsWith
(
SKIN_FLAMINGO_PREFIX_PATH
)
?
StringUtils
.
substringAfter
(
resourceName
,
SKIN_FLAMINGO_PREFIX_PATH
)
:
null
;
}
protected
URL
getEnvironmentResource
(
String
resourceName
)
throws
Exception
...
...
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