1/*2cd .. * Copyright 2001-2009 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.subscription.notify;
1617import java.lang.reflect.InvocationTargetException;
18import java.net.URISyntaxException;
1920import junit.framework.Assert;
2122import org.apache.juddi.api_v3.AccessPointType;
23import org.apache.juddi.model.BindingTemplate;
24import org.apache.juddi.model.TmodelInstanceInfo;
25import org.junit.Test;
2627/**28 * @author <a href="mailto:kstam@apache.org">Kurt T Stam</a>29 */30publicclassNotifierTest31 {
32 @Test
33publicvoid testHTTPNotifier() throws IllegalArgumentException, SecurityException, URISyntaxException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
34 BindingTemplate bindingTemplate = new BindingTemplate();
35 bindingTemplate.setEntityKey("uddi:uddi.joepublisher.com:bindingnotifier");
36 bindingTemplate.setAccessPointType(AccessPointType.END_POINT.toString());
37 bindingTemplate.setAccessPointUrl("http://localhost:12345/tcksubscriptionlistener");
38 TmodelInstanceInfo instanceInfo = new TmodelInstanceInfo();
39 instanceInfo.setTmodelKey("uddi:uddi.org:transport:http");
40 bindingTemplate.getTmodelInstanceInfos().add(instanceInfo);
4142 Notifier notifier = new NotifierFactory().getNotifier(bindingTemplate);
4344 Assert.assertEquals(HTTPNotifier.class, notifier.getClass());
45 }
46 @Test
47publicvoid testSMTPNotifier() throws IllegalArgumentException, SecurityException, URISyntaxException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
48 BindingTemplate bindingTemplate = new BindingTemplate();
49 bindingTemplate.setEntityKey("uddi:uddi.joepublisher.com:bindingnotifier");
50 bindingTemplate.setAccessPointType(AccessPointType.END_POINT.toString());
51 bindingTemplate.setAccessPointUrl("mailto:order@islandtrading.example");
52 TmodelInstanceInfo instanceInfo = new TmodelInstanceInfo();
53 instanceInfo.setTmodelKey("uddi:uddi.org:transport:smtp");
54 bindingTemplate.getTmodelInstanceInfos().add(instanceInfo);
5556 Notifier notifier = new NotifierFactory().getNotifier(bindingTemplate);
5758 Assert.assertEquals(SMTPNotifier.class, notifier.getClass());
59 }
60616263 }