• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PropertyScope类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: extractVariables

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
public static Collection<LogVariable> extractVariables(MuleMessage message, PropertyScope scope,
		Collection<String> varNames, Boolean logType) {
	Collection<LogVariable> variables = new HashSet<>();
	Set<String> definedProperties = message.getPropertyNames(scope);
	for (String varName : varNames) {
		if (varName.equalsIgnoreCase("rootMessage")) {
			continue;
		}
		if (definedProperties.contains(varName)) {
			Object value = message.getProperty(varName, scope);
			Map<String, Object> variable = new LinkedHashMap<>();
			variable.put("name", varName);
			variable.put("value", value);
			variable.put("scope", scope.toString());
			if (logType) {
				variable.put("type", value != null ? value.getClass().getName() : null);	
			}
			variables.add(new LogVariable(scope.toString(), varName, value, value.getClass().getName()));
		}
	}
	return variables;
}
 
开发者ID:iac-m,项目名称:mule-json-logger,代码行数:23,代码来源:LogHelper.java


示例2: handleMessage

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
public void handleMessage(Message message) throws Fault
	{
		DefaultMuleMessage m = (DefaultMuleMessage)message.get("mule.message");
//		String s = (String)m.getAdapter().getProperty("Content-type");
//		if (StringUtils.isNotEmpty(s))
//			message.put(Message.CONTENT_TYPE,s);
		for (Object name : m.getAdapter().getPropertyNames())
			if (((String)name).equalsIgnoreCase("content-type"))
			{
				String s = (String)m.getAdapter().getProperty((String)name,PropertyScope.INBOUND);
				if (StringUtils.isNotBlank(s))
				{
					message.put(Message.CONTENT_TYPE,s);
					break;
				}
			}
	}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:18,代码来源:OracleEbMSContentTypeFixingInInterceptor.java


示例3: testSendToFileEndpoint

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
/**
 * Tests dispatching of a message to a file endpoint.
 */
@Test
public void testSendToFileEndpoint() {
    /* Start the Mule transport service. */
    mServiceUnderTest.start();

    final MuleMessage theMuleMessage =
        new DefaultMuleMessage(TEST_MESSAGE_PAYLOAD, mServiceUnderTest.getMuleContext());
    /* Set name of file to be written to destination directory. */
    theMuleMessage.setProperty("originalFilename", "testfile.txt", PropertyScope.INBOUND);
    final MoverMessage<MuleMessage> theMessage = new MuleMoverMessage(theMuleMessage);

    mServiceUnderTest.dispatch(theMessage, mOutboundFileEndpointUri);

    delay(1000);

    /* Verify outcome. */
    final File[] theDestDirFiles = mTestDestinationDirectory.listFiles();
    Assert.assertEquals("There should be one file in the destination directory", 1, theDestDirFiles.length);
}
 
开发者ID:krizsan,项目名称:message-cowboy,代码行数:23,代码来源:MuleTransportServiceTest.java


示例4: log

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
@Processor
public Object log(MuleEvent context, @Placement(group = "Logger") @Default("") String message,
		@Placement(group = "Logger") @Default("") String variables,
		@Placement(group = "Logger") @Default("INFO") LogLevel level,
		@Placement(group = "Logger") @Optional String loggerName) {
	MuleMessage muleMessage = context.getMessage();
	LogMessage logMessage = LogHelper.getBasicLogMessage(muleMessage, message);
	HashSet<String> variableNames = new HashSet<String>(
			Arrays.asList(variables != null ? variables.replace(" ", "").split(",") : new String[0]));

	List<LogVariable> varsToBeLogged = new ArrayList<>();
	LogVariable payload = new LogVariable();
	if (variableNames.contains(PAYLOAD_NAME)) {
		try {
			payload.setName(PAYLOAD_NAME);
			if (muleMessage.getPayload() != null) {
				payload.setValue(muleMessage.getPayloadForLogging());
			} else {
				payload.setValue("NULL PAYLOAD");
			}
			variableNames.remove(PAYLOAD_NAME);
		} catch (Exception e) {
			String errorMessage = "Unable to log payload. Message: " + message + ". Exception: " + e.getMessage();
			LOG.fatal(errorMessage, e);
			payload.setValue(errorMessage);
		}
		varsToBeLogged.add(payload);
	}

	varsToBeLogged.addAll(LogHelper.extractVariables(muleMessage, PropertyScope.INBOUND, variableNames,
			config.getLogVariableType()));
	varsToBeLogged.addAll(LogHelper.extractVariables(muleMessage, PropertyScope.OUTBOUND, variableNames,
			config.getLogVariableType()));
	varsToBeLogged.addAll(LogHelper.extractVariables(muleMessage, PropertyScope.INVOCATION, variableNames,
			config.getLogVariableType()));
	logMessage.setVariables(varsToBeLogged);
	log(logMessage, level, StringUtils.isNotBlank(loggerName) ? loggerName : config.getDefaultLoggerName());
	return context.getMessage().getPayload();
}
 
开发者ID:iac-m,项目名称:mule-json-logger,代码行数:40,代码来源:JsonLogger.java


