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

Unit test case ObjectIoTest.marshal_Acl failed when PathBasedCellUrl is enabled. #581

Closed
tochi-y opened this issue Sep 10, 2020 · 1 comment
Assignees
Labels
Milestone

Comments

@tochi-y
Copy link
Member

tochi-y commented Sep 10, 2020

Problem

Unit test case ObjectIoTest.marshal_Acl failed when PathBasedCellUrl is enabled.

[INFO] Running io.personium.core.model.jaxb.ObjectIoTest
2020-09-10 00:40:47.829 [main] [INFO ] {"@xml.base":"personium-localunit://cell.unit.example/__role/__/",
"@p.requireSchemaAuthz":"public",
"D.ace":[{"D.principal":{"D.all":"all"},
"D.grant":{"D.privilege":[{"D.read":{}}]}},
{"D.principal":{"D.href":"foo"},
"D.grant":{"D.privilege":[{"D.read":{}},
{"p.root":{}}]}}]} - ObjectIoTest
2020-09-10 00:40:47.893 [main] [INFO ] <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<acl xml:base="personium-localunit://cell.unit.example/__role/__/" p:requireSchemaAuthz="public" xmlns:p="urn:x-personium:xmlns" xmlns="DAV:">
<ace>
<principal>
<all>all</all>
</principal>
<grant>
<privilege>
<D:read xmlns:D="DAV:"/>
</privilege>
</grant>
</ace>
<ace>
<principal>
<href>foo</href>
</principal>
<grant>
<privilege>
<D:read xmlns:D="DAV:"/>
</privilege>
<privilege>
<p:root/>
</privilege>
</grant>
</ace>
</acl> - ObjectIoTest
2020-09-10 00:40:47.915 [main] [INFO ] //acl[position()=1]/@base = personium-localunit://cell.unit.example/__role/__/ - ObjectIoTest
[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.766 s <<< FAILURE! - in io.personium.core.model.jaxb.ObjectIoTest
[ERROR] marshal_Acl(io.personium.core.model.jaxb.ObjectIoTest)  Time elapsed: 0.757 s  <<< FAILURE!
org.junit.ComparisonFailure: expected:<[https]://cell.unit.example...> but was:<[personium-localunit]://cell.unit.example...>
	at io.personium.core.model.jaxb.ObjectIoTest.marshal_Acl(ObjectIoTest.java:126)

If PathBasedCellUrl is disabled, the test case succeeds.

Cause

When ACL.setBase method is called, the base value to set is variant depending on the PathBasedCellUrl value.

  • PathBasedCellUrl true -> https://cell.unit.example/__role/__/
  • PathBasedCellUrl false -> personium-localunit://cell.unit.example/__role/__/

acl.setBase("https://cell.unit.example/__role/__/");


if (PersoniumUnitConfig.isPathBasedCellUrlEnabled()) {

And the default PathBasedCellUrl value is false.

io.personium.core.pathBasedCellUrl.enabled=false

@tochi-y tochi-y added the bug label Sep 10, 2020
@tochi-y tochi-y added this to the 1.7.22 milestone Sep 10, 2020
@tochi-y tochi-y added this to Backlog in Current Work via automation Sep 10, 2020
@tochi-y tochi-y self-assigned this Sep 10, 2020
@tochi-y
Copy link
Member Author

tochi-y commented Sep 14, 2020

ObjectIoTest.marshal_Acl is currently run with no configuration of ''PathBasedCellUrl" and "FQDN". So their values are default value if personium-unit-config-properties is not placed. In the default values case, this line assigned https:/.

String unitUrl = PersoniumUnitConfig.getBaseUrl();

So the results are different by PathBasedCellUrl value.

PathBasedCellUrl true -> https://cell.unit.example/__role/__/

PathBasedCellUrl false -> personium-localunit://cell.unit.example/__role/__/

return url.replaceFirst(unitUrl, SCHEME_LOCALUNIT + ":/");

Current Work automation moved this from Backlog to Done Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Current Work
  
Done
Development

No branches or pull requests

1 participant