From 8a55180284edc4f111d66f6e8b140408c7f7d160 Mon Sep 17 00:00:00 2001
From: Matthias Piepkorn <mpiepk@gmail.com>
Date: Sun, 29 Jan 2017 12:14:47 +0000
Subject: [PATCH] Unify ServiceResponse filename casing

---
 /dev/null                                                                                            |   25 ------------
 src/main/java/org/keycloak/protocol/cas/representations/CASServiceResponseAuthenticationFailure.java |    2 
 src/main/java/org/keycloak/protocol/cas/utils/AttributesMapAdapter.java                              |    4 +-
 src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseMarshaller.java                         |    8 ++--
 src/main/java/org/keycloak/protocol/cas/representations/CASServiceResponse.java                      |   25 ++++++++++++
 src/main/java/org/keycloak/protocol/cas/representations/CASServiceResponseAuthenticationSuccess.java |    2 
 src/main/java/org/keycloak/protocol/cas/endpoints/ServiceValidateEndpoint.java                       |    8 ++--
 src/test/java/org/keycloak/protocol/cas/ServiceResponseTest.java                                     |    6 +-
 src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseHelper.java                             |   22 +++++-----
 9 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/src/main/java/org/keycloak/protocol/cas/endpoints/ServiceValidateEndpoint.java b/src/main/java/org/keycloak/protocol/cas/endpoints/ServiceValidateEndpoint.java
index a5a3069..64da5b6 100644
--- a/src/main/java/org/keycloak/protocol/cas/endpoints/ServiceValidateEndpoint.java
+++ b/src/main/java/org/keycloak/protocol/cas/endpoints/ServiceValidateEndpoint.java
@@ -7,7 +7,7 @@
 import org.keycloak.models.UserSessionModel;
 import org.keycloak.protocol.ProtocolMapper;
 import org.keycloak.protocol.cas.mappers.CASAttributeMapper;
-import org.keycloak.protocol.cas.representations.CasServiceResponse;
+import org.keycloak.protocol.cas.representations.CASServiceResponse;
 import org.keycloak.protocol.cas.utils.CASValidationException;
 import org.keycloak.protocol.cas.utils.ContentTypeHelper;
 import org.keycloak.protocol.cas.utils.ServiceResponseHelper;
@@ -40,17 +40,17 @@
             }
         }
 
-        CasServiceResponse serviceResponse = ServiceResponseHelper.createSuccess(userSession.getUser().getUsername(), attributes);
+        CASServiceResponse serviceResponse = ServiceResponseHelper.createSuccess(userSession.getUser().getUsername(), attributes);
         return prepare(Response.Status.OK, serviceResponse);
     }
 
     @Override
     protected Response errorResponse(CASValidationException e) {
-        CasServiceResponse serviceResponse = ServiceResponseHelper.createFailure(e.getError(), e.getErrorDescription());
+        CASServiceResponse serviceResponse = ServiceResponseHelper.createFailure(e.getError(), e.getErrorDescription());
         return prepare(e.getStatus(), serviceResponse);
     }
 
