@Test public void testCreateAdapterWithoutService() { try { destination.createAdapter("id"); Assert.fail("ConfigurationException expected"); } catch (ConfigurationException ce) { int error = 11117; Assert.assertEquals(ce.getNumber(), error); } }
public ServiceAdapter createAdapter(String id) { if (getService() == null) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(NO_SERVICE, new Object[]{id}); throw ex; } Map<String, String> adapterClasses = getService().getRegisteredAdapters(); if (!adapterClasses.containsKey(id)) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(ConfigurationConstants.UNREGISTERED_ADAPTER, new Object[]{id, getService().getId()}); throw ex; } String adapterClassName = adapterClasses.get(id); Class<?> adapterClass = ClassUtil.createClass(adapterClassName, FlexContext.getMessageBroker() == null ? null : FlexContext.getMessageBroker().getClassLoader()); ServiceAdapter adapter = (ServiceAdapter)ClassUtil.createDefaultInstance(adapterClass, ServiceAdapter.class); adapter.setId(id); adapter.setManaged(isManaged()); adapter.setDestination(this); return adapter; }
Destination extends ManageableComponent implements java.io.Serializable { public ServiceAdapter createAdapter(String id) { if (getService() == null) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(NO_SERVICE, new Object[]{id}); throw ex; } Map<String, String> adapterClasses = getService().getRegisteredAdapters(); if (!adapterClasses.containsKey(id)) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(ConfigurationConstants.UNREGISTERED_ADAPTER, new Object[]{id, getService().getId()}); throw ex; } String adapterClassName = adapterClasses.get(id); Class<?> adapterClass = ClassUtil.createClass(adapterClassName, FlexContext.getMessageBroker() == null ? null : FlexContext.getMessageBroker().getClassLoader()); ServiceAdapter adapter = (ServiceAdapter)ClassUtil.createDefaultInstance(adapterClass, ServiceAdapter.class); adapter.setId(id); adapter.setManaged(isManaged()); adapter.setDestination(this); return adapter; } }
Destination extends ManageableComponent implements java.io.Serializable { public ServiceAdapter createAdapter(String id) { if (getService() == null) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(NO_SERVICE, new Object[]{id}); throw ex; } Map<String, String> adapterClasses = getService().getRegisteredAdapters(); if (!adapterClasses.containsKey(id)) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(ConfigurationConstants.UNREGISTERED_ADAPTER, new Object[]{id, getService().getId()}); throw ex; } String adapterClassName = adapterClasses.get(id); Class<?> adapterClass = ClassUtil.createClass(adapterClassName, FlexContext.getMessageBroker() == null ? null : FlexContext.getMessageBroker().getClassLoader()); ServiceAdapter adapter = (ServiceAdapter)ClassUtil.createDefaultInstance(adapterClass, ServiceAdapter.class); adapter.setId(id); adapter.setManaged(isManaged()); adapter.setDestination(this); return adapter; } Destination();  Destination(boolean enableManagement); }
Destination extends ManageableComponent implements java.io.Serializable { public ServiceAdapter createAdapter(String id) { if (getService() == null) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(NO_SERVICE, new Object[]{id}); throw ex; } Map<String, String> adapterClasses = getService().getRegisteredAdapters(); if (!adapterClasses.containsKey(id)) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(ConfigurationConstants.UNREGISTERED_ADAPTER, new Object[]{id, getService().getId()}); throw ex; } String adapterClassName = adapterClasses.get(id); Class<?> adapterClass = ClassUtil.createClass(adapterClassName, FlexContext.getMessageBroker() == null ? null : FlexContext.getMessageBroker().getClassLoader()); ServiceAdapter adapter = (ServiceAdapter)ClassUtil.createDefaultInstance(adapterClass, ServiceAdapter.class); adapter.setId(id); adapter.setManaged(isManaged()); adapter.setDestination(this); return adapter; } Destination();  Destination(boolean enableManagement); @Override void initialize(String id, ConfigMap properties); boolean isInitialized(); @Override void start(); @Override void stop(); ServiceAdapter getAdapter(); ServiceAdapter createAdapter(String id); void setAdapter(ServiceAdapter adapter); boolean isBackendShared(); List<String> getChannels(); void addChannel(String id); boolean removeChannel(String id); void setChannels(List<String> ids); boolean isClustered(); @Override void setId(String id); NetworkSettings getNetworkSettings(); void setNetworkSettings(NetworkSettings networkSettings); Service getService(); void setService(Service service); String getServiceType(); SecurityConstraint getSecurityConstraint(); void setSecurityConstraint(SecurityConstraint securityConstraint); void setSecurityConstraint(String ref); ConfigMap describeDestination(); ConfigMap describeDestination(boolean onlyReliable); void addExtraProperty(String name, Object value); Object getExtraProperty(String name); }
Destination extends ManageableComponent implements java.io.Serializable { public ServiceAdapter createAdapter(String id) { if (getService() == null) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(NO_SERVICE, new Object[]{id}); throw ex; } Map<String, String> adapterClasses = getService().getRegisteredAdapters(); if (!adapterClasses.containsKey(id)) { ConfigurationException ex = new ConfigurationException(); ex.setMessage(ConfigurationConstants.UNREGISTERED_ADAPTER, new Object[]{id, getService().getId()}); throw ex; } String adapterClassName = adapterClasses.get(id); Class<?> adapterClass = ClassUtil.createClass(adapterClassName, FlexContext.getMessageBroker() == null ? null : FlexContext.getMessageBroker().getClassLoader()); ServiceAdapter adapter = (ServiceAdapter)ClassUtil.createDefaultInstance(adapterClass, ServiceAdapter.class); adapter.setId(id); adapter.setManaged(isManaged()); adapter.setDestination(this); return adapter; } Destination();  Destination(boolean enableManagement); @Override void initialize(String id, ConfigMap properties); boolean isInitialized(); @Override void start(); @Override void stop(); ServiceAdapter getAdapter(); ServiceAdapter createAdapter(String id); void setAdapter(ServiceAdapter adapter); boolean isBackendShared(); List<String> getChannels(); void addChannel(String id); boolean removeChannel(String id); void setChannels(List<String> ids); boolean isClustered(); @Override void setId(String id); NetworkSettings getNetworkSettings(); void setNetworkSettings(NetworkSettings networkSettings); Service getService(); void setService(Service service); String getServiceType(); SecurityConstraint getSecurityConstraint(); void setSecurityConstraint(SecurityConstraint securityConstraint); void setSecurityConstraint(String ref); ConfigMap describeDestination(); ConfigMap describeDestination(boolean onlyReliable); void addExtraProperty(String name, Object value); Object getExtraProperty(String name); static final String LOG_CATEGORY; static final String PUSH_DESTINATION_ID; }