This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
commit 2335c1fe93e26f48c03f6cc4ff8c78e80bb7a897 Author: Andrea Cosentino <[email protected]> AuthorDate: Fri May 9 11:25:02 2025 +0200 CAMEL-22013 - camel-api - Remove all usage of component.extension and the component.extension package content itself - Servicenow Signed-off-by: Andrea Cosentino <[email protected]> --- .../component/servicenow/ServiceNowComponent.java | 8 - .../ServiceNowComponentVerifierExtension.java | 174 -------------------- .../ServiceNowComponentVerifierExtensionIT.java | 178 --------------------- .../servicenow/ServiceNowComponentVerifierIT.java | 173 -------------------- 4 files changed, 533 deletions(-) diff --git a/components/camel-servicenow/camel-servicenow-component/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java b/components/camel-servicenow/camel-servicenow-component/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java index 31db25ac25a..4a1fe9efa74 100644 --- a/components/camel-servicenow/camel-servicenow-component/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java +++ b/components/camel-servicenow/camel-servicenow-component/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponent.java @@ -21,7 +21,6 @@ import java.util.Map; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.SSLContextParametersAware; -import org.apache.camel.component.extension.ComponentVerifierExtension; import org.apache.camel.spi.Metadata; import org.apache.camel.spi.annotations.Component; import org.apache.camel.support.DefaultComponent; @@ -50,8 +49,6 @@ public class ServiceNowComponent extends DefaultComponent implements SSLContextP super(camelContext); this.configuration = new ServiceNowConfiguration(); - - registerExtension(ServiceNowComponentVerifierExtension::new); registerExtension(ServiceNowMetaDataExtension::new); } @@ -94,11 +91,6 @@ public class ServiceNowComponent extends DefaultComponent implements SSLContextP this.useGlobalSslContextParameters = useGlobalSslContextParameters; } - public ComponentVerifierExtension getVerifier() { - return (scope, parameters) -> getExtension(ComponentVerifierExtension.class) - .orElseThrow(UnsupportedOperationException::new).verify(scope, parameters); - } - // **************************************** // Component impl // **************************************** diff --git a/components/camel-servicenow/camel-servicenow-component/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponentVerifierExtension.java b/components/camel-servicenow/camel-servicenow-component/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponentVerifierExtension.java deleted file mode 100644 index a7ecc175130..00000000000 --- a/components/camel-servicenow/camel-servicenow-component/src/main/java/org/apache/camel/component/servicenow/ServiceNowComponentVerifierExtension.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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.camel.component.servicenow; - -import java.util.Map; - -import jakarta.ws.rs.HttpMethod; -import jakarta.ws.rs.core.MediaType; - -import org.apache.camel.component.extension.verifier.DefaultComponentVerifierExtension; -import org.apache.camel.component.extension.verifier.NoSuchOptionException; -import org.apache.camel.component.extension.verifier.ResultBuilder; -import org.apache.camel.component.extension.verifier.ResultErrorBuilder; -import org.apache.camel.util.ObjectHelper; - -final class ServiceNowComponentVerifierExtension extends DefaultComponentVerifierExtension { - - ServiceNowComponentVerifierExtension() { - super("servicenow"); - } - - // ********************************* - // Parameters validation - // ********************************* - - @Override - protected Result verifyParameters(Map<String, Object> parameters) { - ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.PARAMETERS); - - // Validate using the catalog - super.verifyParametersAgainstCatalog(builder, parameters); - - return builder.build(); - } - - // ********************************* - // Connectivity validation - // ********************************* - - @Override - protected Result verifyConnectivity(Map<String, Object> parameters) { - // Default is success - ResultBuilder builder = ResultBuilder.withStatusAndScope(Result.Status.OK, Scope.CONNECTIVITY); - - try { - final ServiceNowConfiguration configuration = getServiceNowConfiguration(parameters); - final ServiceNowClient client = getServiceNowClient(configuration, parameters); - final String tableName = ObjectHelper.supplyIfEmpty(configuration.getTable(), () -> "incident"); - - client.reset() - .types(MediaType.APPLICATION_JSON_TYPE) - .path("now") - .path(configuration.getApiVersion()) - .path("table") - .path(tableName) - .query(ServiceNowParams.SYSPARM_LIMIT.getId(), 1L) - .query(ServiceNowParams.SYSPARM_FIELDS.getId(), "sys_id") - .invoke(HttpMethod.GET); - } catch (NoSuchOptionException e) { - builder.error( - ResultErrorBuilder.withMissingOption(e.getOptionName()).build()); - } catch (ServiceNowException e) { - ResultErrorBuilder errorBuilder = ResultErrorBuilder.withException(e) - .detail(VerificationError.HttpAttribute.HTTP_CODE, e.getCode()) - .detail("servicenow_error_message", e.getMessage()) - .detail("servicenow_error_status", e.getStatus()) - .detail("servicenow_error_detail", e.getDetail()); - - if (e.getCode() == 401) { - errorBuilder.code(VerificationError.StandardCode.AUTHENTICATION); - errorBuilder.parameterKey("userName"); - errorBuilder.parameterKey("password"); - errorBuilder.parameterKey("oauthClientId"); - errorBuilder.parameterKey("oauthClientSecret"); - } - - builder.error(errorBuilder.build()); - } catch (Exception e) { - builder.error( - ResultErrorBuilder.withException(e).build()); - } - - return builder.build(); - } - - // ********************************* - // Helpers - // ********************************* - - private String getInstanceName(Map<String, Object> parameters) throws Exception { - String instanceName = (String) parameters.get("instanceName"); - if (ObjectHelper.isEmpty(instanceName) && ObjectHelper.isNotEmpty(getComponent())) { - instanceName = getComponent(ServiceNowComponent.class).getInstanceName(); - } - - if (ObjectHelper.isEmpty(instanceName)) { - throw new NoSuchOptionException("instanceName"); - } - - return instanceName; - } - - private ServiceNowClient getServiceNowClient(ServiceNowConfiguration configuration, Map<String, Object> parameters) - throws Exception { - ServiceNowClient client = null; - - // check if a client has been supplied to the parameters map - for (Object value : parameters.values()) { - if (value instanceof ServiceNowClient) { - client = ServiceNowClient.class.cast(value); - break; - } - } - - // if no client is provided - if (ObjectHelper.isEmpty(client)) { - final String instanceName = getInstanceName(parameters); - - // Configure Api and OAuthToken ULRs using instanceName - if (!configuration.hasApiUrl()) { - configuration.setApiUrl(String.format("https://%s.service-now.com/api", instanceName)); - } - if (!configuration.hasOauthTokenUrl()) { - configuration.setOauthTokenUrl(String.format("https://%s.service-now.com/oauth_token.do", instanceName)); - } - - client = new ServiceNowClient(getCamelContext(), configuration); - } - - return client; - } - - private ServiceNowConfiguration getServiceNowConfiguration(Map<String, Object> parameters) throws Exception { - ServiceNowConfiguration configuration = null; - - // check if a configuration has been supplied to the parameters map - for (Object value : parameters.values()) { - if (value instanceof ServiceNowConfiguration) { - configuration = ServiceNowConfiguration.class.cast(value); - break; - } - } - - // if no configuration is provided - if (ObjectHelper.isEmpty(configuration)) { - if (ObjectHelper.isNotEmpty(getComponent())) { - configuration = getComponent(ServiceNowComponent.class).getConfiguration().copy(); - } else { - configuration = new ServiceNowConfiguration(); - } - - // bind parameters to ServiceNow Configuration only if configuration - // does not come from the parameters map as in that case we expect - // it to be pre-configured. - setProperties(configuration, parameters); - } - - return configuration; - } -} diff --git a/components/camel-servicenow/camel-servicenow-component/src/test/java/org/apache/camel/component/servicenow/ServiceNowComponentVerifierExtensionIT.java b/components/camel-servicenow/camel-servicenow-component/src/test/java/org/apache/camel/component/servicenow/ServiceNowComponentVerifierExtensionIT.java deleted file mode 100644 index 04093b6413c..00000000000 --- a/components/camel-servicenow/camel-servicenow-component/src/test/java/org/apache/camel/component/servicenow/ServiceNowComponentVerifierExtensionIT.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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.camel.component.servicenow; - -import java.util.Map; - -import jakarta.ws.rs.ProcessingException; - -import org.apache.camel.Component; -import org.apache.camel.component.extension.ComponentVerifierExtension; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -@EnabledIfEnvironmentVariable(named = "SERVICENOW_INSTANCE", matches = ".*", - disabledReason = "Service now instance was not provided") -public class ServiceNowComponentVerifierExtensionIT extends ServiceNowITSupport { - public ServiceNowComponentVerifierExtensionIT() { - super(false); - } - - @Override - public boolean isUseRouteBuilder() { - return false; - } - - protected ComponentVerifierExtension getExtension() { - Component component = context().getComponent("servicenow"); - ComponentVerifierExtension verifier - = component.getExtension(ComponentVerifierExtension.class).orElseThrow(IllegalStateException::new); - - return verifier; - } - - // ********************************* - // Parameters validation - // ********************************* - - @Test - public void testParameter() { - Map<String, Object> parameters = getParameters(); - ComponentVerifierExtension.Result result - = getExtension().verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus()); - } - - @Test - public void testMissingMandatoryParameter() { - Map<String, Object> parameters = getParameters(); - parameters.remove("instanceName"); - ComponentVerifierExtension.Result result - = getExtension().verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus()); - assertEquals(1, result.getErrors().size()); - assertEquals(ComponentVerifierExtension.VerificationError.StandardCode.MISSING_PARAMETER, - result.getErrors().get(0).getCode()); - assertEquals("instanceName", result.getErrors().get(0).getParameterKeys().iterator().next()); - } - - @Test - public void testMissingMandatoryAuthenticationParameter() { - Map<String, Object> parameters = getParameters(); - parameters.remove("userName"); - ComponentVerifierExtension.Result result - = getExtension().verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus()); - assertEquals(1, result.getErrors().size()); - assertEquals(ComponentVerifierExtension.VerificationError.StandardCode.MISSING_PARAMETER, - result.getErrors().get(0).getCode()); - assertEquals("userName", result.getErrors().get(0).getParameterKeys().iterator().next()); - } - - // ********************************* - // Connectivity validation - // ********************************* - - @Test - public void testConnectivity() { - Map<String, Object> parameters = getParameters(); - ComponentVerifierExtension.Result result - = getExtension().verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus()); - } - - @Test - public void testConnectivityOnCustomTable() { - Map<String, Object> parameters = getParameters(); - parameters.put("table", "ticket"); - - ComponentVerifierExtension.Result result - = getExtension().verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus()); - } - - @Test - public void testConnectivityWithWrongInstance() { - Map<String, Object> parameters = getParameters(); - parameters.put("instanceName", "unknown-instance"); - - ComponentVerifierExtension.Result result - = getExtension().verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus()); - assertEquals(1, result.getErrors().size()); - assertEquals(ComponentVerifierExtension.VerificationError.StandardCode.EXCEPTION, result.getErrors().get(0).getCode()); - assertNotNull(result.getErrors().get(0).getDetails() - .get(ComponentVerifierExtension.VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE)); - assertTrue(result.getErrors().get(0).getDetails().get( - ComponentVerifierExtension.VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE) instanceof ProcessingException); - } - - @Test - public void testConnectivityWithWrongTable() { - Map<String, Object> parameters = getParameters(); - parameters.put("table", "unknown"); - - ComponentVerifierExtension.Result result - = getExtension().verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus()); - assertEquals(1, result.getErrors().size()); - assertEquals(ComponentVerifierExtension.VerificationError.StandardCode.EXCEPTION, result.getErrors().get(0).getCode()); - assertNotNull(result.getErrors().get(0).getDetails() - .get(ComponentVerifierExtension.VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE)); - assertEquals(400, result.getErrors().get(0).getDetails() - .get(ComponentVerifierExtension.VerificationError.HttpAttribute.HTTP_CODE)); - assertTrue(result.getErrors().get(0).getDetails().get( - ComponentVerifierExtension.VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE) instanceof ServiceNowException); - } - - @Test - public void testConnectivityWithWrongAuthentication() { - Map<String, Object> parameters = getParameters(); - parameters.put("userName", "unknown-user"); - parameters.remove("oauthClientId"); - parameters.remove("oauthClientSecret"); - - ComponentVerifierExtension.Result result - = getExtension().verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus()); - assertEquals(1, result.getErrors().size()); - assertEquals(ComponentVerifierExtension.VerificationError.StandardCode.AUTHENTICATION, - result.getErrors().get(0).getCode()); - assertNotNull(result.getErrors().get(0).getDetails() - .get(ComponentVerifierExtension.VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE)); - assertEquals(401, result.getErrors().get(0).getDetails() - .get(ComponentVerifierExtension.VerificationError.HttpAttribute.HTTP_CODE)); - assertTrue(result.getErrors().get(0).getDetails().get( - ComponentVerifierExtension.VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE) instanceof ServiceNowException); - assertTrue(result.getErrors().get(0).getParameterKeys().contains("userName")); - assertTrue(result.getErrors().get(0).getParameterKeys().contains("password")); - assertTrue(result.getErrors().get(0).getParameterKeys().contains("oauthClientId")); - assertTrue(result.getErrors().get(0).getParameterKeys().contains("oauthClientSecret")); - } -} diff --git a/components/camel-servicenow/camel-servicenow-component/src/test/java/org/apache/camel/component/servicenow/ServiceNowComponentVerifierIT.java b/components/camel-servicenow/camel-servicenow-component/src/test/java/org/apache/camel/component/servicenow/ServiceNowComponentVerifierIT.java deleted file mode 100644 index a3c9a3129d6..00000000000 --- a/components/camel-servicenow/camel-servicenow-component/src/test/java/org/apache/camel/component/servicenow/ServiceNowComponentVerifierIT.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * 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.camel.component.servicenow; - -import java.util.Map; - -import jakarta.ws.rs.ProcessingException; - -import org.apache.camel.component.extension.ComponentVerifierExtension; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.EnabledIfEnvironmentVariable; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -@EnabledIfEnvironmentVariable(named = "SERVICENOW_INSTANCE", matches = ".*", - disabledReason = "Service now instance was not provided") -public class ServiceNowComponentVerifierIT extends ServiceNowITSupport { - public ServiceNowComponentVerifierIT() { - super(false); - } - - @Override - public boolean isUseRouteBuilder() { - return false; - } - - protected ComponentVerifierExtension getVerifier() { - return context().getComponent("servicenow", ServiceNowComponent.class).getVerifier(); - } - - // ********************************* - // Parameters validation - // ********************************* - - @Test - public void testParameter() { - Map<String, Object> parameters = getParameters(); - ComponentVerifierExtension.Result result - = getVerifier().verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus()); - } - - @Test - public void testMissingMandatoryParameter() { - Map<String, Object> parameters = getParameters(); - parameters.remove("instanceName"); - ComponentVerifierExtension.Result result - = getVerifier().verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus()); - assertEquals(1, result.getErrors().size()); - assertEquals(ComponentVerifierExtension.VerificationError.StandardCode.MISSING_PARAMETER, - result.getErrors().get(0).getCode()); - assertEquals("instanceName", result.getErrors().get(0).getParameterKeys().iterator().next()); - } - - @Test - public void testMissingMandatoryAuthenticationParameter() { - Map<String, Object> parameters = getParameters(); - parameters.remove("userName"); - ComponentVerifierExtension.Result result - = getVerifier().verify(ComponentVerifierExtension.Scope.PARAMETERS, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus()); - assertEquals(1, result.getErrors().size()); - assertEquals(ComponentVerifierExtension.VerificationError.StandardCode.MISSING_PARAMETER, - result.getErrors().get(0).getCode()); - assertEquals("userName", result.getErrors().get(0).getParameterKeys().iterator().next()); - } - - // ********************************* - // Connectivity validation - // ********************************* - - @Test - public void testConnectivity() { - Map<String, Object> parameters = getParameters(); - ComponentVerifierExtension.Result result - = getVerifier().verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus()); - } - - @Test - public void testConnectivityOnCustomTable() { - Map<String, Object> parameters = getParameters(); - parameters.put("table", "ticket"); - - ComponentVerifierExtension.Result result - = getVerifier().verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.OK, result.getStatus()); - } - - @Test - public void testConnectivityWithWrongInstance() { - Map<String, Object> parameters = getParameters(); - parameters.put("instanceName", "unknown-instance"); - - ComponentVerifierExtension.Result result - = getVerifier().verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus()); - assertEquals(1, result.getErrors().size()); - assertEquals(ComponentVerifierExtension.VerificationError.StandardCode.EXCEPTION, result.getErrors().get(0).getCode()); - assertNotNull(result.getErrors().get(0).getDetails() - .get(ComponentVerifierExtension.VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE)); - assertTrue(result.getErrors().get(0).getDetails().get( - ComponentVerifierExtension.VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE) instanceof ProcessingException); - } - - @Test - public void testConnectivityWithWrongTable() { - Map<String, Object> parameters = getParameters(); - parameters.put("table", "unknown"); - - ComponentVerifierExtension.Result result - = getVerifier().verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus()); - assertEquals(1, result.getErrors().size()); - assertEquals(ComponentVerifierExtension.VerificationError.StandardCode.EXCEPTION, result.getErrors().get(0).getCode()); - assertNotNull(result.getErrors().get(0).getDetails() - .get(ComponentVerifierExtension.VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE)); - assertEquals(400, result.getErrors().get(0).getDetails() - .get(ComponentVerifierExtension.VerificationError.HttpAttribute.HTTP_CODE)); - assertTrue(result.getErrors().get(0).getDetails().get( - ComponentVerifierExtension.VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE) instanceof ServiceNowException); - } - - @Test - public void testConnectivityWithWrongAuthentication() { - Map<String, Object> parameters = getParameters(); - parameters.put("userName", "unknown-user"); - parameters.remove("oauthClientId"); - parameters.remove("oauthClientSecret"); - - ComponentVerifierExtension.Result result - = getVerifier().verify(ComponentVerifierExtension.Scope.CONNECTIVITY, parameters); - - assertEquals(ComponentVerifierExtension.Result.Status.ERROR, result.getStatus()); - assertEquals(1, result.getErrors().size()); - assertEquals(ComponentVerifierExtension.VerificationError.StandardCode.AUTHENTICATION, - result.getErrors().get(0).getCode()); - assertNotNull(result.getErrors().get(0).getDetails() - .get(ComponentVerifierExtension.VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE)); - assertEquals(401, result.getErrors().get(0).getDetails() - .get(ComponentVerifierExtension.VerificationError.HttpAttribute.HTTP_CODE)); - assertTrue(result.getErrors().get(0).getDetails().get( - ComponentVerifierExtension.VerificationError.ExceptionAttribute.EXCEPTION_INSTANCE) instanceof ServiceNowException); - assertTrue(result.getErrors().get(0).getParameterKeys().contains("userName")); - assertTrue(result.getErrors().get(0).getParameterKeys().contains("password")); - assertTrue(result.getErrors().get(0).getParameterKeys().contains("oauthClientId")); - assertTrue(result.getErrors().get(0).getParameterKeys().contains("oauthClientSecret")); - } -}
