当前位置: 首页>>代码示例>>Java>>正文


Java MuleContext类代码示例

本文整理汇总了Java中org.mule.api.MuleContext的典型用法代码示例。如果您正苦于以下问题:Java MuleContext类的具体用法?Java MuleContext怎么用?Java MuleContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MuleContext类属于org.mule.api包,在下文中一共展示了MuleContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSpringMaster

import org.mule.api.MuleContext; //导入依赖的package包/类
@Test
public void testSpringMaster() throws Exception {
    ApplicationContext ctx = new ClassPathXmlApplicationContext("mule/spring-master/spring-master.xml");

    MuleContext mc = (MuleContext) ctx.getBean("_muleContext");
    mc.start();

    RepositoryService repositoryService = (RepositoryService) ctx.getBean("repositoryService");
    repositoryService.createDeployment().addClasspathResource("mule/leaveWithMule.bpmn").deploy();

    RuntimeService runtimeService = (RuntimeService) ctx.getBean("runtimeService");

    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("days", 5);
    runtimeService.startProcessInstanceByKey("leaveWithMule", variableMap);

    TaskService taskService = (TaskService) ctx.getBean("taskService");
    Task task = taskService.createTaskQuery().singleResult();
    assertNotNull(task);
    assertEquals("部门经理审批", task.getName());

    mc.stop();
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:24,代码来源:ActivitiWithMuleTest.java

示例2: setUp

import org.mule.api.MuleContext; //导入依赖的package包/类
@Before
public void setUp()
{
    muleContext = Mockito.mock(MuleContext.class);
    objectStoreManager = Mockito.mock(ObjectStoreManager.class);
    muleConfiguration = Mockito.mock(MuleConfiguration.class);
    Mockito.when(muleContext.getConfiguration()).thenReturn(muleConfiguration);
    Mockito.when(muleConfiguration.getId()).thenReturn(APP_NAME);
    Mockito.when(muleContext.getObjectStoreManager()).thenReturn(objectStoreManager);
    Mockito.when(objectStoreManager.getObjectStore(any(String.class))).thenReturn(new InMemoryObjectStore());
    corsConfig = new CorsConfig();
    corsConfig.setMuleContext(muleContext);
    Origin origin = new Origin();
    origin.setUrl(DOMAIN);
    origin.setMethods(Arrays.asList(HttpConstants.Methods.POST.toString()));
    corsConfig.setOrigins(Arrays.asList(origin));
}
 
开发者ID:mulesoft,项目名称:mule-module-cors,代码行数:18,代码来源:CorsConfigTest.java

示例3: transformerResolver

import org.mule.api.MuleContext; //导入依赖的package包/类
@TransformerResolver
public static org.mule.api.transformer.Transformer transformerResolver(final DataType<?> source,
                                                                       final DataType<?> result,
                                                                       final MuleContext muleContext)
    throws Exception
{
    if ((result.getType() == Map.class) || (result.getType() == List.class))
    {
        final JsonToObject jsonToObject = new JsonToObject();
        jsonToObject.setReturnDataType(new SimpleDataType<Object>(Object.class));
        muleContext.getRegistry().applyProcessorsAndLifecycle(jsonToObject);
        return jsonToObject;
    }

    return null;
}
 
开发者ID:ddossot,项目名称:translink-connector,代码行数:17,代码来源:TransLinkConnector.java

示例4: logNotFound

import org.mule.api.MuleContext; //导入依赖的package包/类
void logNotFound(RequestLine requestLine, MuleContext muleContext) {
    HttpResponse httpResponse = new HttpResponse();
    httpResponse.setStatusLine(requestLine.getHttpVersion(), HttpConstants.SC_NOT_FOUND);

    DefaultMuleMessage message = new DefaultMuleMessage(httpResponse, muleContext);
    message.setInboundProperty(HttpConnector.HTTP_METHOD_PROPERTY, requestLine.getMethod());

    try {
        URI uri = new URI(requestLine.getUri());
        message.setInboundProperty(HttpConnector.HTTP_REQUEST_PATH_PROPERTY, uri.getPath());
        if (hasText(uri.getQuery())) {
            message.setInboundProperty(HttpConnector.HTTP_QUERY_STRING, uri.getQuery());
        }
    } catch (URISyntaxException e) {
        e.printStackTrace(); // we swallow this that should never happen
    }
    accessLogger.log(message);
}
 
开发者ID:greenbird,项目名称:mule-access-log,代码行数:19,代码来源:AccessLoggingHelper.java

示例5: visitAfter

import org.mule.api.MuleContext; //导入依赖的package包/类
@Override
public void visitAfter(SAXElement saxElement, ExecutionContext executionContext) throws SmooksException, IOException {
    try {
        Object xmlElement = executionContext.getBeanContext().getBean(FRAGMENT_BEAN_ID);
        MuleContext muleContext = (MuleContext) executionContext.getBeanContext().getBean(MULE_CONTEXT_BEAN_ID);
        muleContext.getClient().send(sendToUri, new DefaultMuleMessage(xmlElement, muleContext));
    } catch (Exception e) {
        String message = String.format("XmlStreamSplitterComponent visitAfter() exception caught: %s", e.getMessage());
        log.error(message, e);
        throw new RuntimeException(message, e);
    }
}
 
开发者ID:guido-n,项目名称:mule-useful-experiments,代码行数:13,代码来源:XmlStreamSplitterComponent.java

示例6: main

import org.mule.api.MuleContext; //导入依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) throws Exception{
	MuleContext muleContext = new DefaultMuleContextFactory().createMuleContext("consumeservice.xml"); 
	muleContext.start();
	MuleClient client=new MuleClient();
	client.send("vm://helloworld.queue", "BlueDavy", null);
}
 
