Author: fmui
Date: Mon Sep 15 10:10:08 2014
New Revision: 1624986
URL: http://svn.apache.org/r1624986
Log:
ACL exact flag corrections + TCK test + Workbench update
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.java
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java?rev=1624986&r1=1624985&r2=1624986&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java
Mon Sep 15 10:10:08 2014
@@ -59,7 +59,7 @@ public class AclServiceImpl extends Abst
Response resp = read(url);
Map<String, Object> json = parseObject(resp.getStream(),
resp.getCharset());
- return JSONConverter.convertAcl(json, null);
+ return JSONConverter.convertAcl(json);
}
public Acl applyAcl(String repositoryId, String objectId, Acl addAces, Acl
removeAces,
@@ -81,7 +81,7 @@ public class AclServiceImpl extends Abst
});
Map<String, Object> json = parseObject(resp.getStream(),
resp.getCharset());
- return JSONConverter.convertAcl(json, null);
+ return JSONConverter.convertAcl(json);
}
public Acl setAcl(String repositoryId, String objectId, Acl aces) {
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java?rev=1624986&r1=1624985&r2=1624986&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
Mon Sep 15 10:10:08 2014
@@ -157,6 +157,33 @@ public abstract class AbstractCmisObject
if (objectData.getAcl() != null) {
acl = objectData.getAcl();
extensions.put(ExtensionLevel.ACL,
objectData.getAcl().getExtensions());
+
+ if (objectData.isExactAcl() != null) {
+ final Acl objectAcl = objectData.getAcl();
+ final Boolean isExact = objectData.isExactAcl();
+ acl = new Acl() {
+
+ @Override
+ public void setExtensions(List<CmisExtensionElement>
extensions) {
+ objectAcl.setExtensions(extensions);
+ }
+
+ @Override
+ public List<CmisExtensionElement> getExtensions() {
+ return objectAcl.getExtensions();
+ }
+
+ @Override
+ public Boolean isExact() {
+ return isExact;
+ }
+
+ @Override
+ public List<Ace> getAces() {
+ return objectAcl.getAces();
+ }
+ };
+ }
}
// handle policies
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java?rev=1624986&r1=1624985&r2=1624986&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
Mon Sep 15 10:10:08 2014
@@ -1857,7 +1857,7 @@ public final class JSONConverter {
ObjectDataImpl result = new ObjectDataImpl();
- result.setAcl(convertAcl(getMap(json.get(JSON_OBJECT_ACL)), null));
+ result.setAcl(convertAcl(getMap(json.get(JSON_OBJECT_ACL))));
result.setAllowableActions(convertAllowableActions(getMap(json.get(JSON_OBJECT_ALLOWABLE_ACTIONS))));
Map<String, Object> jsonChangeEventInfo =
getMap(json.get(JSON_OBJECT_CHANGE_EVENT_INFO));
if (jsonChangeEventInfo != null) {
@@ -1919,7 +1919,7 @@ public final class JSONConverter {
/**
* Converts an ACL.
*/
- public static Acl convertAcl(final Map<String, Object> json, final Boolean
isExact) {
+ public static Acl convertAcl(final Map<String, Object> json) {
if (json == null) {
return null;
}
@@ -1969,7 +1969,7 @@ public final class JSONConverter {
result.setAces(aces);
- result.setExact(isExact);
+ result.setExact(getBoolean(json, JSON_ACL_IS_EXACT));
convertExtension(json, result, ACL_KEYS);
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java?rev=1624986&r1=1624985&r2=1624986&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
Mon Sep 15 10:10:08 2014
@@ -1151,7 +1151,7 @@ public abstract class AbstractSessionTes
// check ACL
if (object.getAcl() != null && object.getAcl().getAces() != null) {
- addResult(results, checkACL(session, object.getAcl(), "ACL"));
+ addResult(results, checkACL(session, object.getAcl(), true,
"ACL"));
}
// check policies
@@ -1229,7 +1229,7 @@ public abstract class AbstractSessionTes
return (result.getStatus().getLevel() <= OK.getLevel() ? null :
result);
}
- protected CmisTestResult checkACL(Session session, Acl acl, String
message) {
+ protected CmisTestResult checkACL(Session session, Acl acl, boolean
checkExact, String message) {
List<CmisTestResult> results = new ArrayList<CmisTestResult>();
CmisTestResult f;
@@ -1244,7 +1244,7 @@ public abstract class AbstractSessionTes
if (acl.getAces() != null) {
for (Ace ace : acl.getAces()) {
- f = createResult(FAILURE, "ACE with empty principal id!");
+ f = createResult(FAILURE, "ACE with empty principal ID!");
addResult(results,
assertStringNotEmpty(ace.getPrincipalId(), null, f));
f = createResult(FAILURE, "ACE with empty permission
list!");
@@ -1258,6 +1258,11 @@ public abstract class AbstractSessionTes
}
}
}
+
+ if (checkExact) {
+ f = createResult(FAILURE, "ACL is provided but the isExact
flag is not set!");
+ addResult(results, assertNotNull(acl.isExact(), null, f));
+ }
}
CmisTestResultImpl result = createResult(getWorst(results), message);
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.java
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.java?rev=1624986&r1=1624985&r2=1624986&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.java
Mon Sep 15 10:10:08 2014
@@ -75,7 +75,7 @@ public class ACLSmokeTest extends Abstra
addResult(assertNotNull(basicAcl, null, f));
if (basicAcl != null) {
- addResult(checkACL(session, basicAcl, "Basic ACL"));
+ addResult(checkACL(session, basicAcl, false, "Basic ACL"));
if (basicAcl.getAces() != null) {
for (Ace ace : basicAcl.getAces()) {
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java
URL:
http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java?rev=1624986&r1=1624985&r2=1624986&view=diff
==============================================================================
---
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java
(original)
+++
chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java
Mon Sep 15 10:10:08 2014
@@ -81,6 +81,7 @@ public class ObjectPanel extends InfoPan
private JTextField contentUrlField;
private InfoList pathsList;
private InfoList allowableActionsList;
+ private JTextField aclExactField;
private JPanel buttonPanel;
private JButton refreshButton;
private JButton checkButton;
@@ -121,6 +122,7 @@ public class ObjectPanel extends InfoPan
pathsList.removeAll();
contentUrlField.setText("");
allowableActionsList.removeAll();
+ aclExactField.setText("");
refreshButton.setEnabled(false);
checkButton.setEnabled(false);
scriptPanel.setVisible(false);
@@ -203,6 +205,18 @@ public class ObjectPanel extends InfoPan
allowableActionsList.setList(Collections.singletonList("(missing)"));
}
+ if (object.getAcl() == null) {
+ aclExactField.setText("(no ACL)");
+ } else {
+ if (object.getAcl().isExact() == null) {
+ aclExactField.setText("exact flag not set");
+ } else if
(object.getAcl().isExact().booleanValue()) {
+ aclExactField.setText("is exact");
+ } else {
+ aclExactField.setText("is not exact");
+ }
+ }
+
refreshButton.setEnabled(true);
checkButton.setEnabled(true);
@@ -239,6 +253,7 @@ public class ObjectPanel extends InfoPan
pwcField = addId("PWC:");
contentUrlField = addLink("Content URL:");
allowableActionsList = addComponent("Allowable Actions:", new
InfoList());
+ aclExactField = addLine("ACL:");
buttonPanel = addComponent("", new JPanel(new BorderLayout()));
buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS));
@@ -395,4 +410,4 @@ public class ObjectPanel extends InfoPan
public void close() throws IOException {
}
}
-}
+}
\ No newline at end of file