You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2016/06/30 13:17:54 UTC
[1/2] syncope git commit: Upgrading IzPack
Repository: syncope
Updated Branches:
refs/heads/master 835588b5f -> 4f6818b10
Upgrading IzPack
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/0d5e730f
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/0d5e730f
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/0d5e730f
Branch: refs/heads/master
Commit: 0d5e730f8f5b018222bd50f0e1b0f6bf84066bdc
Parents: 835588b
Author: Francesco Chicchiricc� <il...@apache.org>
Authored: Thu Jun 30 15:17:11 2016 +0200
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Thu Jun 30 15:17:11 2016 +0200
----------------------------------------------------------------------
installer/src/main/resources/izpack/install.xml | 2 +-
pom.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/0d5e730f/installer/src/main/resources/izpack/install.xml
----------------------------------------------------------------------
diff --git a/installer/src/main/resources/izpack/install.xml b/installer/src/main/resources/izpack/install.xml
index c9335db..625d85b 100644
--- a/installer/src/main/resources/izpack/install.xml
+++ b/installer/src/main/resources/izpack/install.xml
@@ -30,7 +30,7 @@ under the License.
<authors>
<author name="Apache Syncope" email="dev@syncope.apache.org"/>
</authors>
- <javaversion>${targetJdk}</javaversion>
+ <javaversion>1.7</javaversion>
</info>
<guiprefs resizable="no" width="850" height="600">
http://git-wip-us.apache.org/repos/asf/syncope/blob/0d5e730f/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index cdd2089..e8a731b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -412,7 +412,7 @@ under the License.
<select2.version>3.4.8</select2.version>
<fileSaver.version>0.0.2</fileSaver.version>
- <izpack.version>5.0.8</izpack.version>
+ <izpack.version>5.0.9</izpack.version>
<httpclient.version>4.3.6</httpclient.version>
<maven-invoker.version>2.1.1</maven-invoker.version>
[2/2] syncope git commit: [SYNCOPE-884] Besides the reported failure,
all IT cases were verified with application/xml
Posted by il...@apache.org.
[SYNCOPE-884] Besides the reported failure, all IT cases were verified with application/xml
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4f6818b1
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4f6818b1
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4f6818b1
Branch: refs/heads/master
Commit: 4f6818b103ece7f4b4f10d2fe4c10ddbff33b49e
Parents: 0d5e730
Author: Francesco Chicchiricc� <il...@apache.org>
Authored: Thu Jun 30 15:17:47 2016 +0200
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Thu Jun 30 15:17:47 2016 +0200
----------------------------------------------------------------------
.../syncope/common/lib/jaxb/EntityTOType.java | 63 +++++++++++++++++++
.../common/lib/jaxb/XmlEntityTOAdapter.java | 66 ++++++++++++++++++++
.../syncope/common/lib/patch/AnyPatch.java | 6 ++
.../common/lib/patch/AttributablePatch.java | 9 ---
.../common/lib/patch/MembershipPatch.java | 9 +++
.../org/apache/syncope/common/lib/to/AnyTO.java | 13 ++++
.../syncope/common/lib/to/AttributableTO.java | 16 -----
.../syncope/common/lib/to/MembershipTO.java | 16 ++++-
.../common/lib/to/ProvisioningResult.java | 10 ++-
.../org/apache/syncope/common/lib/JAXBTest.java | 37 +++++++++++
.../org/apache/syncope/common/lib/JSONTest.java | 33 ++++++++++
11 files changed, 251 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6818b1/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/EntityTOType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/EntityTOType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/EntityTOType.java
new file mode 100644
index 0000000..95ad262
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/EntityTOType.java
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.lib.jaxb;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import org.apache.syncope.common.lib.to.AnyObjectTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.syncope.common.lib.to.UserTO;
+
+@XmlSeeAlso({ UserTO.class, GroupTO.class, AnyObjectTO.class, RealmTO.class })
+@XmlAccessorType(XmlAccessType.PROPERTY)
+public class EntityTOType {
+
+ @XmlEnum
+ public enum Type {
+ USER,
+ GROUP,
+ ANY_OBJECT,
+ REALM
+
+ }
+
+ private Type type;
+
+ private Object value;
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(final Type type) {
+ this.type = type;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(final Object value) {
+ this.value = value;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6818b1/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/XmlEntityTOAdapter.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/XmlEntityTOAdapter.java b/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/XmlEntityTOAdapter.java
new file mode 100644
index 0000000..2374891
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/jaxb/XmlEntityTOAdapter.java
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.common.lib.jaxb;
+
+import javax.xml.bind.annotation.adapters.XmlAdapter;
+import org.apache.syncope.common.lib.to.AnyObjectTO;
+import org.apache.syncope.common.lib.to.EntityTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.RealmTO;
+import org.apache.syncope.common.lib.to.UserTO;
+
+public class XmlEntityTOAdapter<E extends EntityTO> extends XmlAdapter<EntityTOType, E> {
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public E unmarshal(final EntityTOType v) throws Exception {
+ E result = null;
+
+ switch (v.getType()) {
+ case USER:
+ case GROUP:
+ case ANY_OBJECT:
+ case REALM:
+ result = (E) v.getValue();
+ break;
+
+ default:
+ }
+
+ return result;
+ }
+
+ @Override
+ public EntityTOType marshal(final E v) throws Exception {
+ EntityTOType result = new EntityTOType();
+ if (v instanceof UserTO) {
+ result.setType(EntityTOType.Type.USER);
+ } else if (v instanceof GroupTO) {
+ result.setType(EntityTOType.Type.GROUP);
+ } else if (v instanceof AnyObjectTO) {
+ result.setType(EntityTOType.Type.ANY_OBJECT);
+ } else if (v instanceof RealmTO) {
+ result.setType(EntityTOType.Type.REALM);
+ }
+ result.setValue(v);
+
+ return result;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6818b1/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java
index 78e61dd..0dadbf8 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AnyPatch.java
@@ -70,11 +70,17 @@ public abstract class AnyPatch extends AbstractBaseBean implements AttributableP
return auxClasses;
}
+ @XmlElementWrapper(name = "plainAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("plainAttrs")
@Override
public Set<AttrPatch> getPlainAttrs() {
return plainAttrs;
}
+ @XmlElementWrapper(name = "virAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("virAttrs")
@Override
public Set<AttrTO> getVirAttrs() {
return virAttrs;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6818b1/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AttributablePatch.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AttributablePatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AttributablePatch.java
index fa9d189..9c951ef 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AttributablePatch.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/AttributablePatch.java
@@ -18,21 +18,12 @@
*/
package org.apache.syncope.common.lib.patch;
-import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Set;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
import org.apache.syncope.common.lib.to.AttrTO;
public interface AttributablePatch {
- @XmlElementWrapper(name = "plainAttrs")
- @XmlElement(name = "attribute")
- @JsonProperty("plainAttrs")
Set<AttrPatch> getPlainAttrs();
- @XmlElementWrapper(name = "virAttrs")
- @XmlElement(name = "attribute")
- @JsonProperty("virAttrs")
Set<AttrTO> getVirAttrs();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6818b1/common/lib/src/main/java/org/apache/syncope/common/lib/patch/MembershipPatch.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/MembershipPatch.java b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/MembershipPatch.java
index 0ed42c1..8487e1f 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/patch/MembershipPatch.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/patch/MembershipPatch.java
@@ -18,8 +18,11 @@
*/
package org.apache.syncope.common.lib.patch;
+import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.HashSet;
import java.util.Set;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.syncope.common.lib.to.AttrTO;
@@ -57,11 +60,17 @@ public class MembershipPatch extends AbstractPatch implements AttributablePatch
this.group = group;
}
+ @XmlElementWrapper(name = "plainAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("plainAttrs")
@Override
public Set<AttrPatch> getPlainAttrs() {
return plainAttrs;
}
+ @XmlElementWrapper(name = "virAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("virAttrs")
@Override
public Set<AttrTO> getVirAttrs() {
return virAttrs;
http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6818b1/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
index 7732bcc..b63d4b0 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AnyTO.java
@@ -18,6 +18,7 @@
*/
package org.apache.syncope.common.lib.to;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.util.ArrayList;
@@ -98,11 +99,15 @@ public abstract class AnyTO extends AbstractAnnotatedBean implements EntityTO, A
return auxClasses;
}
+ @XmlElementWrapper(name = "plainAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("plainAttrs")
@Override
public Set<AttrTO> getPlainAttrs() {
return plainAttrs;
}
+ @JsonIgnore
@Override
public Map<String, AttrTO> getPlainAttrMap() {
Map<String, AttrTO> result = new HashMap<>(plainAttrs.size());
@@ -113,11 +118,15 @@ public abstract class AnyTO extends AbstractAnnotatedBean implements EntityTO, A
return Collections.unmodifiableMap(result);
}
+ @XmlElementWrapper(name = "derAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("derAttrs")
@Override
public Set<AttrTO> getDerAttrs() {
return derAttrs;
}
+ @JsonIgnore
@Override
public Map<String, AttrTO> getDerAttrMap() {
Map<String, AttrTO> result = new HashMap<>(derAttrs.size());
@@ -128,11 +137,15 @@ public abstract class AnyTO extends AbstractAnnotatedBean implements EntityTO, A
return Collections.unmodifiableMap(result);
}
+ @XmlElementWrapper(name = "virAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("virAttrs")
@Override
public Set<AttrTO> getVirAttrs() {
return virAttrs;
}
+ @JsonIgnore
@Override
public Map<String, AttrTO> getVirAttrMap() {
Map<String, AttrTO> result = new HashMap<>(virAttrs.size());
http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6818b1/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttributableTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttributableTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttributableTO.java
index 51ee0fc..da2f7a1 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttributableTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/AttributableTO.java
@@ -18,36 +18,20 @@
*/
package org.apache.syncope.common.lib.to;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;
import java.util.Set;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
public interface AttributableTO {
- @XmlElementWrapper(name = "plainAttrs")
- @XmlElement(name = "attribute")
- @JsonProperty("plainAttrs")
Set<AttrTO> getPlainAttrs();
- @JsonIgnore
Map<String, AttrTO> getPlainAttrMap();
- @XmlElementWrapper(name = "derAttrs")
- @XmlElement(name = "attribute")
- @JsonProperty("derAttrs")
Set<AttrTO> getDerAttrs();
- @JsonIgnore
Map<String, AttrTO> getDerAttrMap();
- @XmlElementWrapper(name = "virAttrs")
- @XmlElement(name = "attribute")
- @JsonProperty("virAttrs")
Set<AttrTO> getVirAttrs();
- @JsonIgnore
Map<String, AttrTO> getVirAttrMap();
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6818b1/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
index 58f3d9d..a970dec 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/MembershipTO.java
@@ -19,11 +19,14 @@
package org.apache.syncope.common.lib.to;
import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.apache.syncope.common.lib.types.AnyTypeKind;
@@ -99,11 +102,15 @@ public class MembershipTO extends RelationshipTO implements AttributableTO {
this.groupName = groupName;
}
+ @XmlElementWrapper(name = "plainAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("plainAttrs")
@Override
public Set<AttrTO> getPlainAttrs() {
return plainAttrs;
}
+ @JsonIgnore
@Override
public Map<String, AttrTO> getPlainAttrMap() {
Map<String, AttrTO> result = new HashMap<>(plainAttrs.size());
@@ -114,11 +121,15 @@ public class MembershipTO extends RelationshipTO implements AttributableTO {
return Collections.unmodifiableMap(result);
}
+ @XmlElementWrapper(name = "derAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("derAttrs")
@Override
public Set<AttrTO> getDerAttrs() {
return derAttrs;
}
+ @JsonIgnore
@Override
public Map<String, AttrTO> getDerAttrMap() {
Map<String, AttrTO> result = new HashMap<>(derAttrs.size());
@@ -129,11 +140,15 @@ public class MembershipTO extends RelationshipTO implements AttributableTO {
return Collections.unmodifiableMap(result);
}
+ @XmlElementWrapper(name = "virAttrs")
+ @XmlElement(name = "attribute")
+ @JsonProperty("virAttrs")
@Override
public Set<AttrTO> getVirAttrs() {
return virAttrs;
}
+ @JsonIgnore
@Override
public Map<String, AttrTO> getVirAttrMap() {
Map<String, AttrTO> result = new HashMap<>(virAttrs.size());
@@ -143,5 +158,4 @@ public class MembershipTO extends RelationshipTO implements AttributableTO {
return Collections.unmodifiableMap(result);
}
-
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6818b1/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningResult.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningResult.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningResult.java
index 8b9f4ee..3fe4790 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningResult.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ProvisioningResult.java
@@ -18,6 +18,7 @@
*/
package org.apache.syncope.common.lib.to;
+import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.util.ArrayList;
@@ -25,8 +26,11 @@ import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.syncope.common.lib.AbstractBaseBean;
+import org.apache.syncope.common.lib.jaxb.XmlEntityTOAdapter;
@XmlRootElement(name = "provisioningResult")
@XmlType
@@ -34,11 +38,15 @@ public class ProvisioningResult<E extends EntityTO> extends AbstractBaseBean {
private static final long serialVersionUID = 351317476398082746L;
- @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
+ @XmlJavaTypeAdapter(XmlEntityTOAdapter.class)
+ @JsonIgnore
private E entity;
private final List<PropagationStatus> propagationStatuses = new ArrayList<>();
+ @XmlTransient
+ @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "@class")
+ @JsonProperty
public E getEntity() {
return entity;
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6818b1/common/lib/src/test/java/org/apache/syncope/common/lib/JAXBTest.java
----------------------------------------------------------------------
diff --git a/common/lib/src/test/java/org/apache/syncope/common/lib/JAXBTest.java b/common/lib/src/test/java/org/apache/syncope/common/lib/JAXBTest.java
index 9434b7f..a14b878 100644
--- a/common/lib/src/test/java/org/apache/syncope/common/lib/JAXBTest.java
+++ b/common/lib/src/test/java/org/apache/syncope/common/lib/JAXBTest.java
@@ -18,14 +18,24 @@
*/
package org.apache.syncope.common.lib;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
+import java.io.StringReader;
import java.io.StringWriter;
+import java.util.UUID;
import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
+import javax.xml.bind.Unmarshaller;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.syncope.common.lib.patch.UserPatch;
import org.apache.syncope.common.lib.report.UserReportletConf;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.ConnObjectTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.UserTO;
import org.junit.Test;
@@ -42,4 +52,31 @@ public class JAXBTest {
fail(ExceptionUtils.getStackTrace(e));
}
}
+
+ @Test
+ public void provisioningResult() throws JAXBException {
+ JAXBContext context = JAXBContext.newInstance(ProvisioningResult.class);
+ Marshaller marshaller = context.createMarshaller();
+ Unmarshaller unmarshaller = context.createUnmarshaller();
+
+ GroupTO group = new GroupTO();
+ group.setName(UUID.randomUUID().toString());
+ group.setRealm(SyncopeConstants.ROOT_REALM);
+ group.getVirAttrs().add(new AttrTO.Builder().schema("rvirtualdata").value("rvirtualvalue").build());
+ group.getADynMembershipConds().put("USER", "username==a*");
+
+ ProvisioningResult<GroupTO> original = new ProvisioningResult<>();
+ original.setEntity(group);
+
+ PropagationStatus status = new PropagationStatus();
+ status.setFailureReason("failed");
+ status.setBeforeObj(new ConnObjectTO());
+ original.getPropagationStatuses().add(status);
+
+ StringWriter writer = new StringWriter();
+ marshaller.marshal(original, writer);
+
+ Object actual = unmarshaller.unmarshal(new StringReader(writer.toString()));
+ assertEquals(original, actual);
+ }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/4f6818b1/common/lib/src/test/java/org/apache/syncope/common/lib/JSONTest.java
----------------------------------------------------------------------
diff --git a/common/lib/src/test/java/org/apache/syncope/common/lib/JSONTest.java b/common/lib/src/test/java/org/apache/syncope/common/lib/JSONTest.java
index a0ef746..9c5c777 100644
--- a/common/lib/src/test/java/org/apache/syncope/common/lib/JSONTest.java
+++ b/common/lib/src/test/java/org/apache/syncope/common/lib/JSONTest.java
@@ -21,6 +21,7 @@ package org.apache.syncope.common.lib;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.StringWriter;
@@ -30,6 +31,11 @@ import org.apache.syncope.common.lib.patch.StringPatchItem;
import org.apache.syncope.common.lib.patch.StringReplacePatchItem;
import org.apache.syncope.common.lib.patch.UserPatch;
import org.apache.syncope.common.lib.report.UserReportletConf;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.ConnObjectTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.to.PropagationStatus;
+import org.apache.syncope.common.lib.to.ProvisioningResult;
import org.apache.syncope.common.lib.to.ReportTO;
import org.apache.syncope.common.lib.to.WorkflowFormPropertyTO;
import org.apache.syncope.common.lib.types.PatchOperation;
@@ -90,4 +96,31 @@ public class JSONTest {
UserPatch actual = mapper.readValue(writer.toString(), UserPatch.class);
assertEquals(patch, actual);
}
+
+ @Test
+ public void provisioningResult() throws IOException {
+ GroupTO group = new GroupTO();
+ group.setName(UUID.randomUUID().toString());
+ group.setRealm(SyncopeConstants.ROOT_REALM);
+ group.getVirAttrs().add(new AttrTO.Builder().schema("rvirtualdata").value("rvirtualvalue").build());
+ group.getADynMembershipConds().put("USER", "username==a*");
+
+ ProvisioningResult<GroupTO> original = new ProvisioningResult<>();
+ original.setEntity(group);
+
+ PropagationStatus status = new PropagationStatus();
+ status.setFailureReason("failed");
+ status.setBeforeObj(new ConnObjectTO());
+ original.getPropagationStatuses().add(status);
+
+ ObjectMapper mapper = new ObjectMapper();
+
+ StringWriter writer = new StringWriter();
+ mapper.writeValue(writer, original);
+
+ ProvisioningResult<GroupTO> actual = mapper.readValue(
+ writer.toString(), new TypeReference<ProvisioningResult<GroupTO>>() {
+ });
+ assertEquals(original, actual);
+ }
}