示例5: logAllProperties

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
@Processor
public Object logAllProperties(MuleEvent context, @Placement(group = "Logger") @Default("") String message,
		@Placement(group = "Logger") @Default("Invocation") LogPropertyScope scope,
		@Placement(group = "Logger") @Default("INFO") LogLevel level,
		@Placement(group = "Logger") @Optional String loggerName) {
	MuleMessage muleMessage = context.getMessage();
	LogMessage logMessage = LogHelper.getBasicLogMessage(muleMessage, message);
	List<LogVariable> varsToBeLogged = new ArrayList<>();

	if (scope == LogPropertyScope.Inbound || scope == LogPropertyScope.All) {
		varsToBeLogged.addAll(LogHelper.extractVariables(muleMessage, PropertyScope.INBOUND,
				muleMessage.getPropertyNames(PropertyScope.INBOUND), config.getLogVariableType()));
	}
	if (scope == LogPropertyScope.Outbound || scope == LogPropertyScope.All) {
		varsToBeLogged.addAll(LogHelper.extractVariables(muleMessage, PropertyScope.OUTBOUND,
				muleMessage.getPropertyNames(PropertyScope.OUTBOUND), config.getLogVariableType()));
	}
	if (scope == LogPropertyScope.Invocation || scope == LogPropertyScope.All) {
		varsToBeLogged.addAll(LogHelper.extractVariables(muleMessage, PropertyScope.INVOCATION,
				muleMessage.getPropertyNames(PropertyScope.INVOCATION), config.getLogVariableType()));
	}

	logMessage.setVariables(varsToBeLogged);

	log(logMessage, level, loggerName == null ? config.getDefaultLoggerName() : loggerName);
	return context.getMessage().getPayload();
}
 
开发者ID:iac-m,项目名称:mule-json-logger,代码行数:28,代码来源:JsonLogger.java


示例6: testMuleMaster

import org.mule.api.transport.PropertyScope; //导入依赖的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


示例7: transformMessage

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
public Object transformMessage(MuleMessage message, String enc) throws TransformerException
{
	String payload = message.getPayload(String.class);
	String[] lines = payload.split("\n");
	String path = null;
	String branch = null;
	for ( String line : lines )
	{
    	int p = line.indexOf("path=");
    	if ( p > -1 )
    	{
    		path = line.substring(p+5).trim();
    	}
    	else
    	{
    		int b = line.indexOf("branch=");
    		if ( b > - 1)
    		{
    			branch = line.substring(b+7).trim();
    		}
    	}
	}
	Map<String, Object> props = new HashMap<String, Object>();
	props.put("branch",branch); 
	props.put("path",path); 
	props.put("routing-key",branch+"."+path); 
	message.addProperties(props, PropertyScope.OUTBOUND);
	return "CommitEvent";
}
 
开发者ID:nikolajo,项目名称:ci-push,代码行数:30,代码来源:FileTransformer.java


