recoveryCheckpoint.afterPropertiesSet(); setRecoveryCheckpoint(recoveryCheckpoint); Map<String,Checkpointable> toSetRecovery = appCtx.getBeansOfType(Checkpointable.class);
Map<String,Checkpointable> toCheckpoint = appCtx.getBeansOfType(Checkpointable.class); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("checkpointing beans " + toCheckpoint);
protected Map<String, CamelContext> getCamelContextMap() { Map<String, SpringCamelContext> map = applicationContext.getBeansOfType(SpringCamelContext.class); Set<Map.Entry<String, SpringCamelContext>> entries = map.entrySet(); Map<String, CamelContext> answer = new HashMap<>(); for (Map.Entry<String, SpringCamelContext> entry : entries) { String name = entry.getKey(); CamelContext camelContext = entry.getValue(); answer.put(name, camelContext); } return answer; }
@Test public void testOutboundChannelAdapterWithinChain() throws Exception { AbstractApplicationContext ctx = new ClassPathXmlApplicationContext( "TcpOutboundChannelAdapterWithinChainTests-context.xml", this.getClass()); AbstractServerConnectionFactory scf = ctx.getBean(AbstractServerConnectionFactory.class); TestingUtilities.waitListening(scf, null); ctx.getBean(AbstractClientConnectionFactory.class).setPort(scf.getPort()); ctx.getBeansOfType(ConsumerEndpointFactoryBean.class).values().forEach(c -> c.start()); MessageChannel channelAdapterWithinChain = ctx.getBean("tcpOutboundChannelAdapterWithinChain", MessageChannel.class); PollableChannel inbound = ctx.getBean("inbound", PollableChannel.class); String testPayload = "Hello, world!"; channelAdapterWithinChain.send(new GenericMessage<String>(testPayload)); Message<?> m = inbound.receive(1000); assertNotNull(m); assertEquals(testPayload, new String((byte[]) m.getPayload())); ctx.close(); }
/** * Tests a loopback. The client-side outbound adapter sends a message over * a connection from the client connection factory; the server side * receives the message, puts in on a channel which is the input channel * for the outbound adapter that's sharing the connections. The response * comes back to an inbound adapter that is sharing the client's * connection and we verify we get the echo back as expected. * * @throws Exception */ @Test public void test1() throws Exception { TestingUtilities.waitListening(this.server, null); this.client.setPort(this.server.getPort()); this.ctx.getBeansOfType(ConsumerEndpointFactoryBean.class).values().forEach(c -> c.start()); for (int i = 0; i < 5; i++) { MessageChannel input = ctx.getBean("input", MessageChannel.class); input.send(MessageBuilder.withPayload("Test").build()); QueueChannel replies = ctx.getBean("replies", QueueChannel.class); Message<?> message = replies.receive(10000); assertNotNull(message); assertEquals("Test", message.getPayload()); } assertThat(this.listener.openEvent, notNullValue()); assertThat(this.listener.openEvent.getConnectionFactoryName(), equalTo("client")); }
public <T> Map<String, T> getBeans(final String ctxName, final Class<T> type) { final AbstractApplicationContext context = contexts.get(ctxName); Objects.requireNonNull(context, "Context not found for name '" + ctxName + "'"); return context.getBeansOfType(type); }
private void listAction(String[] arguments) { Map<String, CommandLineApplication> all = context.getBeansOfType(CommandLineApplication.class); for(Entry<String, CommandLineApplication> that:all.entrySet()) { String beanName=that.getKey(); System.out.println(beanName); } }
/** * Tests a loopback. The client-side outbound adapter sends a message over * a connection from the client connection factory; the server side * receives the message, puts in on a channel which is the input channel * for the outbound adapter that's sharing the connections. The response * comes back to an inbound adapter that is sharing the client's * connection and we verify we get the echo back as expected. * * @throws Exception */ @Test public void test1() throws Exception { TestingUtilities.waitListening(this.server, null); this.client.setPort(this.server.getPort()); this.ctx.getBeansOfType(ConsumerEndpointFactoryBean.class).values().forEach(c -> c.start()); MessageChannel input = ctx.getBean("input", MessageChannel.class); input.send(MessageBuilder.withPayload("Test").build()); QueueChannel replies = ctx.getBean("replies", QueueChannel.class); Message<?> message = replies.receive(10000); MessageHistory history = MessageHistory.read(message); assertNotNull(history); Properties componentHistoryRecord = TestUtils.locateComponentInHistory(history, "inboundClient", 0); assertNotNull(componentHistoryRecord); assertEquals("ip:tcp-inbound-channel-adapter", componentHistoryRecord.getProperty("type")); assertNotNull(message); assertEquals("Test", message.getPayload()); }
this.ctx.getBeansOfType(AbstractServerConnectionFactory.class); servers.forEach((k, v) -> { TestingUtilities.waitListening(v, null); this.ctx.getBeansOfType(ConsumerEndpointFactoryBean.class); consumers.values().forEach(g -> g.start()); initializedFactories = true;
public AbstractContainerStarter withAllDefault(final DescriptorDeploymentCallBack callback) { final AbstractApplicationContext context = readContextFromFile("static-service/default-static-services.xml"); final Map<String, ServiceDeployment> descritorsMap = context.getBeansOfType(ServiceDeployment.class); final List<ServiceDeployment> descriptors = new ArrayList<>(descritorsMap.values()); Collections.sort(descriptors, new ServiceDeploymentComparator()); for (final ServiceDeployment serviceDeployment : descriptors) { callback.doWithDeployment(serviceDeployment); } return this; }
private Pair<String, String> getAnnotation(String className) throws ClassNotFoundException { Class<?> beanType = ReflectUtils.name2class(className); Map<String, ?> beanMap = applicationContext.getBeansOfType(beanType); String group = null; String version = null; for (Map.Entry<String, ?> entry : beanMap.entrySet()) { Object obj = entry.getValue(); SalukiService salukiAnnotation = obj.getClass().getAnnotation(SalukiService.class); group = salukiAnnotation.group(); version = salukiAnnotation.version(); break; } if (StringUtils.isBlank(group) || StringUtils.isBlank(version)) { group = prop.getGroup(); version = prop.getVersion(); } return new ImmutablePair<String, String>(group, version); }
Map temp = context.getBeansOfType(MuleConfiguration.class, true, true); if (temp.size() > 0) Map connectors = context.getBeansOfType(UMOConnector.class, true, true); setConnectors(connectors.values()); temp = context.getBeansOfType(UMOTransactionManagerFactory.class, true, true); if (temp.size() > 0) temp = context.getBeansOfType(UMOSecurityManager.class, true, true); if (temp.size() > 0) Map transformers = context.getBeansOfType(UMOTransformer.class, true, true); setTransformers(transformers.values()); Map endpoints = context.getBeansOfType(UMOEndpoint.class, true, true); setEndpoints(endpoints.values()); Map agents = context.getBeansOfType(UMOAgent.class, true, true); setAgents(agents.values()); Map containers = context.getBeansOfType(UMOContainerContext.class, true, true); setContainerContext(containers); Map interceptors = context.getBeansOfType(UMOInterceptorStack.class, true, true); setInterceptorStacks(interceptors); Map components = context.getBeansOfType(UMODescriptor.class, true, true); setComponents(components.values());
protected void createModel() throws UMOException Map temp = context.getBeansOfType(UMOModel.class, true, true); if (temp.size() > 1) Map epr = context.getBeansOfType(UMOEntryPointResolver.class, true, true); if (epr.size() > 0) Map lcaf = context.getBeansOfType(UMOLifecycleAdapterFactory.class, true, true); if (lcaf.size() > 0)
css = (CompetitionSetupService) context.getBeansOfType( CompetitionSetupService.class).values().toArray()[0]; css.processCmdLine(args);
Map<?,?> configurers = parentContext.getBeansOfType(PropertyResourceConfigurer.class, false, false); for (Object key : configurers.keySet()) { postProcessors.add((PropertyResourceConfigurer) configurers.get(key));
recoveryCheckpoint.afterPropertiesSet(); setRecoveryCheckpoint(recoveryCheckpoint); Map<String,Checkpointable> toSetRecovery = appCtx.getBeansOfType(Checkpointable.class);
Map<String,Checkpointable> toCheckpoint = appCtx.getBeansOfType(Checkpointable.class); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("checkpointing beans " + toCheckpoint);
/** * @see io.github.saluki.service.Health#Check(io.github.saluki.service.serviceparam.HealthCheckRequest) */ @Override public HealthCheckResponse Check(HealthCheckRequest healthcheckrequest) { String service = healthcheckrequest.getService(); try { Object obj = applicationContext.getBeansOfType(ReflectUtils.name2class(service)); if (obj != null) { HealthCheckResponse response = new HealthCheckResponse(); response.setStatus(io.github.saluki.service.serviceparam.ServingStatus.SERVING); return response; } else { HealthCheckResponse response = new HealthCheckResponse(); response.setStatus(io.github.saluki.service.serviceparam.ServingStatus.NOT_SERVING); return response; } } catch (BeansException | ClassNotFoundException e) { HealthCheckResponse response = new HealthCheckResponse(); response.setStatus(io.github.saluki.service.serviceparam.ServingStatus.UNKNOWN); return response; } }