cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From owu...@apache.org
Subject svn commit: r1572234 - in /cxf/fediz/trunk/services/idp/src: main/java/org/apache/cxf/fediz/service/idp/service/jpa/ test/java/org/apache/cxf/fediz/service/idp/integrationtests/ test/java/org/apache/cxf/fediz/service/idp/service/jpa/
Date Wed, 26 Feb 2014 20:25:00 GMT
Author: owulff
Date: Wed Feb 26 20:25:00 2014
New Revision: 1572234

URL: http://svn.apache.org/r1572234
Log:
Minor cleanup

Modified:
    cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java
    cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java
    cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java
    cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPATest.java

Modified: cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java?rev=1572234&r1=1572233&r2=1572234&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java
(original)
+++ cxf/fediz/trunk/services/idp/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPAImpl.java
Wed Feb 26 20:25:00 2014
@@ -20,9 +20,8 @@ package org.apache.cxf.fediz.service.idp
 
 import java.net.URI;
 import java.util.ArrayList;
-import java.util.List;            
+import java.util.List;
 
-import javax.persistence.EntityExistsException;
 import javax.persistence.EntityManager;
 import javax.persistence.PersistenceContext;
 import javax.persistence.Query;
@@ -72,20 +71,14 @@ public class ClaimDAOJPAImpl implements 
     
     @Override
     public Claim addClaim(Claim claim) {
-        try {
-            ClaimEntity entity = new ClaimEntity();
-            domain2entity(claim, entity);
-            em.persist(entity);
-            
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Claim '" + claim.getClaimType() + "' added");
-            }
-            return entity2domain(entity);
-        } catch (EntityExistsException ex) {
-            LOG.warn("Claim with type '" + claim.getClaimType() + "' already exists");
-            //[TODO] Introduce exception layer (to decouple from spring/jpa config)
-            throw new RuntimeException("Claim with type '" + claim.getClaimType() + "' already
exists");
+        ClaimEntity entity = new ClaimEntity();
+        domain2entity(claim, entity);
+        em.persist(entity);
+        
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Claim '" + claim.getClaimType() + "' added");
         }
+        return entity2domain(entity);
     }
 
     @Override