示例8: comparePropertyValues

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
public boolean comparePropertyValues(MuleMessage left, MuleMessage right, Set<String> propertyNames, PropertyScope scope) {
	for (String propertyName : propertyNames) {
		if (left.getProperty(propertyName, scope) != right.getProperty(propertyName, scope)) {
			return false;
		}
	}
	return true;
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:9,代码来源:SamePropertiesMatcher.java


示例9: hasSamePropertiesThan

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
@Factory
public static <T> Matcher<MuleMessage> hasSamePropertiesThan(MuleMessage message) {
	List<Matcher<? super MuleMessage>> allScopeMatchers = new ArrayList<Matcher<? super MuleMessage>>(4);
	
	allScopeMatchers.add(new SamePropertiesMatcher(PropertyScope.INBOUND, message));
	allScopeMatchers.add(new SamePropertiesMatcher(PropertyScope.OUTBOUND, message));
	allScopeMatchers.add(new SamePropertiesMatcher(PropertyScope.INVOCATION, message));
	allScopeMatchers.add(new SamePropertiesMatcher(PropertyScope.SESSION, message));
	
	return new AllOf<MuleMessage>(allScopeMatchers);
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:12,代码来源:SamePropertiesMatcher.java


示例10: hasPropertyInAnyScope

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
@Factory
public static <T> Matcher<MuleMessage> hasPropertyInAnyScope(String key) {
	
	List<Matcher<? super MuleMessage>> allScopeMatchers = new ArrayList<Matcher<? super MuleMessage>>(4);

	allScopeMatchers.add(new PropertyMatcher(PropertyScope.INBOUND, key, IsNull.notNullValue()));
	allScopeMatchers.add(new PropertyMatcher(PropertyScope.OUTBOUND, key, IsNull.notNullValue()));
	allScopeMatchers.add(new PropertyMatcher(PropertyScope.INVOCATION, key, IsNull.notNullValue()));
	allScopeMatchers.add(new PropertyMatcher(PropertyScope.SESSION, key, IsNull.notNullValue()));
	
	return new AnyOf<MuleMessage>(allScopeMatchers);
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:13,代码来源:PropertyMatcher.java


示例11: doSetup

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
@Before
public void doSetup() throws Exception {
	message = new DefaultMuleMessage(null, muleContext);
   	new DefaultMuleEvent(message, MessageExchangePattern.ONE_WAY, getTestService());

   	message.setProperty("aPropertyKey", "aValue", PropertyScope.OUTBOUND);
   	message.setProperty("anInboundKey", "this is a Value", PropertyScope.INBOUND);
   	message.setProperty("anOutboundKey", "this is a Value", PropertyScope.OUTBOUND);
   	message.setProperty("anInvocationaKey", "aValue", PropertyScope.INVOCATION);
   	message.setProperty("aSessionKey", 3, PropertyScope.SESSION);
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:12,代码来源:PropertiesTestCase.java


示例12: testDescriptionAndMismatch

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
@Test
  public void testDescriptionAndMismatch() throws Exception
  {
PropertiesMatcher p = new PropertiesMatcher(PropertyScope.OUTBOUND, hasItem("anotherKey"));
DescriptionAssertor.assertDescription("a MuleMessage with property names for scope <outbound> a collection containing \"anotherKey\"", p);
DescriptionAssertor.assertMismatchDescription("was a MuleMessage with property names for scope <outbound> <[aKey]>", p, message);
  }
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:8,代码来源:PropertiesMatcherTestCase.java


示例13: doSetup

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
@Before
public void doSetup() throws Exception {
	message = new DefaultMuleMessage(null, muleContext);
	new DefaultMuleEvent(message, MessageExchangePattern.ONE_WAY, getTestService());
	
	message.setProperty("anInboundKey", "aValue", PropertyScope.INBOUND);
   	message.setProperty("anOutboundKey", "aValue", PropertyScope.OUTBOUND);
   	message.setProperty("anInvocationaKey", "aValue", PropertyScope.INVOCATION);
   	message.setProperty("aSessionKey", "aValue", PropertyScope.SESSION);
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:11,代码来源:PropertyMatcherTestCase.java


示例14: testDescriptionAndMismatch

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
@Test
  public void testDescriptionAndMismatch() throws Exception
  {
PropertyMatcher p = new PropertyMatcher(PropertyScope.OUTBOUND, "anOutboundKey", is("anOutboundKeyValue"));
DescriptionAssertor.assertDescription("a MuleMessage which property with key \"anOutboundKey\" in scope <outbound> is \"anOutboundKeyValue\"", p);
DescriptionAssertor.assertMismatchDescription("was a MuleMessage which property with key \"anOutboundKey\" in scope <outbound> has the value \"aValue\"", p, message);
  }
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:8,代码来源:PropertyMatcherTestCase.java


示例15: testStatusValidation

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
@Test(expected = IllegalStateException.class)
public void testStatusValidation() throws Exception {
    MuleEvent evt = getTestEvent("Some Message");
    MuleMessage msg = evt.getMessage();
    msg.setProperty("http.status", "400", PropertyScope.INBOUND);
    GoogleSearchModule.validateResponse(msg);
}
 
开发者ID:juancavallotti,项目名称:mule-module-google-custom-search,代码行数:8,代码来源:GoogleSearchModuleTest.java


示例16: testContentTypeValidation

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
@Test(expected = IllegalStateException.class)
public void testContentTypeValidation() throws Exception {
    MuleEvent evt = getTestEvent("Some Message");
    MuleMessage msg = evt.getMessage();
    msg.setProperty("http.status", "200", PropertyScope.INBOUND);
    msg.setProperty("Content-Type", "text/plain", PropertyScope.INBOUND);
    GoogleSearchModule.validateResponse(msg);
}
 
开发者ID:juancavallotti,项目名称:mule-module-google-custom-search,代码行数:9,代码来源:GoogleSearchModuleTest.java


示例17: PropertiesMatcher

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
PropertiesMatcher(PropertyScope scope, Matcher<?> matcher) {
	super();
	this.scope = scope;
	this.matcher = matcher;
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:6,代码来源:PropertiesMatcher.java


示例18: hasProperties

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
@Factory
public static <T> Matcher<MuleMessage> hasProperties(PropertyScope scope, T value) {
	return new PropertiesMatcher(scope, hasItem(value));
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:5,代码来源:PropertiesMatcher.java


示例19: SamePropertiesMatcher

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
SamePropertiesMatcher(PropertyScope scope, MuleMessage value) {
	super();
	this.scope = scope;
	this.value = value;
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:6,代码来源:SamePropertiesMatcher.java


示例20: comparePropertyNames

import org.mule.api.transport.PropertyScope; //导入依赖的package包/类
public Set<String> comparePropertyNames(MuleMessage left, MuleMessage right, PropertyScope scope) {
	Set<String> leftPropertyNames = left.getPropertyNames(scope);
	Set<String> rightPropertyNames = right.getPropertyNames(scope);
	return leftPropertyNames.equals(rightPropertyNames) ? leftPropertyNames : null;
}
 
开发者ID:vromero,项目名称:mule-module-hamcrest,代码行数:6,代码来源:SamePropertiesMatcher.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GraphicalEditorWithFlyoutPalette类代码示例发布时间:2022-05-22
下一篇:
Java XSSimpleType类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap