1/*2 * Copyright 2001-2010 The Apache Software Foundation.3 * 4 * Licensed under the Apache License, Version 2.0 (the "License");5 * you may not use this file except in compliance with the License.6 * You may obtain a copy of the License at7 * http://www.apache.org/licenses/LICENSE-2.08 * 9 * Unless required by applicable law or agreed to in writing, software10 * distributed under the License is distributed on an "AS IS" BASIS,11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12 * See the License for the specific language governing permissions and13 * limitations under the License.14 */15package org.apache.juddi.rmi;
1617import org.apache.commons.configuration.ConfigurationException;
18import org.junit.Assert;
19import org.junit.Test;
20import org.mockejb.jndi.MockContextFactory;
2122/**23 * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>24 */25publicclassJNDIRegistrationTest26 {
27 @Test
28publicvoid registerToJNDI_AnonymousPort() throws ConfigurationException
29 {
30try {
31 MockContextFactory.setAsInitial();
32//register all jUDDI services, under an anonymous port33 JNDIRegistration.getInstance().register(0);
34 JNDIRegistration.getInstance().unregister();
3536 } catch (Exception e) {
37 e.printStackTrace();
38 Assert.fail();
39 }
40 }
4142 @Test
43publicvoid registerToJNDI_UserDefinedPort() throws ConfigurationException
44 {
45try {
46 MockContextFactory.setAsInitial();
47//register all jUDDI services, under an use defined port48 JNDIRegistration.getInstance().register(34567);
49 JNDIRegistration.getInstance().unregister();
5051 } catch (Exception e) {
52 e.printStackTrace();
53 Assert.fail();
54 }
55 }
565758 }