You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by gi...@apache.org on 2015/01/20 17:37:00 UTC
[1/2] syncope git commit: [SYNCOPE-629] TEMPLATE entities are
correctly exported
Repository: syncope
Updated Branches:
refs/heads/master eca7585b3 -> a1eead02d
[SYNCOPE-629] TEMPLATE entities are correctly exported
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/7b1c5ebe
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/7b1c5ebe
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/7b1c5ebe
Branch: refs/heads/master
Commit: 7b1c5ebeb85c2b27aaf1177e931431fa1da68be0
Parents: f39739c
Author: giacomolm <gi...@hotmail.it>
Authored: Tue Jan 20 17:29:09 2015 +0100
Committer: giacomolm <gi...@hotmail.it>
Committed: Tue Jan 20 17:29:09 2015 +0100
----------------------------------------------------------------------
.../syncope/core/util/ContentExporter.java | 9 ++-
.../core/rest/ConfigurationTestITCase.java | 62 ++++++++++++++++++++
2 files changed, 70 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/7b1c5ebe/core/src/main/java/org/apache/syncope/core/util/ContentExporter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/util/ContentExporter.java b/core/src/main/java/org/apache/syncope/core/util/ContentExporter.java
index 5b34358..e7fd35b 100644
--- a/core/src/main/java/org/apache/syncope/core/util/ContentExporter.java
+++ b/core/src/main/java/org/apache/syncope/core/util/ContentExporter.java
@@ -70,6 +70,9 @@ public class ContentExporter extends AbstractContentDealer {
"SYNCOPEUSER", "UATTR", "UATTRVALUE", "UATTRUNIQUEVALUE", "UDERATTR", "UVIRATTR",
"MEMBERSHIP", "MATTR", "MATTRVALUE", "MATTRUNIQUEVALUE", "MDERATTR", "MVIRATTR"
}));
+
+ protected final static Set<String> TABLE_SUFFIXES_TO_BE_INCLUDED =
+ new HashSet<String>(Arrays.asList(new String[] {"TEMPLATE"}));
protected static final Map<String, String> TABLES_TO_BE_FILTERED =
Collections.singletonMap("TASK", "DTYPE <> 'PropagationTask'");
@@ -81,7 +84,11 @@ public class ContentExporter extends AbstractContentDealer {
boolean allowed = true;
for (String prefix : TABLE_PREFIXES_TO_BE_EXCLUDED) {
if (tableName.toUpperCase().startsWith(prefix)) {
- allowed = false;
+ for (String suffix : TABLE_SUFFIXES_TO_BE_INCLUDED) {
+ if (!tableName.toUpperCase().endsWith(suffix)) {
+ allowed = false;
+ }
+ }
}
}
return allowed;
http://git-wip-us.apache.org/repos/asf/syncope/blob/7b1c5ebe/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java b/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java
index 01c3d2b..cbe13d5 100644
--- a/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java
+++ b/core/src/test/java/org/apache/syncope/core/rest/ConfigurationTestITCase.java
@@ -31,11 +31,13 @@ import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.SyncopeConstants;
import org.apache.syncope.common.to.ConfTO;
import org.apache.syncope.common.types.EntityViolationType;
import org.apache.syncope.common.SyncopeClientException;
import org.apache.syncope.common.to.AttributeTO;
+import org.apache.syncope.common.to.RoleTO;
import org.apache.syncope.common.to.SchemaTO;
import org.apache.syncope.common.types.AttributableType;
import org.apache.syncope.common.types.AttributeSchemaType;
@@ -149,4 +151,64 @@ public class ConfigurationTestITCase extends AbstractTest {
assertTrue(e.getElements().iterator().next().contains(EntityViolationType.InvalidName.name()));
}
}
+
+ @Test
+ public void issueSYNCOPE629() throws IOException{
+ SchemaTO membershipKey = new SchemaTO();
+ membershipKey.setName("membershipKey"+getUUIDString());
+ membershipKey.setType(AttributeSchemaType.String);
+ createSchema(AttributableType.MEMBERSHIP, SchemaType.NORMAL, membershipKey);
+
+ SchemaTO roleKey = new SchemaTO();
+ roleKey.setName("roleKey"+getUUIDString());
+ roleKey.setType(AttributeSchemaType.String);
+ createSchema(AttributableType.ROLE, SchemaType.NORMAL, roleKey);
+
+ RoleTO roleTO = new RoleTO();
+ roleTO.setName("aRole" + getUUIDString());
+ roleTO.setParent(8L);
+ // verify inheritance password and account policies
+ roleTO.setInheritAccountPolicy(false);
+ // not inherited so setter execution shouldn't be ignored
+ roleTO.setAccountPolicy(6L);
+ roleTO.setInheritPasswordPolicy(true);
+ // inherited so setter execution should be ignored
+ roleTO.setPasswordPolicy(2L);
+ roleTO.getRAttrTemplates().add("icon");
+ roleTO.getAttrs().add(attributeTO("icon", "anIcon"));
+ roleTO.getResources().add(RESOURCE_NAME_LDAP);
+ roleTO.getMAttrTemplates().add(membershipKey.getName());
+ roleTO.getRAttrTemplates().add(roleKey.getName());
+ RoleTO testRole = createRole(roleTO);
+
+ Response response = configurationService.export();
+ assertNotNull(response);
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusInfo().getStatusCode());
+ assertTrue(response.getMediaType().toString().startsWith(MediaType.TEXT_XML));
+ String contentDisposition = response.getHeaderString(HttpHeaders.CONTENT_DISPOSITION);
+ assertNotNull(contentDisposition);
+
+ Object entity = response.getEntity();
+ assertTrue(entity instanceof InputStream);
+ String configExport = IOUtils.toString((InputStream) entity, SyncopeConstants.DEFAULT_ENCODING);
+ assertFalse(configExport.isEmpty());
+ assertTrue(configExport.length() > 1000);
+
+ String[] result = StringUtils.substringsBetween(configExport, "<RATTRTEMPLATE", "/>");
+ boolean rattrExists = false;
+ for(String entry : result){
+ if(entry.contains(roleKey.getName())) rattrExists = true;
+ }
+ assertTrue(rattrExists);
+
+ result = StringUtils.substringsBetween(configExport, "<MATTRTEMPLATE", "/>");
+ boolean mattrExists = false;
+ for(String entry : result){
+ if(entry.contains(membershipKey.getName())) mattrExists = true;
+ }
+ assertTrue(mattrExists);
+
+ deleteRole(testRole.getId());
+
+ }
}
[2/2] syncope git commit: Merge branch '1_2_X'
Posted by gi...@apache.org.
Merge branch '1_2_X'
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/a1eead02
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/a1eead02
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/a1eead02
Branch: refs/heads/master
Commit: a1eead02d2caa7ddf2218bc2d7fe8da97c5515e6
Parents: eca7585 7b1c5eb
Author: giacomolm <gi...@hotmail.it>
Authored: Tue Jan 20 17:30:26 2015 +0100
Committer: giacomolm <gi...@hotmail.it>
Committed: Tue Jan 20 17:30:26 2015 +0100
----------------------------------------------------------------------
.../syncope/core/util/ContentExporter.java | 9 ++-
.../core/rest/ConfigurationTestITCase.java | 62 ++++++++++++++++++++
2 files changed, 70 insertions(+), 1 deletion(-)
----------------------------------------------------------------------