From 04dcd09976ecc5aa2948993b9a9a2d90d239ee44 Mon Sep 17 00:00:00 2001 From: antelder Date: Thu, 28 Jul 2011 10:58:07 +0000 Subject: Delete old beta3 branch as its going to be recreated from the current trunk git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1151789 13f79535-47bb-0310-9956-ffa450edef68 --- .../tuscany/sca/host/corba/UtilsTestCase.java | 145 --------------------- 1 file changed, 145 deletions(-) delete mode 100644 sca-java-2.x/branches/2.0-Beta3/modules/host-corba/src/test/java/org/apache/tuscany/sca/host/corba/UtilsTestCase.java (limited to 'sca-java-2.x/branches/2.0-Beta3/modules/host-corba/src/test/java/org/apache/tuscany/sca/host/corba/UtilsTestCase.java') diff --git a/sca-java-2.x/branches/2.0-Beta3/modules/host-corba/src/test/java/org/apache/tuscany/sca/host/corba/UtilsTestCase.java b/sca-java-2.x/branches/2.0-Beta3/modules/host-corba/src/test/java/org/apache/tuscany/sca/host/corba/UtilsTestCase.java deleted file mode 100644 index 4e076f9342..0000000000 --- a/sca-java-2.x/branches/2.0-Beta3/modules/host-corba/src/test/java/org/apache/tuscany/sca/host/corba/UtilsTestCase.java +++ /dev/null @@ -1,145 +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.tuscany.sca.host.corba; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -/** - * @version $Rev$ $Date$ - * Tests for host utils - */ -public class UtilsTestCase { - - private void assertDetailsAreOk(CorbanameURL details, String host, int port, String nameService, List namePath) { - assertTrue(details.getHost().equals(host)); - assertTrue(details.getNameService().equals(nameService)); - assertTrue(details.getPort() == port); - assertTrue(details.getNamePath().size() == namePath.size()); - for (int i = 0; i < namePath.size(); i++) { - assertTrue(details.getNamePath().get(i).equals(namePath.get(i))); - } - } - - /** - * Tests if corbaname url is beeing processes properly - */ - @Test - public void test_validCorbaname() { - String testUri = null; - CorbanameURL details = null; - List namePath = null; - - testUri = "corbaname:ignore:host:1234/Service#Reference"; - details = CorbaHostUtils.getServiceDetails(testUri); - namePath = new ArrayList(); - namePath.add("Reference"); - assertDetailsAreOk(details, "host", 1234, "Service", namePath); - - testUri = "corbaname:ignore:host:/Service#Reference"; - details = CorbaHostUtils.getServiceDetails(testUri); - namePath = new ArrayList(); - namePath.add("Reference"); - assertDetailsAreOk(details, "host", CorbanameURL.DEFAULT_PORT, "Service", namePath); - - testUri = "corbaname:ignore:host/Service#Reference"; - details = CorbaHostUtils.getServiceDetails(testUri); - namePath = new ArrayList(); - namePath.add("Reference"); - assertDetailsAreOk(details, "host", CorbanameURL.DEFAULT_PORT, "Service", namePath); - - testUri = "corbaname:ignore:/Service#Reference"; - details = CorbaHostUtils.getServiceDetails(testUri); - namePath = new ArrayList(); - namePath.add("Reference"); - assertDetailsAreOk(details, CorbanameURL.DEFAULT_HOST, CorbanameURL.DEFAULT_PORT, "Service", namePath); - - testUri = "corbaname:ignore/Service#Reference"; - details = CorbaHostUtils.getServiceDetails(testUri); - namePath = new ArrayList(); - namePath.add("Reference"); - assertDetailsAreOk(details, CorbanameURL.DEFAULT_HOST, CorbanameURL.DEFAULT_PORT, "Service", namePath); - - testUri = "corbaname:/Service#Reference"; - details = CorbaHostUtils.getServiceDetails(testUri); - namePath = new ArrayList(); - namePath.add("Reference"); - assertDetailsAreOk(details, CorbanameURL.DEFAULT_HOST, CorbanameURL.DEFAULT_PORT, "Service", namePath); - - testUri = "corbaname/Service#Reference"; - details = CorbaHostUtils.getServiceDetails(testUri); - namePath = new ArrayList(); - namePath.add("Reference"); - assertDetailsAreOk(details, CorbanameURL.DEFAULT_HOST, CorbanameURL.DEFAULT_PORT, "Service", namePath); - - testUri = "corbaname#Reference"; - details = CorbaHostUtils.getServiceDetails(testUri); - namePath = new ArrayList(); - namePath.add("Reference"); - assertDetailsAreOk(details, CorbanameURL.DEFAULT_HOST, CorbanameURL.DEFAULT_PORT, CorbanameURL.DEFAULT_NAME_SERVICE, namePath); - - testUri = "corbaname#Parent/Mid/Reference"; - details = CorbaHostUtils.getServiceDetails(testUri); - namePath = new ArrayList(); - namePath.add("Parent"); - namePath.add("Mid"); - namePath.add("Reference"); - assertDetailsAreOk(details, CorbanameURL.DEFAULT_HOST, CorbanameURL.DEFAULT_PORT, CorbanameURL.DEFAULT_NAME_SERVICE, namePath); - } - - /** - * Test for invalid corbaname url - */ - @Test - public void test_invalidCorbaname() { - String testUri = null; - - try { - testUri = "this.string.should.not.appear.in.the.beggining:ignore:host:1234/Service#Reference"; - CorbaHostUtils.getServiceDetails(testUri); - fail(); - } catch (Exception e) { - assertTrue(e instanceof IllegalArgumentException); - } - - try { - testUri = "corbaname:ignore:host:1234/Service#"; - CorbaHostUtils.getServiceDetails(testUri); - fail(); - } catch (Exception e) { - assertTrue(e instanceof IllegalArgumentException); - } - } - - /** - * Test for creating corbaname url from host, port, name parameters - */ - @Test - public void test_creatingCorbanameURI() { - String uri = CorbaHostUtils.createCorbanameURI("SomeHost", 1000, "SomeName"); - assertEquals("corbaname::SomeHost:1000/NameService#SomeName", uri); - } -} -- cgit v1.2.3