本文整理汇总了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();
}
示例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));
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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();
}
}
示例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;
}
示例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);
}
示例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();
}
示例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();
}
示例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());
}
示例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;
}
示例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();
}
示例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;
}