Modified: cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java?rev=1572234&r1=1572233&r2=1572234&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java
(original)
+++ cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/integrationtests/RestITTest.java
Wed Feb 26 20:25:00 2014
@@ -171,7 +171,6 @@ public class RestITTest {
     
     private String getBasicAuthentication(String username, String password) throws UnsupportedEncodingException
{
         String token = username + ":" + password;
-        System.out.println("Basic " + Base64.encode(token.getBytes()));
         return "Basic " + Base64.encode(token.getBytes());
     }
 

Modified: cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java?rev=1572234&r1=1572233&r2=1572234&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java
(original)
+++ cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationDAOJPATest.java
Wed Feb 26 20:25:00 2014
@@ -44,15 +44,9 @@ import org.springframework.util.Assert;
 @ContextConfiguration(locations = { "classpath:testContext.xml" })
 public class ApplicationDAOJPATest {
 
-    //@Autowired
-    //private IdpDAO idpDAO;
-    
     @Autowired
     private ApplicationDAO applicationDAO;
     
-    //@Autowired
-    //private TrustedIdpDAO trustedIdpDAO;
-    
     
     @BeforeClass
     public static void init() {

Modified: cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPATest.java
URL: http://svn.apache.org/viewvc/cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPATest.java?rev=1572234&r1=1572233&r2=1572234&view=diff
==============================================================================
--- cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPATest.java
(original)
+++ cxf/fediz/trunk/services/idp/src/test/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimDAOJPATest.java
Wed Feb 26 20:25:00 2014
@@ -40,12 +40,6 @@ import org.springframework.util.Assert;
 @ContextConfiguration(locations = { "classpath:testContext.xml" })
 public class ClaimDAOJPATest {
 
-    //@Autowired
-    //private IdpDAO idpDAO;
-    
-    //@Autowired
-    //private TrustedIdpDAO trustedIdpDAO;
-    
     @Autowired
     private ClaimDAO claimDAO;
     
@@ -103,76 +97,6 @@ public class ClaimDAOJPATest {
         claimDAO.addClaim(claim5);
     }
     
-    //[TODO] UpdateClaim
-    /*
-    @Test
-    public void testUpdateIdp() {
-        String realm = "urn:org:apache:cxf:fediz:idp:testupdate";
-        //Prepare
-        Idp idp = createIdp(realm);
-        idpDAO.addIdp(idp);
-        
-        //Testcase
-        idp = new Idp();
-        idp.setRealm(realm);
-        idp.setCertificate("UstsKeystoreA.properties");
-        idp.setCertificatePassword("Urealma");
-        idp.setIdpUrl("Uhttps://localhost:9443/fediz-idp/federation");
-        idp.setStsUrl("Uhttps://localhost:9443/fediz-idp-sts/REALMA");
-        idp.setServiceDisplayName("UNEW REALM");
-        idp.setServiceDescription("UIDP of New Realm");
-        idp.setUri("Urealmn");
-        idp.setProvideIDPList(true);
-        Map<String, String> authUris = new HashMap<String, String>();
-        authUris.put("default", "/login/default");
-        idp.setAuthenticationURIs(authUris);
-        List<String> protocols = new ArrayList<String>();
-        protocols.add("http://docs.oasis-open.org/wsfed/federation/200706");
-        idp.setSupportedProtocols(protocols);
-        List<String> tokenTypes = new ArrayList<String>();
-        tokenTypes.add(WSConstants.SAML2_NS);
-        idp.setTokenTypesOffered(tokenTypes);
-        idp.setUseCurrentIDP(false);
-        idpDAO.updateIdp(realm, idp);
-        
-        idp = idpDAO.getIdp(realm, null);
-        
-        Assert.isTrue("UstsKeystoreA.properties".equals(idp.getCertificate()),
-                      "Certificate doesn't match");
-        Assert.isTrue("Urealma".equals(idp.getCertificatePassword()),
-                      "Certificate password doesn't match");
-        Assert.isTrue(realm.equals(idp.getRealm()),
-                      "Realm doesn't match");
-        Assert.isTrue("UIDP of New Realm".equals(idp.getServiceDescription()),
-                      "ServiceDescription doesn't match");
-        Assert.isTrue("UNEW REALM".equals(idp.getServiceDisplayName()),
-                      "ServiceDisplayName doesn't match");        
-        Assert.isTrue("Uhttps://localhost:9443/fediz-idp/federation".equals(idp.getIdpUrl()),
-                      "IdpUrl doesn't match");
-        Assert.isTrue("Uhttps://localhost:9443/fediz-idp-sts/REALMA".equals(idp.getStsUrl()),
-                      "StsUrl doesn't match");
-        Assert.isTrue("Urealmn".equals(idp.getUri()),
-                      "Uri doesn't match");
-        Assert.isTrue(idp.isProvideIDPList(),
-                      "ProvideIDPList doesn't match");
-        Assert.isTrue(!idp.isUseCurrentIDP(),
-                      "UseCurrentIDP doesn't match");
-        Assert.isTrue(1 == idp.getAuthenticationURIs().size(),
-                      "Number of AuthenticationURIs doesn't match");
-        Assert.isTrue(1 == idp.getSupportedProtocols().size(),
-                      "Number of SupportedProtocols doesn't match");
-        Assert.isTrue(1 == idp.getTokenTypesOffered().size(),
-                      "Number of TokenTypesOffered doesn't match");
-        Assert.isTrue(0 == idp.getApplications().size(),
-                      "Number of applications doesn't match");
-        Assert.isTrue(0 == idp.getTrustedIdps().size(),
-                      "Number of trusted IDPs doesn't match");
-        Assert.isTrue(0 == idp.getClaimTypesOffered().size(),
-                      "Number of claims doesn't match");
-        
-    }
-     */
-    
     
     @Test(expected = EmptyResultDataAccessException.class)
     public void testTryRemoveUnknownClaim() {



Mime
View raw message