org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException Java Examples
The following examples show how to use
org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MBPlatformBaseTest.java From product-ei with Apache License 2.0 | 6 votes |
/** * Create and login topic admin client to nodes in cluster * Suppressing "UnusedDeclaration" warning as this method can be used later in writing test * cases. * * @throws LoginAuthenticationExceptionException * @throws IOException * @throws XPathExpressionException * @throws URISyntaxException * @throws SAXException * @throws XMLStreamException */ @SuppressWarnings("UnusedDeclaration") protected void initTopicAdminClients() throws LoginAuthenticationExceptionException, IOException, XPathExpressionException, URISyntaxException, SAXException, XMLStreamException, AutomationUtilException { topicAdminClients = new HashMap<String, TopicAdminClient>(); if (contextMap != null && contextMap.size() > 0) { for (Map.Entry<String, AutomationContext> entry : contextMap.entrySet()) { AutomationContext tempContext = entry.getValue(); topicAdminClients.put(entry.getKey(), new TopicAdminClient(tempContext.getContextUrls().getBackEndUrl(), login(tempContext))); } } }
Example #2
Source File: ESBPOXSecurityByInvalidUserTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
@Test(groups = { "wso2.esb" }, description = "GET resource after delete by invalid user", dependsOnMethods = "testDeleteStudent") public void testGetResourceAfterDelete() throws IOException, EndpointAdminEndpointAdminException, LoginAuthenticationExceptionException, XMLStreamException { //check whether the student is deleted String studentGetUri = (getProxyServiceURLHttps(SERVICE_NAME)) + "/student/" + studentName; boolean getStatus = false; HttpsResponse getResponse = null; try { getResponse = HttpsURLConnectionClient .getWithBasicAuth(studentGetUri, null, userInfo.getPassword(), userInfo.getPassword()); } catch (IOException ignored) { getStatus = true; // invalid users cannot get the resource } assertTrue(getStatus, "User belongs to invalid group was able to get the resource"); assertNull(getResponse, "Response should be null"); }
Example #3
Source File: AMQPSessionRecoverTestCase.java From product-ei with Apache License 2.0 | 6 votes |
/** * Set values TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS = 3 and * ANDES_ACK_WAIT_TIMEOUT_PROPERTY = 10000 * so that once a message is seen by application for 3 times it goes to DLC * and ack timeout is out of the equation */ @BeforeClass public void setupConfiguration() throws XPathExpressionException, IOException, ConfigurationException, SAXException, XMLStreamException, LoginAuthenticationExceptionException, URISyntaxException, AutomationUtilException { super.serverManager = new ServerConfigurationManager(automationContext); String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2" + File.separator + "broker" + File.separator + "conf" + File.separator + "broker.xml"; ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath); configurationEditor.updateProperty(AndesConfiguration .TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS, "3"); System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, "10000"); //We should restart the server with the new configuration values configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager); }
Example #4
Source File: ServiceDeploymentUtil.java From product-ei with Apache License 2.0 | 6 votes |
public static void deployArrService(String backEndUrl, String sessionCookie, String serviceName, String serviceFilePath, int deploymentDelay) throws RemoteException, MalformedURLException, LoginAuthenticationExceptionException, org.wso2.carbon.aarservices.stub.ExceptionException { AARServiceUploaderClient adminServiceAARServiceUploader = new AARServiceUploaderClient(backEndUrl, sessionCookie); ServiceAdminClient adminServiceService = new ServiceAdminClient(backEndUrl, sessionCookie); if (adminServiceService.isServiceExists(serviceName)) { adminServiceService.deleteService(new String[]{serviceName}); isServiceUnDeployed(backEndUrl, sessionCookie, serviceName, deploymentDelay); } adminServiceAARServiceUploader.uploadAARFile(serviceName + ".aar", serviceFilePath, ""); Assert.assertTrue(isServiceDeployed(backEndUrl, sessionCookie, serviceName, deploymentDelay) , serviceName + " deployment failed in Application Server"); }
Example #5
Source File: DLCMessageExpiryTestCase.java From product-ei with Apache License 2.0 | 6 votes |
/** * Set topicMessageDeliveryStrategy to DISCARD_ALLOWED so that broker will simulate an acknowledgement * if some subscribers are slow to acknowledge the message * * @throws XPathExpressionException * @throws IOException * @throws ConfigurationException * @throws SAXException * @throws XMLStreamException * @throws LoginAuthenticationExceptionException * @throws URISyntaxException * @throws AutomationUtilException */ @BeforeClass public void setupConfiguration() throws XPathExpressionException, IOException, ConfigurationException, SAXException, XMLStreamException, LoginAuthenticationExceptionException, URISyntaxException, AutomationUtilException { super.serverManager = new ServerConfigurationManager(automationContext); String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2" + File.separator + "broker" + File.separator + "conf" + File.separator + "broker.xml"; ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath); configurationEditor.updateProperty(AndesConfiguration.PERFORMANCE_TUNING_PRE_DELIVERY_EXPIRY_DELETION_INTERVAL, "60"); configurationEditor.updateProperty(AndesConfiguration .PERFORMANCE_TUNING_PERIODIC_EXPIRY_MESSAGE_DELETION_INTERVAL, "60"); configurationEditor.updateProperty(AndesConfiguration.TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS, "1"); configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager); // Get current "AndesAckWaitTimeOut" system property. defaultAndesAckWaitTimeOut = System.getProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY); // Setting system property "AndesAckWaitTimeOut" for andes System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, "3000"); }
Example #6
Source File: DurableTopicSubscriptionOnlyTestCase.java From product-ei with Apache License 2.0 | 6 votes |
/** * Prepare environment for tests. * * @throws XPathExpressionException * @throws LoginAuthenticationExceptionException * @throws IOException * @throws XMLStreamException * @throws URISyntaxException * @throws SAXException * @throws AutomationUtilException */ @BeforeClass(alwaysRun = true) public void init() throws XPathExpressionException, LoginAuthenticationExceptionException, IOException, XMLStreamException, URISyntaxException, SAXException, AutomationUtilException { super.initCluster(TestUserMode.SUPER_TENANT_ADMIN); AutomationContext automationContext1 = getAutomationContextWithKey("mb002"); AutomationContext automationContext2 = getAutomationContextWithKey("mb003"); hostNode1 = automationContext1.getInstance().getHosts().get("default"); hostNode2 = automationContext2.getInstance().getHosts().get("default"); portInNode1 = Integer.parseInt(automationContext1.getInstance().getPorts().get("amqp")); portInNode2 = Integer.parseInt(automationContext2.getInstance().getPorts().get("amqp")); topicAdminClient = new TopicAdminClient(automationContext1.getContextUrls().getBackEndUrl(), super.login(automationContext1)); super.initAndesAdminClients(); }
Example #7
Source File: ESBPOXSecurityByInvalidUserTestCase.java From product-ei with Apache License 2.0 | 6 votes |
@Test(groups = {"wso2.esb"}, description = "GET resource after delete by invalid user", dependsOnMethods = "testDeleteStudent") public void testGetResourceAfterDelete() throws IOException, EndpointAdminEndpointAdminException, LoginAuthenticationExceptionException, XMLStreamException { //check whether the student is deleted String studentGetUri = (getProxyServiceURLHttps(SERVICE_NAME)) + "/student/" + studentName; boolean getStatus = false; HttpsResponse getResponse = null; try { getResponse = HttpsURLConnectionClient.getWithBasicAuth(studentGetUri, null, userInfo.getPassword(), userInfo.getPassword()); } catch (IOException ignored) { getStatus = true; // invalid users cannot get the resource } assertTrue(getStatus, "User belongs to invalid group was able to get the resource"); assertNull(getResponse, "Response should be null"); }
Example #8
Source File: ServiceDeploymentUtil.java From micro-integrator with Apache License 2.0 | 6 votes |
public static void deployArrService(String backEndUrl, String sessionCookie, String serviceName, String serviceFilePath, int deploymentDelay) throws RemoteException, MalformedURLException, LoginAuthenticationExceptionException, org.wso2.carbon.aarservices.stub.ExceptionException { AARServiceUploaderClient adminServiceAARServiceUploader = new AARServiceUploaderClient(backEndUrl, sessionCookie); ServiceAdminClient adminServiceService = new ServiceAdminClient(backEndUrl, sessionCookie); if (adminServiceService.isServiceExists(serviceName)) { adminServiceService.deleteService(new String[] { serviceName }); isServiceUnDeployed(backEndUrl, sessionCookie, serviceName, deploymentDelay); } adminServiceAARServiceUploader.uploadAARFile(serviceName + ".aar", serviceFilePath, ""); Assert.assertTrue(isServiceDeployed(backEndUrl, sessionCookie, serviceName, deploymentDelay), serviceName + " deployment failed in Application Server"); }
Example #9
Source File: ESBPOXSecurityByUserTestCase.java From product-ei with Apache License 2.0 | 6 votes |
@Test(groups = {"wso2.esb"}, description = "DELETE request by valid user", dependsOnMethods = "testUpdateStudent") public void testDeleteStudent() throws IOException, EndpointAdminEndpointAdminException, LoginAuthenticationExceptionException, XMLStreamException { String deleteStudentData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<p:deleteStudent xmlns:p=\"http://axis2.apache.org\">\n" + " <!--0 to 1 occurrence-->\n" + " <xs:name xmlns:xs=\"http://axis2.apache.org\">" + studentName + "</xs:name>\n" + "</p:deleteStudent>"; String securedRestURL = (getProxyServiceURLHttps(SERVICE_NAME)) + "/student/" + studentName; HttpsResponse response = HttpsURLConnectionClient.deleteWithBasicAuth(securedRestURL, null, userInfo.getUserName(), userInfo.getPassword()); assertTrue(!response.getData().contains(studentName) , "response doesn't contain the expected output"); }
Example #10
Source File: SlowestSubscriptionRateMsgDeliveryStrategyTestCase.java From product-ei with Apache License 2.0 | 6 votes |
/** * Set topicMessageDeliveryStrategy to SLOWEST_SUB_RATE_TOPIC so that broker will deliver the messages * * @throws XPathExpressionException * @throws java.io.IOException * @throws org.apache.commons.configuration.ConfigurationException * @throws org.xml.sax.SAXException * @throws javax.xml.stream.XMLStreamException * @throws org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException * @throws java.net.URISyntaxException * @throws org.wso2.carbon.integration.common.utils.exceptions.AutomationUtilException */ @BeforeClass public void setupConfiguration() throws XPathExpressionException, IOException, ConfigurationException, SAXException, XMLStreamException, LoginAuthenticationExceptionException, URISyntaxException, AutomationUtilException { super.serverManager = new ServerConfigurationManager(automationContext); String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2" + File.separator + "broker" + File.separator + "conf" + File.separator + "broker.xml"; ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath); configurationEditor.updateProperty(AndesConfiguration .PERFORMANCE_TUNING_TOPIC_MESSAGE_DELIVERY_STRATEGY, "SLOWEST_SUB_RATE"); //reduce this to 200 from default value (1000) so that delivery strategy is effective fast configurationEditor.updateProperty(AndesConfiguration.PERFORMANCE_TUNING_ACK_HANDLING_MAX_UNACKED_MESSAGES, "2"); configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager); }
Example #11
Source File: QueueUserAuthorizationTestCase.java From product-ei with Apache License 2.0 | 6 votes |
/** * Assigning consuming publishing permissions of a queue to a role. * * @param queueName The queue name * @param permissions New permissions for the role. can be publish, consume. * @throws XPathExpressionException * @throws IOException * @throws URISyntaxException * @throws SAXException * @throws XMLStreamException * @throws LoginAuthenticationExceptionException * @throws AndesAdminServiceBrokerManagerAdminException * @throws LogoutAuthenticationExceptionException * @throws UserAdminUserAdminException */ public void updateQueueRoleConsumePublishPermission(String queueName, QueueRolePermission permissions) throws XPathExpressionException, IOException, URISyntaxException, SAXException, XMLStreamException, LoginAuthenticationExceptionException, AndesAdminServiceBrokerManagerAdminException, LogoutAuthenticationExceptionException, UserAdminUserAdminException, AutomationUtilException { LoginLogoutClient loginLogoutClientForAdmin = new LoginLogoutClient(super.automationContext); String sessionCookie = loginLogoutClientForAdmin.login(); AndesAdminClient andesAdminClient = new AndesAdminClient(super.backendURL, sessionCookie); andesAdminClient.updatePermissionForQueue(queueName, permissions); loginLogoutClientForAdmin.logout(); }
Example #12
Source File: QueueUserAuthorizationTestCase.java From product-ei with Apache License 2.0 | 6 votes |
/** * User1 and User2 exists in the same role where create queue permission is assigned. * User1 creates a queue and then publishes and consumes messages. * Admin assigns publishing and consuming permissions to the role in which User1 and User2 are * in. * User1 is removed from the role. * User2 tries to publish and consume messages. User2 succeeds. * * @throws IOException * @throws LoginAuthenticationExceptionException * @throws URISyntaxException * @throws LogoutAuthenticationExceptionException * @throws XMLStreamException * @throws AndesAdminServiceBrokerManagerAdminException * @throws SAXException * @throws XPathExpressionException * @throws UserAdminUserAdminException * @throws JMSException * @throws AndesClientConfigurationException * @throws AndesClientException * @throws NamingException */ @Test(groups = {"wso2.mb", "queue"}) public void performQueuePermissionSameRoleAssignedPermissions() throws IOException, LoginAuthenticationExceptionException, URISyntaxException, LogoutAuthenticationExceptionException, XMLStreamException, AndesAdminServiceBrokerManagerAdminException, SAXException, XPathExpressionException, UserAdminUserAdminException, JMSException, AndesClientConfigurationException, AndesClientException, NamingException, AutomationUtilException { this.createPublishAndSubscribeFromUser("authUser1", "authQueue6"); // Adding publish subscribe permissions of 'authQueue6' to 'create_pub_sub_queue_role' role. QueueRolePermission queueRolePermission = new QueueRolePermission(); queueRolePermission.setRoleName(CREATE_PUB_SUB_QUEUE_ROLE); queueRolePermission.setAllowedToConsume(true); queueRolePermission.setAllowedToPublish(true); this.updateQueueRoleConsumePublishPermission("authQueue6", queueRolePermission); log.info("Consumer and publish permissions updated for " + CREATE_PUB_SUB_QUEUE_ROLE); // Removing authUser1 from create_pub_sub_queue_role and Internal/Q_authQueue6 userManagementClient .addRemoveRolesOfUser("authUser1", new String[]{NO_PERMISSION_QUEUE_ROLE}, new String[]{CREATE_PUB_SUB_QUEUE_ROLE, "Internal/Q_authqueue6"}); log.info("Removing authUser1 from " + CREATE_PUB_SUB_QUEUE_ROLE + " and Internal/Q_authqueue6"); this.createPublishAndSubscribeFromUser("authUser2", "authQueue6"); }
Example #13
Source File: LoadBalanceEndpointTestCase.java From product-ei with Apache License 2.0 | 6 votes |
@SetEnvironment(executionEnvironments = {ExecutionEnvironment.STANDALONE}) @Test(groups = {"wso2.esb"}, description = "Sending a Message to a loadbalancing endpoint in Config Reg") public void testSendingToLoaBalancingEndpoint_ConfigReg() throws IOException, EndpointAdminEndpointAdminException, LoginAuthenticationExceptionException, XMLStreamException { String response = lbClient.sendLoadBalanceRequest(getProxyServiceURLHttp("loadbalancingEndPoint_Config_Reg"), null); Assert.assertNotNull(response); Assert.assertTrue(response.toString().contains("Response from server: Server_1")); response = lbClient.sendLoadBalanceRequest(getProxyServiceURLHttp("loadbalancingEndPoint_Config_Reg"), null); Assert.assertNotNull(response); Assert.assertTrue(response.toString().contains("Response from server: Server_2")); response = lbClient.sendLoadBalanceRequest(getProxyServiceURLHttp("loadbalancingEndPoint_Config_Reg"), null); Assert.assertNotNull(response); Assert.assertTrue(response.toString().contains("Response from server: Server_3")); }
Example #14
Source File: SubTopicUserAuthorizationTestCase.java From product-ei with Apache License 2.0 | 6 votes |
/** * Deleting the topics that were created. * * @throws XPathExpressionException * @throws LoginAuthenticationExceptionException * @throws IOException * @throws XMLStreamException * @throws URISyntaxException * @throws SAXException * @throws AndesEventAdminServiceEventAdminException * @throws LogoutAuthenticationExceptionException */ @AfterClass() public void cleanUpTopics() throws XPathExpressionException, LoginAuthenticationExceptionException, IOException, XMLStreamException, URISyntaxException, SAXException, AndesEventAdminServiceEventAdminException, LogoutAuthenticationExceptionException, AutomationUtilException { LoginLogoutClient loginLogoutClientForUser = new LoginLogoutClient(this.automationContext); String sessionCookie = loginLogoutClientForUser.login(); TopicAdminClient topicAdminClient = new TopicAdminClient(this.backendURL, sessionCookie); topicAdminClient.removeTopic("authTopic1"); topicAdminClient.removeTopic("authTopic2"); topicAdminClient.removeTopic("authTopic3"); loginLogoutClientForUser.logout(); }
Example #15
Source File: ESBPOXSecurityWithInvalidGroupTestCase.java From micro-integrator with Apache License 2.0 | 6 votes |
@Test(groups = { "wso2.esb" }, description = "GET resource after delete by user belongs to unauthorized group", dependsOnMethods = "testDeleteStudent") public void testGetResourceAfterDelete() throws IOException, EndpointAdminEndpointAdminException, LoginAuthenticationExceptionException, XMLStreamException { //check whether the student is deleted String studentGetUri = getProxyServiceURLHttps(SERVICE_NAME) + "/student/" + studentName; boolean getStatus = false; HttpsResponse getResponse = null; try { getResponse = HttpsURLConnectionClient .getWithBasicAuth(studentGetUri, null, NonAdminUserCreationTestCase.getUser().getPassword(), NonAdminUserCreationTestCase.getUser().getPassword()); } catch (IOException ignored) { getStatus = true; // invalid users cannot get the resource } assertTrue(getStatus, "User belongs to invalid group was able to get the resource"); assertNull(getResponse, "Response should be null"); }
Example #16
Source File: Axis2ServerStartupWithSecuredServices.java From product-ei with Apache License 2.0 | 6 votes |
@AfterTest(alwaysRun = true) public void unDeployServices() throws IOException, LoginAuthenticationExceptionException, ExceptionException, XPathExpressionException, URISyntaxException, SAXException, XMLStreamException, AutomationUtilException { if (TestConfigurationProvider.isIntegration() && axis2Server1 != null && axis2Server1.isStarted()) { axis2Server1.stop(); } else { AutomationContext asContext = new AutomationContext("AS", TestUserMode.SUPER_TENANT_ADMIN); int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay(); String serviceName = "SecureStockQuoteServiceScenario"; ServiceDeploymentUtil deployer = new ServiceDeploymentUtil(); LoginLogoutClient loginLogoutClient = new LoginLogoutClient(asContext); for (int i = 1; i < 9; i++) { deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), loginLogoutClient.login() , serviceName + i, deploymentDelay); } } }
Example #17
Source File: Axis2ServerStartupWithSecuredServices.java From micro-integrator with Apache License 2.0 | 6 votes |
@AfterTest(alwaysRun = true) public void unDeployServices() throws IOException, LoginAuthenticationExceptionException, ExceptionException, XPathExpressionException, URISyntaxException, SAXException, XMLStreamException, AutomationUtilException { if (TestConfigurationProvider.isIntegration() && axis2Server1 != null && axis2Server1.isStarted()) { axis2Server1.stop(); } else { AutomationContext asContext = new AutomationContext("AS", TestUserMode.SUPER_TENANT_ADMIN); int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay(); String serviceName = "SecureStockQuoteServiceScenario"; ServiceDeploymentUtil deployer = new ServiceDeploymentUtil(); LoginLogoutClient loginLogoutClient = new LoginLogoutClient(asContext); for (int i = 1; i < 9; i++) { deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), loginLogoutClient.login(), serviceName + i, deploymentDelay); } } }
Example #18
Source File: TopicUserAuthorizationTestCase.java From product-ei with Apache License 2.0 | 6 votes |
/** * User1 and User2 exists in the same role where create topic permission is assigned. * Admin(UI) creates a topic and then publishes and consumes messages. * Add publish and consume permissions to the role in which User1 and User2 exists. * User1 and User2 tries to publish and consume messages. User2 succeeds. * * @throws AndesClientConfigurationException * @throws NamingException * @throws IOException * @throws XPathExpressionException * @throws AndesClientException * @throws JMSException * @throws UserAdminUserAdminException * @throws LoginAuthenticationExceptionException * @throws AndesEventAdminServiceEventAdminException * @throws XMLStreamException * @throws LogoutAuthenticationExceptionException * @throws URISyntaxException * @throws SAXException * @throws AndesAdminServiceBrokerManagerAdminException */ @Test(groups = {"wso2.mb", "topic"}) public void performTopicPermissionSameRoleUsersWithAdminCreated() throws AndesClientConfigurationException, NamingException, IOException, XPathExpressionException, AndesClientException, JMSException, UserAdminUserAdminException, LoginAuthenticationExceptionException, AndesEventAdminServiceEventAdminException, XMLStreamException, LogoutAuthenticationExceptionException, URISyntaxException, SAXException, AndesAdminServiceBrokerManagerAdminException, AutomationUtilException { // "superAdmin" refers to the admin this.createPublishAndSubscribeFromUser("superAdmin", "authTopic8"); // Adding publish subscribe permissions of 'authTopic8' to 'create_pub_sub_topic_role' role. TopicRolePermission topicRolePermission = new TopicRolePermission(); topicRolePermission.setRoleName(CREATE_PUB_SUB_TOPIC_ROLE); topicRolePermission.setAllowedToSubscribe(true); topicRolePermission.setAllowedToPublish(true); this.updateTopicRoleConsumePublishPermission("authTopic8", topicRolePermission); log.info("Consumer and publish permissions updated for " + CREATE_PUB_SUB_TOPIC_ROLE); this.createPublishAndSubscribeFromUser("authUser1", "authTopic8"); this.createPublishAndSubscribeFromUser("authUser2", "authTopic8"); }
Example #19
Source File: DiscardAllowedMsgDeliveryStrategyTestCase.java From product-ei with Apache License 2.0 | 6 votes |
/** * Set topicMessageDeliveryStrategy to DISCARD_ALLOWED so that broker will simulate an acknowledgement * if some subscribers are slow to acknowledge the message * * @throws XPathExpressionException * @throws IOException * @throws ConfigurationException * @throws SAXException * @throws XMLStreamException * @throws LoginAuthenticationExceptionException * @throws URISyntaxException * @throws AutomationUtilException */ @BeforeClass public void setupConfiguration() throws XPathExpressionException, IOException, ConfigurationException, SAXException, XMLStreamException, LoginAuthenticationExceptionException, URISyntaxException, AutomationUtilException { super.serverManager = new ServerConfigurationManager(automationContext); String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2" + File.separator + "broker" + File.separator + "conf" + File.separator + "broker.xml"; ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath); configurationEditor.updateProperty(AndesConfiguration .PERFORMANCE_TUNING_TOPIC_MESSAGE_DELIVERY_STRATEGY, "DISCARD_ALLOWED"); configurationEditor.updateProperty(AndesConfiguration.PERFORMANCE_TUNING_ACK_HANDLING_MAX_UNACKED_MESSAGES, "200"); configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager); }
Example #20
Source File: QueueUserAuthorizationTestCase.java From product-ei with Apache License 2.0 | 6 votes |
/** * User3 is in Role2 where there are no create queue permissions. * Admin creates a queue and then publishes and consumes messages. * Admin assigns publishing and consuming permissions to Role2. * User3 tries to publish and consume messages. User3 succeeds. * * @throws IOException * @throws XPathExpressionException * @throws AndesAdminServiceBrokerManagerAdminException * @throws URISyntaxException * @throws SAXException * @throws XMLStreamException * @throws UserAdminUserAdminException * @throws LoginAuthenticationExceptionException * @throws LogoutAuthenticationExceptionException * @throws JMSException * @throws AndesClientConfigurationException * @throws AndesClientException * @throws NamingException */ @Test(groups = {"wso2.mb", "queue"}) public void performQueuePermissionDifferentRolesAssignedPermissions() throws IOException, XPathExpressionException, AndesAdminServiceBrokerManagerAdminException, URISyntaxException, SAXException, XMLStreamException, UserAdminUserAdminException, LoginAuthenticationExceptionException, LogoutAuthenticationExceptionException, JMSException, AndesClientConfigurationException, AndesClientException, NamingException, AutomationUtilException { // "superAdmin" refers to the admin this.createPublishAndSubscribeFromUser("superAdmin", "authQueue7"); // Adding publish subscribe permissions of 'authQueue7' to 'pub_sub_queue_role' role. QueueRolePermission queueRolePermission = new QueueRolePermission(); queueRolePermission.setRoleName(PUB_SUB_QUEUE_ROLE); queueRolePermission.setAllowedToConsume(true); queueRolePermission.setAllowedToPublish(true); this.updateQueueRoleConsumePublishPermission("authQueue7", queueRolePermission); log.info("Consumer and publish permissions updated for " + PUB_SUB_QUEUE_ROLE); this.createPublishAndSubscribeFromUser("authUser3", "authQueue7"); }
Example #21
Source File: PurgeMessagesTestCase.java From product-ei with Apache License 2.0 | 6 votes |
/** * Set values TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS = 1 and * ANDES_ACK_WAIT_TIMEOUT_PROPERTY = 1 * so that the time taken for the massages to get moved into DLC is at a minimum */ @BeforeClass public void setupConfiguration() throws XPathExpressionException, IOException, ConfigurationException, SAXException, XMLStreamException, LoginAuthenticationExceptionException, URISyntaxException, AutomationUtilException { ; super.serverManager = new ServerConfigurationManager(automationContext); String defaultMBConfigurationPath = ServerConfigurationManager.getCarbonHome() + File.separator + "wso2" + File.separator + "broker" + File.separator + "conf" + File.separator + "broker.xml"; ConfigurationEditor configurationEditor = new ConfigurationEditor(defaultMBConfigurationPath); //Set values TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS = 1 and //ANDES_ACK_WAIT_TIMEOUT_PROPERTY = 1 //so that the time taken for the massages to get moved into DLC is at a minimum configurationEditor.updateProperty(AndesConfiguration .TRANSPORTS_AMQP_MAXIMUM_REDELIVERY_ATTEMPTS, "1"); System.setProperty(AndesClientConstants.ANDES_ACK_WAIT_TIMEOUT_PROPERTY, "1"); //andesAdminClient.deleteQueue(DLCQueueUtils.identifyTenantInformationAndGenerateDLCString(TEST_QUEUE_PURGE)); //We should restart the server witht he new configuration values configurationEditor.applyUpdatedConfigurationAndRestartServer(serverManager); }
Example #22
Source File: QueueUserAuthorizationTestCase.java From product-ei with Apache License 2.0 | 6 votes |
/** * User1 is in Role1 where there are create queue permissions. * User3 is in Role2 where there are no create queue permissions. * Admin creates a queue and then publishes and consumes messages. * Admin assigns publishing and consuming permissions to Role2. * User1 tries to publish and consume messages. User1 fails. * * @throws IOException * @throws XPathExpressionException * @throws AndesAdminServiceBrokerManagerAdminException * @throws URISyntaxException * @throws SAXException * @throws XMLStreamException * @throws UserAdminUserAdminException * @throws LoginAuthenticationExceptionException * @throws LogoutAuthenticationExceptionException * @throws JMSException * @throws AndesClientConfigurationException * @throws AndesClientException * @throws NamingException */ @Test(groups = {"wso2.mb", "queue"}, expectedExceptions = JMSException.class, expectedExceptionsMessageRegExp = ".*Permission denied.*") public void performQueuePermissionDifferentRolesNoPermissions() throws IOException, XPathExpressionException, AndesAdminServiceBrokerManagerAdminException, URISyntaxException, SAXException, XMLStreamException, UserAdminUserAdminException, LoginAuthenticationExceptionException, LogoutAuthenticationExceptionException, JMSException, AndesClientConfigurationException, AndesClientException, NamingException, AutomationUtilException { // "superAdmin" refers to the admin this.createPublishAndSubscribeFromUser("superAdmin", "authQueue9"); // Adding publish subscribe permissions of 'authQueue9' to 'pub_sub_queue_role' role. QueueRolePermission queueRolePermission = new QueueRolePermission(); queueRolePermission.setRoleName(PUB_SUB_QUEUE_ROLE); queueRolePermission.setAllowedToConsume(true); queueRolePermission.setAllowedToPublish(true); this.updateQueueRoleConsumePublishPermission("authQueue9", queueRolePermission); log.info("Consumer and publish permissions updated for " + PUB_SUB_QUEUE_ROLE); this.createPublishAndSubscribeFromUser("authUser1", "authQueue9"); }
Example #23
Source File: ESBPOXSecurityByAdminTestCase.java From product-ei with Apache License 2.0 | 5 votes |
@Test(groups = {"wso2.esb"}, description = "GET resource after delete by admin", dependsOnMethods = "testDeleteStudent", expectedExceptions = IOException.class) public void testGetResourceAfterDelete() throws IOException, EndpointAdminEndpointAdminException, LoginAuthenticationExceptionException, XMLStreamException { //check whether the student is deleted String studentGetUri = getProxyServiceURLHttps(SERVICE_NAME) + "/student/" + studentName; HttpsResponse getResponse = HttpsURLConnectionClient.getWithBasicAuth(studentGetUri, null, userInfo.getPassword(), userInfo.getPassword()); assertTrue(getResponse.getData().equals(""), "student was not deleted"); }
Example #24
Source File: SingleSubscriberSinglePublisherTopicTestCase.java From product-ei with Apache License 2.0 | 5 votes |
/** * Prepare environment for tests. * * @throws XPathExpressionException * @throws URISyntaxException * @throws SAXException * @throws XMLStreamException * @throws LoginAuthenticationExceptionException * @throws IOException */ @BeforeClass(alwaysRun = true) public void init() throws XPathExpressionException, URISyntaxException, SAXException, XMLStreamException, LoginAuthenticationExceptionException, IOException, AutomationUtilException { super.initCluster(TestUserMode.SUPER_TENANT_ADMIN); automationContextForMB2 = getAutomationContextWithKey("mb002"); automationContext2 = getAutomationContextWithKey("mb003"); topicAdminClient1 = new TopicAdminClient(automationContextForMB2.getContextUrls().getBackEndUrl(), super.login(automationContextForMB2)); }
Example #25
Source File: ESBPOXSecurityPostRequestTestCase.java From product-ei with Apache License 2.0 | 5 votes |
@Test(groups = {"wso2.esb"}, description = "POST request by super admin") public void testPOSTRequestBySuperAdmin() throws IOException, EndpointAdminEndpointAdminException, LoginAuthenticationExceptionException, XMLStreamException, XPathExpressionException { userInfo = context.getContextTenant().getTenantUserList().get(1); String securedRestURL = getProxyServiceURLHttps("Axis2ServiceProxy") + "/echoString"; HttpsResponse response = HttpsURLConnectionClient.postWithBasicAuth(securedRestURL, "s=TestAutomation", userInfo.getUserName(), userInfo.getPassword()); assertTrue(response.getData().contains("<ns:echoStringResponse xmlns:ns=\"http://service.carbon.wso2.org\">" + "<ns:return>TestAutomation</ns:return></ns:echoStringResponse>") , "response doesn't contain the expected output"); }
Example #26
Source File: ESBJAVA4231EmptyPayloadInFailoverLoadBalanceEndpoint.java From product-ei with Apache License 2.0 | 5 votes |
@Test(groups = "wso2.esb", description = "Test sending request to LoadBalancing Endpoint") public void testSendingToLoaBalancingEndpoint() throws IOException, EndpointAdminEndpointAdminException, LoginAuthenticationExceptionException, XMLStreamException { String response = lbClient.sendLoadBalanceRequest(getProxyServiceURLHttp("loadbalanceproxy"), null); Assert.assertNotNull(response); Assert.assertTrue(response.toString().contains("Response from server: Server_2")); }
Example #27
Source File: DurableTopicMessageDeliveringTestCase.java From product-ei with Apache License 2.0 | 5 votes |
/** * Prepare environment for tests. * * @throws XPathExpressionException * @throws URISyntaxException * @throws SAXException * @throws XMLStreamException * @throws LoginAuthenticationExceptionException * @throws IOException */ @BeforeClass(alwaysRun = true) public void init() throws XPathExpressionException, URISyntaxException, SAXException, XMLStreamException, LoginAuthenticationExceptionException, IOException, AutomationUtilException { super.initCluster(TestUserMode.SUPER_TENANT_ADMIN); automationContext = getAutomationContextWithKey("mb002"); topicAdminClient = new TopicAdminClient(automationContext.getContextUrls().getBackEndUrl(), super.login(automationContext)); }
Example #28
Source File: MetricsTestCase.java From product-ei with Apache License 2.0 | 5 votes |
/** * Initializing test case * * @throws XPathExpressionException */ @BeforeClass(alwaysRun = true) public void init() throws XPathExpressionException, MalformedURLException, AutomationUtilException, MetricsConfigException, MetricsLevelConfigException, RemoteException, LoginAuthenticationExceptionException { super.init(TestUserMode.SUPER_TENANT_USER); LoginLogoutClient loginLogoutClientForAdmin = new LoginLogoutClient(super.automationContext); sessionCookie = loginLogoutClientForAdmin.login(); }
Example #29
Source File: MultipleTopicTestCase.java From product-ei with Apache License 2.0 | 5 votes |
/** * Prepare environment for tests. * * @throws LoginAuthenticationExceptionException * @throws IOException * @throws XPathExpressionException * @throws URISyntaxException * @throws SAXException * @throws XMLStreamException */ @BeforeClass(alwaysRun = true) public void init() throws LoginAuthenticationExceptionException, IOException, XPathExpressionException, URISyntaxException, SAXException, XMLStreamException, AutomationUtilException { super.initCluster(TestUserMode.SUPER_TENANT_ADMIN); automationContext = getAutomationContextWithKey("mb002"); topicAdminClient = new TopicAdminClient(automationContext.getContextUrls().getBackEndUrl(), super.login(automationContext)); }
Example #30
Source File: ESBPOXSecurityByAdminTestCase.java From product-ei with Apache License 2.0 | 5 votes |
@Test(groups = {"wso2.esb"}, description = "DELETE request by super admin", dependsOnMethods = "testUpdateStudent") public void testDeleteStudent() throws IOException, EndpointAdminEndpointAdminException, LoginAuthenticationExceptionException, XMLStreamException { String securedRestURL = getProxyServiceURLHttps(SERVICE_NAME)+ "/student/" + studentName; HttpsResponse response = HttpsURLConnectionClient.deleteWithBasicAuth(securedRestURL, null, userInfo.getPassword(), userInfo.getPassword()); assertTrue(!response.getData().contains(studentName) , "response doesn't contain the expected output"); }