/**
  * Test use of the SimpleDB queue, and with explicitly received message.
  * This tests the manual receive, and that the sent message comes back to us
  * just the way it was sent.
  */
 function testMessageSimpleDBExplicitReceive()
 {
     // save and disable force immediate, we are testing whether stuff gets queued.
     $old = MessageQueue::get_force_immediate_delivery();
     MessageQueue::set_force_immediate_delivery(false);
     MessageQueue::add_interface("default", array("queues" => "/.*/", "implementation" => "SimpleDBMQ", "encoding" => "php_serialize", "send" => array("onShutdown" => "none"), "delivery" => array("onerror" => array("log", "requeue"))));
     $this->assertTrue($this->getQueueSizeSimpleDB("testqueue") == 0, "Queue is empty before we put anything in it");
     MessageQueue::send("testqueue", new MethodInvocationMessage("MessageQueueTest", "doStaticMethod", "p1", 2));
     // check message in queue
     $this->assertTrue($this->getQueueSizeSimpleDB("testqueue") == 1, "Queue has an item after we add to it");
     // get message
     $msgs = MessageQueue::get_messages("testqueue");
     $this->assertTrue($msgs != null, "Got a set");
     $this->assertTrue($msgs->Count() == 1, "Got one message");
     $msg = $msgs->First();
     $this->assertTrue($msg instanceof MessageFrame, "Message is a frame");
     $this->assertTrue($msg->body instanceof MethodInvocationMessage, "Got a method invocation message");
     $this->assertTrue($msg->body->objectOrClass == "MessageQueueTest" && $msg->body->method == "doStaticMethod", "Got the original message");
     MessageQueue::set_force_immediate_delivery($old);
 }