1 22 package org.objectweb.petals.jbi.component.mock; 23 24 import javax.jbi.JBIException; 25 import javax.jbi.messaging.MessageExchange; 26 import javax.jbi.servicedesc.ServiceEndpoint; 27 import javax.xml.namespace.QName ; 28 29 import org.objectweb.fractal.api.NoSuchInterfaceException; 30 import org.objectweb.fractal.api.control.IllegalBindingException; 31 import org.objectweb.fractal.api.control.IllegalLifeCycleException; 32 import org.objectweb.petals.jbi.management.service.EndpointService; 33 import org.objectweb.petals.jbi.registry.AbstractEndpoint; 34 import org.objectweb.petals.jbi.registry.ConsumerEndpoint; 35 import org.objectweb.petals.jbi.registry.InternalEndpoint; 36 import org.w3c.dom.Document ; 37 38 44 public class MockEndpointService implements EndpointService { 45 46 private boolean deactivateEndpoint; 47 48 private boolean deregisterInternalEndpoint; 49 50 private boolean deregisterExternalEndpoint; 51 52 private boolean getEndpoint; 53 54 private boolean getInternalEndpointsForInterface; 55 56 private boolean getInternalEndpointsForService; 57 58 private boolean getExternalEndpointsForInterface; 59 60 private boolean getExternalEndpointsForService; 61 62 private boolean registerExternalEndpoint; 63 64 public InternalEndpoint activateEndpoint(QName serviceName, 65 String endpointName, ConsumerEndpoint address) throws JBIException { 66 return new InternalEndpoint(serviceName, endpointName, "compo", "0", 67 this); 68 } 69 70 public void bindFc(String arg0, Object arg1) 71 throws NoSuchInterfaceException, IllegalBindingException, 72 IllegalLifeCycleException { 73 } 74 75 public void createConnection(QName consInterface, QName provService, String provEndpoint) throws JBIException { 76 } 77 78 public void createConnection(QName consService, String consEndpoint, QName provService, String provEndpoint) throws JBIException { 79 throw new JBIException("createConnection testing exception"); 80 } 81 82 public void deactivateEndpoint(ServiceEndpoint endpoint) 83 throws JBIException { 84 deactivateEndpoint = true; 85 } 86 87 public void deleteConnection(QName consInterface, QName provService, String provEndpoint) throws JBIException { 88 } 89 90 public void deleteConnection(QName consService, String consEndpoint, QName provService, String provEndpoint) throws JBIException { 91 } 92 93 public void deregisterExternalEndpoint(ServiceEndpoint endpoint) 94 throws JBIException { 95 deregisterExternalEndpoint = true; 96 } 97 98 public void deregisterInternalEndpoint(ServiceEndpoint endpoint) 99 throws JBIException { 100 deregisterInternalEndpoint = true; 101 } 102 103 public ServiceEndpoint getEndpoint(QName service, String name) { 104 getEndpoint = true; 105 return null; 106 } 107 108 public ServiceEndpoint getEndpoint(QName service, String name, boolean resolve) { 109 getEndpoint = true; 110 return null; 111 } 112 113 public Document getEndpointDescriptorForEndpoint(ServiceEndpoint endpoint) { 114 return null; 115 } 116 117 public ServiceEndpoint[] getExternalEndpointsForInterface( 118 QName interfaceName) { 119 getExternalEndpointsForInterface = true; 120 return new ServiceEndpoint[]{}; 121 } 122 123 public ServiceEndpoint[] getExternalEndpointsForService(QName serviceName) { 124 getExternalEndpointsForService = true; 125 return new ServiceEndpoint[]{}; 126 } 127 128 public String getFcState() { 129 return null; 130 } 131 132 public QName [] getInterfacesForEndpoint(AbstractEndpoint endpoint) { 133 return null; 134 } 135 136 public AbstractEndpoint getInternalEndpoint(QName service, String name) { 137 return null; 138 } 139 140 public ServiceEndpoint[] getInternalEndpointsForInterface( 141 QName interfaceName) { 142 getInternalEndpointsForInterface = true; 143 return new ServiceEndpoint[]{}; 144 } 145 146 public ServiceEndpoint[] getInternalEndpointsForService(QName serviceName) { 147 getInternalEndpointsForService = true; 148 return new ServiceEndpoint[]{}; 149 } 150 151 public boolean isContainerStarted(AbstractEndpoint endpoint) { 152 return false; 153 } 154 155 public boolean isDeactivateEndpoint() { 156 return deactivateEndpoint; 157 } 158 159 public boolean isDeregisterExternalEndpoint() { 160 return deregisterExternalEndpoint; 161 } 162 163 public boolean isDeregisterInternalEndpoint() { 164 return deregisterInternalEndpoint; 165 } 166 167 public boolean isExchangeWithConsumerOkayForComponent(InternalEndpoint internalEndpoint, MessageExchange exchange) { 168 return false; 169 } 170 171 public boolean isExchangeWithConsumerOkayForComponent(String componentName, 172 InternalEndpoint internalEndpoint, MessageExchange exchange) { 173 return false; 174 } 175 176 public boolean isExchangeWithProviderOkayForComponent(InternalEndpoint internalEndpoint, MessageExchange exchange) { 177 return false; 178 } 179 180 public boolean isExchangeWithProviderOkayForComponent(String componentName, 181 InternalEndpoint internalEndpoint, MessageExchange exchange) { 182 return false; 183 } 184 185 public boolean isGetEndpoint() { 186 return getEndpoint; 187 } 188 189 public boolean isGetExternalEndpointsForInterface() { 190 return getExternalEndpointsForInterface; 191 } 192 193 public boolean isGetExternalEndpointsForService() { 194 return getExternalEndpointsForService; 195 } 196 197 public boolean isGetInternalEndpointsForInterface() { 198 return getInternalEndpointsForInterface; 199 } 200 201 public boolean isGetInternalEndpointsForService() { 202 return getInternalEndpointsForService; 203 } 204 205 public boolean isRegisterExternalEndpoint() { 206 return registerExternalEndpoint; 207 } 208 209 public String [] listFc() { 210 return null; 211 } 212 213 public Object lookupFc(String arg0) throws NoSuchInterfaceException { 214 return null; 215 } 216 217 public void registerExternalEndpoint(ServiceEndpoint externalEndpoint) 218 throws JBIException { 219 registerExternalEndpoint = true; 220 } 221 222 public void setDeactivateEndpoint(boolean deactivateEndpoint) { 223 this.deactivateEndpoint = deactivateEndpoint; 224 } 225 226 public void setDeregisterExternalEndpoint(boolean deregisterExternalEndpoint) { 227 this.deregisterExternalEndpoint = deregisterExternalEndpoint; 228 } 229 230 public void setDeregisterInternalEndpoint(boolean deregisterInternalEndpoint) { 231 this.deregisterInternalEndpoint = deregisterInternalEndpoint; 232 } 233 234 public void setGetEndpoint(boolean getEndpoint) { 235 this.getEndpoint = getEndpoint; 236 } 237 238 public void setGetExternalEndpointsForInterface( 239 boolean getExternalEndpointsForInterface) { 240 this.getExternalEndpointsForInterface = getExternalEndpointsForInterface; 241 } 242 243 public void setGetExternalEndpointsForService( 244 boolean getExternalEndpointsForService) { 245 this.getExternalEndpointsForService = getExternalEndpointsForService; 246 } 247 248 public void setGetInternalEndpointsForInterface( 249 boolean getInternalEndpointsForInterface) { 250 this.getInternalEndpointsForInterface = getInternalEndpointsForInterface; 251 } 252 253 public void setGetInternalEndpointsForService( 254 boolean getInternalEndpointsForService) { 255 this.getInternalEndpointsForService = getInternalEndpointsForService; 256 } 257 258 public void setRegisterExternalEndpoint(boolean registerExternalEndpoint) { 259 this.registerExternalEndpoint = registerExternalEndpoint; 260 } 261 262 public void startFc() throws IllegalLifeCycleException { 263 } 264 265 public void stopFc() throws IllegalLifeCycleException { 266 } 267 268 public void unbindFc(String arg0) throws NoSuchInterfaceException, 269 IllegalBindingException, IllegalLifeCycleException { 270 } 271 272 } 273 | Popular Tags |