Search in sources :

Example 86 with WonMessage

use of won.protocol.message.WonMessage in project webofneeds by researchstudio-sat.

the class WonMessageSlipComputerTests method testSendMessageFromNodeGroupFacet.

@Test
public void testSendMessageFromNodeGroupFacet() throws Exception {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    exchange.getIn().setHeader(WonCamelConstants.MESSAGE_HEADER, new WonMessage(DatasetFactory.createGeneral()));
    exchange.getIn().setHeader(WonCamelConstants.MESSAGE_TYPE_HEADER, URI.create(WONMSG.TYPE_CONNECTION_MESSAGE_STRING));
    exchange.getIn().setHeader(WonCamelConstants.DIRECTION_HEADER, URI.create(WonMessageDirection.FROM_EXTERNAL.getResource().getURI().toString()));
    exchange.getIn().setHeader(WonCamelConstants.FACET_TYPE_HEADER, URI.create(WON.GROUP_FACET_STRING));
    String slip = wonMessageSlipComputer.evaluate(exchange, String.class);
    Assert.assertEquals("sendMessageFromNodeProcessor,sendMessageFromNodeGroupFacetImpl", slip);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) WonMessage(won.protocol.message.WonMessage) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 87 with WonMessage

use of won.protocol.message.WonMessage in project webofneeds by researchstudio-sat.

the class WonMessageSlipComputerTests method testActivateNeedMessage.

@Test
public void testActivateNeedMessage() throws Exception {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    exchange.getIn().setHeader(WonCamelConstants.MESSAGE_HEADER, new WonMessage(DatasetFactory.createGeneral()));
    exchange.getIn().setHeader(WonCamelConstants.MESSAGE_TYPE_HEADER, URI.create(WONMSG.TYPE_ACTIVATE_STRING));
    exchange.getIn().setHeader(WonCamelConstants.DIRECTION_HEADER, URI.create(WONMSG.TYPE_FROM_OWNER.getURI().toString()));
    exchange.getIn().setHeader(WonCamelConstants.FACET_TYPE_HEADER, URI.create(WON.OWNER_FACET_STRING));
    String slip = wonMessageSlipComputer.evaluate(exchange, String.class);
    Assert.assertEquals("activateNeedMessageProcessor", slip);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) WonMessage(won.protocol.message.WonMessage) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 88 with WonMessage

use of won.protocol.message.WonMessage in project webofneeds by researchstudio-sat.

the class WonMessageSlipComputerTests method testConnectMessageFromOwner.

@Test
public void testConnectMessageFromOwner() throws Exception {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    exchange.getIn().setHeader(WonCamelConstants.MESSAGE_HEADER, new WonMessage(DatasetFactory.createGeneral()));
    exchange.getIn().setHeader(WonCamelConstants.MESSAGE_TYPE_HEADER, URI.create(WONMSG.TYPE_CONNECT_STRING));
    exchange.getIn().setHeader(WonCamelConstants.DIRECTION_HEADER, URI.create(WonMessageDirection.FROM_OWNER.getResource().getURI().toString()));
    exchange.getIn().setHeader(WonCamelConstants.FACET_TYPE_HEADER, URI.create(WON.OWNER_FACET_STRING));
    String slip = wonMessageSlipComputer.evaluate(exchange, String.class);
    Assert.assertEquals("connectMessageFromOwnerProcessor,connectFromOwnerOwnerFacetImpl", slip);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) WonMessage(won.protocol.message.WonMessage) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Example 89 with WonMessage

use of won.protocol.message.WonMessage in project webofneeds by researchstudio-sat.

the class WonMessageSlipComputerTests method testOpenMessageFromOwner.

@Test
public void testOpenMessageFromOwner() throws Exception {
    Exchange exchange = new DefaultExchange(new DefaultCamelContext());
    exchange.getIn().setHeader(WonCamelConstants.MESSAGE_HEADER, new WonMessage(DatasetFactory.createGeneral()));
    exchange.getIn().setHeader(WonCamelConstants.MESSAGE_TYPE_HEADER, URI.create(WONMSG.TYPE_OPEN_STRING));
    exchange.getIn().setHeader(WonCamelConstants.DIRECTION_HEADER, URI.create(WonMessageDirection.FROM_OWNER.getResource().getURI().toString()));
    exchange.getIn().setHeader(WonCamelConstants.FACET_TYPE_HEADER, URI.create(WON.OWNER_FACET_STRING));
    String slip = wonMessageSlipComputer.evaluate(exchange, String.class);
    Assert.assertEquals("openMessageFromOwnerProcessor,openFromOwnerOwnerFacetImpl", slip);
}
Also used : DefaultExchange(org.apache.camel.impl.DefaultExchange) Exchange(org.apache.camel.Exchange) DefaultExchange(org.apache.camel.impl.DefaultExchange) WonMessage(won.protocol.message.WonMessage) DefaultCamelContext(org.apache.camel.impl.DefaultCamelContext) Test(org.junit.Test)

Aggregations

WonMessage (won.protocol.message.WonMessage)89 URI (java.net.URI)47 Connection (won.protocol.model.Connection)19 Test (org.junit.Test)18 Message (org.apache.camel.Message)17 Dataset (org.apache.jena.query.Dataset)17 Exchange (org.apache.camel.Exchange)13 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)13 DefaultExchange (org.apache.camel.impl.DefaultExchange)13 WonMessageProcessingException (won.protocol.message.processor.exception.WonMessageProcessingException)11 EventListenerContext (won.bot.framework.eventbot.EventListenerContext)10 MissingMessagePropertyException (won.protocol.message.processor.exception.MissingMessagePropertyException)9 Event (won.bot.framework.eventbot.event.Event)8 FailureResponseEvent (won.bot.framework.eventbot.event.impl.wonmessage.FailureResponseEvent)8 EventListener (won.bot.framework.eventbot.listener.EventListener)7 Need (won.protocol.model.Need)7 WonNodeInformationService (won.protocol.service.WonNodeInformationService)7 Model (org.apache.jena.rdf.model.Model)5 WonURI (won.bot.framework.eventbot.action.impl.mail.model.WonURI)5 DefaultNeedModelWrapper (won.protocol.util.DefaultNeedModelWrapper)4