use of won.protocol.message.WonMessage in project webofneeds by researchstudio-sat.
the class ActivateNeedMessageReactionProcessor method process.
public void process(Exchange exchange) throws Exception {
Message message = exchange.getIn();
WonMessage wonMessage = (WonMessage) message.getHeader(WonCamelConstants.MESSAGE_HEADER);
URI receiverNeedURI = wonMessage.getReceiverNeedURI();
if (receiverNeedURI == null)
throw new IllegalArgumentException("receiverNeedURI is not set");
matcherProtocolMatcherClient.needActivated(receiverNeedURI, wonMessage);
}
use of won.protocol.message.WonMessage in project webofneeds by researchstudio-sat.
the class WonMessageSlipComputerTests method testCloseMessageFromNode.
@Test
public void testCloseMessageFromNode() 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_CLOSE_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.OWNER_FACET_STRING));
String slip = wonMessageSlipComputer.evaluate(exchange, String.class);
Assert.assertEquals("closeMessageFromNodeProcessor,closeFromNodeOwnerFacetImpl", slip);
}
use of won.protocol.message.WonMessage in project webofneeds by researchstudio-sat.
the class WonMessageSlipComputerTests method testDeactivateNeedMessageFromOwner.
@Test
public void testDeactivateNeedMessageFromOwner() 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_DEACTIVATE_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("deactivateNeedMessageProcessor", slip);
}
use of won.protocol.message.WonMessage in project webofneeds by researchstudio-sat.
the class WonMessageSlipComputerTests method testCloseMessageFromOwner.
@Test
public void testCloseMessageFromOwner() 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_CLOSE_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("closeMessageFromOwnerProcessor,closeFromOwnerOwnerFacetImpl", slip);
}
use of won.protocol.message.WonMessage in project webofneeds by researchstudio-sat.
the class WonMessageSlipComputerTests method testOpenMessageFromNode.
@Test
public void testOpenMessageFromNode() 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_EXTERNAL.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("openMessageFromNodeProcessor,openFromNodeOwnerFacetImpl", slip);
}
Aggregations