开发者ID:java-scott,项目名称:java-project,代码行数:10,代码来源:ConsumeService.java

示例7: main

import org.mule.api.MuleContext; //导入依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) throws Exception{
	MuleContext muleContext = new DefaultMuleContextFactory().createMuleContext("publishservice.xml"); 
	muleContext.start();
	System.out.println("Server Started");
	Object object=new Object();
	synchronized (object) {
		object.wait();
	}
}
 
开发者ID:java-scott,项目名称:java-project,代码行数:13,代码来源:PublishService.java

示例8: getMuleContext

import org.mule.api.MuleContext; //导入依赖的package包/类
protected MuleContext getMuleContext() {
    if (this.muleContext == null) {
        Map<Object, Object> beans = CommandContextUtil.getProcessEngineConfiguration().getBeans();
        this.muleContext = (MuleContext) beans.get("muleContext");
    }
    return this.muleContext;
}
 
开发者ID:flowable,项目名称:flowable-engine,代码行数:8,代码来源:MuleSendActivityBehavior.java

示例9: testMule

import org.mule.api.MuleContext; //导入依赖的package包/类
@Test
public void testMule() throws Exception {
    MuleContext muleContext = new DefaultMuleContextFactory().createMuleContext("mule/mule-standlone-config.xml");
    muleContext.start();
    MuleClient muleClient = new DefaultLocalMuleClient(muleContext);
    Integer days = 5;
    MuleMessage message = muleClient.send("vm://helloMule", new DefaultMuleMessage(days, muleContext));
    assertNotNull(message.getPayload());
    Boolean result = (Boolean) message.getPayload();
    assertTrue(result);
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:12,代码来源:HelloMuleTest.java

示例10: testMuleMaster

import org.mule.api.MuleContext; //导入依赖的package包/类
@Test
public void testMuleMaster() throws Exception {
    MuleContext muleContext = new DefaultMuleContextFactory().createMuleContext("mule/mule-master/mule-master.xml");
    muleContext.start();

    MuleRegistry registry = muleContext.getRegistry();
    RepositoryService repositoryService = (RepositoryService) registry.get("repositoryService");
    repositoryService.createDeployment().addClasspathResource("mule/leaveWithMule.bpmn").deploy();

    MuleClient muleClient = new DefaultLocalMuleClient(muleContext);
    DefaultMuleMessage message = new DefaultMuleMessage("", muleContext);
    Map<String, Object> variableMap = new HashMap<String, Object>();
    variableMap.put("days", 5);
    variableMap.put("processDefinitionKey", "leaveWithMule");
    message.setProperty("createProcessParameters", variableMap , PropertyScope.OUTBOUND);
    MuleMessage responseMessage = muleClient.send("vm://startLeaveProcess", message);
    ProcessInstance processInstance = (ProcessInstance) responseMessage.getPayload();
    assertFalse(processInstance.isEnded());

    TaskService taskService = registry.get("taskService");
    Task task = taskService.createTaskQuery().singleResult();
    assertNotNull(task);
    assertEquals("部门经理审批", task.getName());

    muleContext.stop();
    muleContext.dispose();
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:28,代码来源:ActivitiWithMuleTest.java

示例11: muleContext

import org.mule.api.MuleContext; //导入依赖的package包/类
/**
 * Bean must be @Lazy to ensure the mulecontext has been initialized
 *
 * @return the MuleContext
 */
@Lazy
@Bean
protected MuleContext muleContext()
{
	return this.muleContextInitializer.getMuleContext();
}
 
开发者ID:denschu,项目名称:mule-spring-boot-starter,代码行数:12,代码来源:MuleAutoConfiguration.java

示例12: testLifecycle

import org.mule.api.MuleContext; //导入依赖的package包/类
@Test
public void testLifecycle() {
	initializer.onApplicationEvent(new ContextRefreshedEvent(context));
	assertNotNull(initializer.getMuleContext());
	MuleContext muleContext = initializer.getMuleContext();
	assertTrue(muleContext.isStarted());
	initializer.onApplicationEvent(new ContextClosedEvent(context));
	assertNull(initializer.getMuleContext());
	assertTrue(muleContext.isDisposed());
}
 
开发者ID:denschu,项目名称:mule-spring-boot-starter,代码行数:11,代码来源:MuleContextInitializerTest.java

示例13: getMuleContext

import org.mule.api.MuleContext; //导入依赖的package包/类
private MuleContext getMuleContext() {
  if (this.muleContext == null) {
    Map<Object, Object> beans = Context.getProcessEngineConfiguration().getBeans();
    this.muleContext = (MuleContext) beans.get("muleContext");
  }
  return this.muleContext;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:8,代码来源:MuleSendActivitiBehavior.java

示例14: main

import org.mule.api.MuleContext; //导入依赖的package包/类
public static void main(String[] args) throws MuleException
{
	setProperty("ebms.mode",new String[]{"normal","oracle"},"normal");
	setProperty("ebms.protocol",new String[]{"http","https"},"http");
	setProperty("ebms.database",new String[]{"hsqldb","mysql","postgresql","mssql","oracle"},"hsqldb");
	DefaultMuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
	SpringXmlConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder(args.length == 0 ? "main.xml" : args[0]);
	MuleContext muleContext = muleContextFactory.createMuleContext(configBuilder);
	muleContext.start();
}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:11,代码来源:Start.java

示例15: getMuleContext

import org.mule.api.MuleContext; //导入依赖的package包/类
/**
 * Retrieves the Mule context.<br/>
 * For testing purposes only.
 *
 * @return Mule context of the started Mule transport service, or null
 * if no context is available.
 */
synchronized MuleContext getMuleContext() {
    MuleContext theMuleContext = null;

    if (mMuleClient != null) {
        theMuleContext = mMuleClient.getMuleContext();
    }
    return theMuleContext;
}
 
开发者ID:krizsan,项目名称:message-cowboy,代码行数:16,代码来源:MuleTransportService.java


注:本文中的org.mule.api.MuleContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。