Project: engagement_generation License: BSD Dependencies:
Used by:
None |
engagement_generation/test/edu/wpi/hri/gen/policy/HIMFGPolicyTest.javaGo to the documentation of this file.00001 package edu.wpi.hri.gen.policy; 00002 00003 import junit.framework.TestCase; 00004 00005 import org.junit.Test; 00006 00007 import ros.NodeHandle; 00008 import ros.Ros; 00009 import ros.RosException; 00010 import ros.pkg.engagement_msgs.msg.HumanMutualFacialGaze; 00011 import edu.wpi.hri.bml.XMLInterface; 00012 import edu.wpi.hri.comm.MasterSpinner; 00013 import edu.wpi.hri.gen.Generation; 00014 import edu.wpi.hri.gen.comm.BMLRealizer; 00015 import edu.wpi.hri.gen.comm.GazeKnowledge; 00016 import edu.wpi.hri.log.Logger; 00017 00018 public class HIMFGPolicyTest extends TestCase { 00019 00020 private boolean called = false; 00021 00022 @Test 00023 public void testPolicy() throws RosException { 00024 Logger logger = Logger.createDefault(); 00025 XMLInterface xml = Generation.createXML(logger); 00026 NodeHandle handle = Ros.getInstance().createNodeHandle(); 00027 MasterSpinner spin = new MasterSpinner(logger, false); 00028 BMLRealizer realizer = new BMLRealizer(handle, spin, logger); 00029 GazeKnowledge gaze = new GazeKnowledge(handle, logger, xml, realizer) { 00030 @Override 00031 public boolean trySetGaze(String target) { 00032 called = true; 00033 return true; 00034 } 00035 }; 00036 HIMFGPolicy policy = new HIMFGPolicy(handle, logger, gaze, gaze); 00037 00038 assertFalse(called); 00039 HumanMutualFacialGaze mfgrequest = new HumanMutualFacialGaze(); 00040 mfgrequest.timeout = 0; 00041 mfgrequest.actor.id = "actor-test"; 00042 policy.call(mfgrequest); 00043 assertTrue(called); 00044 00045 policy.shutdown(); 00046 gaze.shutdown(); 00047 realizer.shutdown(); 00048 spin.stop(); 00049 spin.joinOldMasters(); 00050 handle.shutdown(); 00051 } 00052 00053 } |