-    private Response prepare(Response.Status status, CasServiceResponse serviceResponse) {
+    private Response prepare(Response.Status status, CASServiceResponse serviceResponse) {
         MediaType responseMediaType = new ContentTypeHelper(request, restRequest, uriInfo).selectResponseType();
         return ServiceResponseHelper.createResponse(status, responseMediaType, serviceResponse);
     }
diff --git a/src/main/java/org/keycloak/protocol/cas/representations/CASServiceResponse.java b/src/main/java/org/keycloak/protocol/cas/representations/CASServiceResponse.java
new file mode 100644
index 0000000..42c8297
--- /dev/null
+++ b/src/main/java/org/keycloak/protocol/cas/representations/CASServiceResponse.java
@@ -0,0 +1,25 @@
+package org.keycloak.protocol.cas.representations;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement(name = "serviceResponse")
+public class CASServiceResponse {
+    private CASServiceResponseAuthenticationFailure authenticationFailure;
+    private CASServiceResponseAuthenticationSuccess authenticationSuccess;
+
+    public CASServiceResponseAuthenticationFailure getAuthenticationFailure() {
+        return this.authenticationFailure;
+    }
+
+    public void setAuthenticationFailure(final CASServiceResponseAuthenticationFailure authenticationFailure) {
+        this.authenticationFailure = authenticationFailure;
+    }
+
+    public CASServiceResponseAuthenticationSuccess getAuthenticationSuccess() {
+        return this.authenticationSuccess;
+    }
+
+    public void setAuthenticationSuccess(final CASServiceResponseAuthenticationSuccess authenticationSuccess) {
+        this.authenticationSuccess = authenticationSuccess;
+    }
+}
diff --git a/src/main/java/org/keycloak/protocol/cas/representations/CasServiceResponseAuthenticationFailure.java b/src/main/java/org/keycloak/protocol/cas/representations/CASServiceResponseAuthenticationFailure.java
similarity index 92%
rename from src/main/java/org/keycloak/protocol/cas/representations/CasServiceResponseAuthenticationFailure.java
rename to src/main/java/org/keycloak/protocol/cas/representations/CASServiceResponseAuthenticationFailure.java
index c34095c..f0fbba5 100644
--- a/src/main/java/org/keycloak/protocol/cas/representations/CasServiceResponseAuthenticationFailure.java
+++ b/src/main/java/org/keycloak/protocol/cas/representations/CASServiceResponseAuthenticationFailure.java
@@ -6,7 +6,7 @@
 import javax.xml.bind.annotation.XmlValue;
 
 @XmlAccessorType(XmlAccessType.FIELD)
-public class CasServiceResponseAuthenticationFailure {
+public class CASServiceResponseAuthenticationFailure {
     @XmlAttribute
     private String code;
     @XmlValue
diff --git a/src/main/java/org/keycloak/protocol/cas/representations/CasServiceResponseAuthenticationSuccess.java b/src/main/java/org/keycloak/protocol/cas/representations/CASServiceResponseAuthenticationSuccess.java
similarity index 95%
rename from src/main/java/org/keycloak/protocol/cas/representations/CasServiceResponseAuthenticationSuccess.java
rename to src/main/java/org/keycloak/protocol/cas/representations/CASServiceResponseAuthenticationSuccess.java
index 6dc8fd6..30a37c6 100644
--- a/src/main/java/org/keycloak/protocol/cas/representations/CasServiceResponseAuthenticationSuccess.java
+++ b/src/main/java/org/keycloak/protocol/cas/representations/CASServiceResponseAuthenticationSuccess.java
@@ -8,7 +8,7 @@
 import java.util.Map;
 
 @XmlAccessorType(XmlAccessType.FIELD)
-public class CasServiceResponseAuthenticationSuccess {
+public class CASServiceResponseAuthenticationSuccess {
     private String user;
     private String proxyGrantingTicket;
     @XmlElementWrapper
diff --git a/src/main/java/org/keycloak/protocol/cas/representations/CasServiceResponse.java b/src/main/java/org/keycloak/protocol/cas/representations/CasServiceResponse.java
deleted file mode 100644
index b43b52d..0000000
--- a/src/main/java/org/keycloak/protocol/cas/representations/CasServiceResponse.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.keycloak.protocol.cas.representations;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement(name = "serviceResponse")
-public class CasServiceResponse {
-    private CasServiceResponseAuthenticationFailure authenticationFailure;
-    private CasServiceResponseAuthenticationSuccess authenticationSuccess;
-
-    public CasServiceResponseAuthenticationFailure getAuthenticationFailure() {
-        return this.authenticationFailure;
-    }
-
-    public void setAuthenticationFailure(final CasServiceResponseAuthenticationFailure authenticationFailure) {
-        this.authenticationFailure = authenticationFailure;
-    }
-
-    public CasServiceResponseAuthenticationSuccess getAuthenticationSuccess() {
-        return this.authenticationSuccess;
-    }
-
-    public void setAuthenticationSuccess(final CasServiceResponseAuthenticationSuccess authenticationSuccess) {
-        this.authenticationSuccess = authenticationSuccess;
-    }
-}
diff --git a/src/main/java/org/keycloak/protocol/cas/utils/AttributesMapAdapter.java b/src/main/java/org/keycloak/protocol/cas/utils/AttributesMapAdapter.java
index ca8f7ed..8afc07b 100644
--- a/src/main/java/org/keycloak/protocol/cas/utils/AttributesMapAdapter.java
+++ b/src/main/java/org/keycloak/protocol/cas/utils/AttributesMapAdapter.java
@@ -1,6 +1,6 @@
 package org.keycloak.protocol.cas.utils;
 
-import org.keycloak.protocol.cas.representations.CasServiceResponse;
+import org.keycloak.protocol.cas.representations.CASServiceResponse;
 
 import javax.xml.bind.JAXBElement;
 import javax.xml.bind.annotation.XmlAccessType;
@@ -50,7 +50,7 @@
 
         private void addElement(String name, Object value) {
             if (value != null) {
-                String namespace = CasServiceResponse.class.getPackage().getAnnotation(XmlSchema.class).namespace();
+                String namespace = CASServiceResponse.class.getPackage().getAnnotation(XmlSchema.class).namespace();
                 elements.add(new JAXBElement<>(new QName(namespace, name), String.class, value.toString()));
             }
         }
diff --git a/src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseHelper.java b/src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseHelper.java
index ac1aa64..e3223d1 100644
--- a/src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseHelper.java
+++ b/src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseHelper.java
@@ -1,9 +1,9 @@
 package org.keycloak.protocol.cas.utils;
 
 import org.keycloak.protocol.cas.representations.CASErrorCode;
-import org.keycloak.protocol.cas.representations.CasServiceResponse;
-import org.keycloak.protocol.cas.representations.CasServiceResponseAuthenticationFailure;
-import org.keycloak.protocol.cas.representations.CasServiceResponseAuthenticationSuccess;
+import org.keycloak.protocol.cas.representations.CASServiceResponse;
+import org.keycloak.protocol.cas.representations.CASServiceResponseAuthenticationFailure;
+import org.keycloak.protocol.cas.representations.CASServiceResponseAuthenticationSuccess;
 
 import javax.ws.rs.core.HttpHeaders;
 import javax.ws.rs.core.MediaType;
@@ -15,14 +15,14 @@
     private ServiceResponseHelper() {
     }
 
-    public static CasServiceResponse createSuccess(String username, Map<String, Object> attributes) {
+    public static CASServiceResponse createSuccess(String username, Map<String, Object> attributes) {
         return createSuccess(username, attributes, null, null);
     }
 
-    public static CasServiceResponse createSuccess(String username, Map<String, Object> attributes,
+    public static CASServiceResponse createSuccess(String username, Map<String, Object> attributes,
                                                    String proxyGrantingTicket, List<String> proxies) {
-        CasServiceResponse response = new CasServiceResponse();
-        CasServiceResponseAuthenticationSuccess success = new CasServiceResponseAuthenticationSuccess();
+        CASServiceResponse response = new CASServiceResponse();
+        CASServiceResponseAuthenticationSuccess success = new CASServiceResponseAuthenticationSuccess();
         success.setUser(username);
         success.setProxies(proxies);
         success.setProxyGrantingTicket(proxyGrantingTicket);
@@ -33,9 +33,9 @@
         return response;
     }
 
-    public static CasServiceResponse createFailure(CASErrorCode errorCode, String errorDescription) {
-        CasServiceResponse response = new CasServiceResponse();
-        CasServiceResponseAuthenticationFailure failure = new CasServiceResponseAuthenticationFailure();
+    public static CASServiceResponse createFailure(CASErrorCode errorCode, String errorDescription) {
+        CASServiceResponse response = new CASServiceResponse();
+        CASServiceResponseAuthenticationFailure failure = new CASServiceResponseAuthenticationFailure();
         failure.setCode(errorCode == null ? CASErrorCode.INTERNAL_ERROR.name() : errorCode.name());
         failure.setDescription(errorDescription);
         response.setAuthenticationFailure(failure);
@@ -43,7 +43,7 @@
         return response;
     }
 
-    public static Response createResponse(Response.Status status, MediaType mediaType, CasServiceResponse serviceResponse) {
+    public static Response createResponse(Response.Status status, MediaType mediaType, CASServiceResponse serviceResponse) {
         Response.ResponseBuilder builder = Response.status(status)
                 .header(HttpHeaders.CONTENT_TYPE, mediaType.withCharset("utf-8"));
         if (MediaType.APPLICATION_JSON_TYPE.equals(mediaType)) {
diff --git a/src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseMarshaller.java b/src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseMarshaller.java
index a5aa6ac..d1b9d58 100644
--- a/src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseMarshaller.java
+++ b/src/main/java/org/keycloak/protocol/cas/utils/ServiceResponseMarshaller.java
@@ -5,7 +5,7 @@
 import com.fasterxml.jackson.core.util.DefaultIndenter;
 import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import org.keycloak.protocol.cas.representations.CasServiceResponse;
+import org.keycloak.protocol.cas.representations.CASServiceResponse;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
@@ -23,9 +23,9 @@
     private ServiceResponseMarshaller() {
     }
 
-    public static String marshalXml(CasServiceResponse serviceResponse) {
+    public static String marshalXml(CASServiceResponse serviceResponse) {
         try {
-            JAXBContext jaxbContext = JAXBContext.newInstance(CasServiceResponse.class);
+            JAXBContext jaxbContext = JAXBContext.newInstance(CASServiceResponse.class);
             Marshaller marshaller = jaxbContext.createMarshaller();
             //disable xml header
             marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
@@ -39,7 +39,7 @@
         }
     }
 
-    public static String marshalJson(CasServiceResponse serviceResponse) {
+    public static String marshalJson(CASServiceResponse serviceResponse) {
         ObjectMapper mapper = new ObjectMapper();
         mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
         //Force newlines to be LF (default is system dependent)
diff --git a/src/test/java/org/keycloak/protocol/cas/ServiceResponseTest.java b/src/test/java/org/keycloak/protocol/cas/ServiceResponseTest.java
index 284a567..4e07135 100644
--- a/src/test/java/org/keycloak/protocol/cas/ServiceResponseTest.java
+++ b/src/test/java/org/keycloak/protocol/cas/ServiceResponseTest.java
@@ -2,7 +2,7 @@
 
 import org.junit.Test;
 import org.keycloak.protocol.cas.representations.CASErrorCode;
-import org.keycloak.protocol.cas.representations.CasServiceResponse;
+import org.keycloak.protocol.cas.representations.CASServiceResponse;
 import org.keycloak.protocol.cas.utils.ServiceResponseHelper;
 import org.keycloak.protocol.cas.utils.ServiceResponseMarshaller;
 
@@ -62,7 +62,7 @@
         attributes.put("int", 123);
         attributes.put("string", "abc");
 
-        CasServiceResponse response = ServiceResponseHelper.createSuccess("username", attributes, "PGTIOU-test",
+        CASServiceResponse response = ServiceResponseHelper.createSuccess("username", attributes, "PGTIOU-test",
                 Arrays.asList("https://proxy1/pgtUrl", "https://proxy2/pgtUrl"));
 
         assertEquals(EXPECTED_JSON_SUCCESS, ServiceResponseMarshaller.marshalJson(response));
@@ -71,7 +71,7 @@
 
     @Test
     public void testErrorResponse() throws Exception {
-        CasServiceResponse response = ServiceResponseHelper.createFailure(CASErrorCode.INVALID_REQUEST, "Error description");
+        CASServiceResponse response = ServiceResponseHelper.createFailure(CASErrorCode.INVALID_REQUEST, "Error description");
 
         assertEquals(EXPECTED_JSON_FAILURE, ServiceResponseMarshaller.marshalJson(response));
         assertEquals(EXPECTED_XML_FAILURE, ServiceResponseMarshaller.marshalXml(response));

--
Gitblit v1.9.1