From 45fc3b612fe45ec01db5e6e6e65661b5d8898f1b Mon Sep 17 00:00:00 2001 From: Alex Rudyy Date: Wed, 3 Apr 2013 11:50:36 +0000 Subject: QPID-4695: Add validation of configured object names and IDs git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1463933 13f79535-47bb-0310-9956-ffa450edef68 --- .../systest/rest/AuthenticationProviderRestTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'qpid/java/systests/src') diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AuthenticationProviderRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AuthenticationProviderRestTest.java index 4ba2069dfd..09408572d7 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AuthenticationProviderRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AuthenticationProviderRestTest.java @@ -24,6 +24,7 @@ import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; import org.apache.qpid.server.model.AuthenticationProvider; import org.apache.qpid.server.model.LifetimePolicy; @@ -90,6 +91,22 @@ public class AuthenticationProviderRestTest extends QpidRestTestCase assertProvider(false, AnonymousAuthenticationManagerFactory.PROVIDER_TYPE, provider); } + public void testUpdateAuthenticationProviderIdFails() throws Exception + { + String providerName = "test-provider"; + Map attributes = new HashMap(); + attributes.put(AuthenticationProvider.NAME, providerName); + attributes.put(AuthenticationProvider.TYPE, AnonymousAuthenticationManagerFactory.PROVIDER_TYPE); + + int responseCode = getRestTestHelper().submitRequest("/rest/authenticationprovider/" + providerName, "PUT", attributes); + assertEquals("Unexpected response code", 201, responseCode); + + attributes.put(AuthenticationProvider.ID, UUID.randomUUID()); + + responseCode = getRestTestHelper().submitRequest("/rest/authenticationprovider/" + providerName, "PUT", attributes); + assertEquals("Update with new ID should fail", 409, responseCode); + } + public void testDeleteOfDefaultAuthenticationProviderFails() throws Exception { String providerName = TestBrokerConfiguration.ENTRY_NAME_AUTHENTICATION_PROVIDER; -- cgit v1.2.1