Examples of TestHandler


Examples of com.sun.jini.test.spec.url.httpmd.util.TestHandler

        for (int i = 0; i < tc_names.length; i++) {
            items.add(i, new TestItem(tc_names[i]));
        }

        /* Creating TestHandler object */
        handler = new TestHandler();
    }
View Full Code Here

Examples of org.apache.thrift.server.ServerTestBase.TestHandler

        port = Integer.valueOf(args[0]);
      }
      //@TODO add other protocol and transport types

      // Processor
      TestHandler testHandler =
        new TestHandler();
      ThriftTest.Processor testProcessor =
        new ThriftTest.Processor(testHandler);

      // Transport
      TServerSocket tServerSocket =
View Full Code Here

Examples of org.apache.thrift.server.ServerTestBase.TestHandler

               
                //Output
                TMemoryBuffer outbuffer = new TMemoryBuffer(100);          
                TProtocol outprotocol   = new TJSONProtocol(outbuffer);
               
                TProcessor processor = new ThriftTest.Processor(new TestHandler());     
                processor.process(inprotocol, outprotocol);
               
                byte[] output = new byte[outbuffer.length()];
                outbuffer.readAll(output, 0, output.length);
           
View Full Code Here

Examples of org.jboss.serial.data.proxy.TestHandler

        assertEquals(2,proxyClass.doSomething());

        Class proxyClazz = Proxy.getProxyClass(Thread.currentThread().getContextClassLoader(),new Class[]{InterfaceForProxy.class});
        System.out.println(proxyClazz);

        InterfaceForProxy proxy = (InterfaceForProxy) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),new Class[]{InterfaceForProxy.class},new TestHandler(3,proxyClass));
        return proxy;
    }
View Full Code Here

Examples of org.jboss.test.remoting.socketfactory.CreationListenerTestRoot.TestHandler

      locatorURI = "socket://" + host + ":" + port;
      InvokerLocator locator = new InvokerLocator(locatorURI);
      HashMap serverConfig = new HashMap();
      connector = new Connector(locator, serverConfig);
      connector.create();
      connector.addInvocationHandler("test", new TestHandler());
      connector.start();
     
      HashMap clientConfig = new HashMap();
      clientConfig.put(InvokerLocator.FORCE_REMOTE, "true");
      client = new Client(locator, clientConfig);
View Full Code Here

Examples of org.locationtech.udig.tools.edit.support.TestHandler

    }

    @Test
    public void testRunCommands() throws Exception {
        TestHandler handler=new TestHandler();
        ((RenderManager)handler.getContext().getRenderManager()).setMapDisplay(new TestViewportPane(new Dimension(500,500)));
        handler.getTestEditBlackboard().util.setVertexRadius(4);
       
        StartHoleCuttingBehaviour behavior=new StartHoleCuttingBehaviour();
        MapMouseEvent event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);

        try {
            behavior.getCommand(handler,event, EventType.RELEASED );
            fail();
        } catch (Exception e) {
            // good
        }
       
        handler.setCurrentState(EditState.MODIFYING);

        EditGeom editGeom = handler.getEditBlackboard().getGeoms().get(0);
        handler.setCurrentShape(editGeom.getShell());

        handler.getEditBlackboard().addPoint(0,0, handler.getCurrentShape());
        handler.getEditBlackboard().addPoint(100,0, handler.getCurrentShape());
        handler.getEditBlackboard().addPoint(100,100, handler.getCurrentShape());
        handler.getEditBlackboard().addPoint(0,100, handler.getCurrentShape());
        handler.getEditBlackboard().addPoint(0,0, handler.getCurrentShape());
       
        UndoableMapCommand command = behavior.getCommand(handler, event, EventType.RELEASED);
       
        command.setMap((Map) handler.getContext().getMap());
        if (command instanceof PostDeterminedEffectCommand) {
            PostDeterminedEffectCommand c = (PostDeterminedEffectCommand) command;
            c.execute(new NullProgressMonitor());
        }else{
            command.run(new NullProgressMonitor());
        }
       
        assertEquals("Current shape should equal new hole", editGeom.getHoles().get(0), handler.getCurrentShape()); //$NON-NLS-1$
        assertEquals("A point should have been added to hole", Point.valueOf(10,10), handler.getCurrentShape().getPoint(0)); //$NON-NLS-1$
        assertEquals( EditState.CREATING, handler.getCurrentState());
       
        command.rollback(new NullProgressMonitor());

        assertEquals( editGeom.getShell(), handler.getCurrentShape());
        assertEquals(0, editGeom.getHoles().size());
        assertEquals( EditState.MODIFYING, handler.getCurrentState());
       
    }
View Full Code Here

Examples of org.locationtech.udig.tools.edit.support.TestHandler

      resource.modifyFeatures(defaultGeometry, fac.createPoint(c),
                    filterFactory.id(ids));
        }
        ((EditManager)map.getEditManager()).commitTransaction();

        handler=new TestHandler();
        ((ToolContext)handler.getContext()).setMapInternal(map);
        ((ToolContext)handler.getContext()).setRenderManagerInternal(map.getRenderManagerInternal());
    }
View Full Code Here

Examples of org.locationtech.udig.tools.edit.support.TestHandler

    private TestHandler handler;
    private PrimitiveShape shell;
   
    @Before
    public void setUp() throws Exception {
        handler = new TestHandler();
        shell = handler.getEditBlackboard().getGeoms().get(0).getShell();
        handler.getEditBlackboard().addPoint(0, 10, shell);
        handler.getEditBlackboard().addPoint(20, 10, shell);
        handler.getEditBlackboard().addPoint(20, 20, shell);
        handler.getEditBlackboard().addPoint(10, 20, shell);
View Full Code Here

Examples of org.locationtech.udig.tools.edit.support.TestHandler

    private MoveGeometryBehaviour moveGeometryBehaviour;
    private TestHandler handler;

    @Before
    public void setUp() throws Exception {
        handler = new TestHandler();
        moveGeometryBehaviour = new MoveGeometryBehaviour();
        handler.getBehaviours().add(moveGeometryBehaviour);
        PrimitiveShape shell = handler.getEditBlackboard().getGeoms().get(0).getShell();
        handler.getEditBlackboard().addPoint(0, 0, shell);
        handler.getEditBlackboard().addPoint(50, 0, shell);
View Full Code Here

Examples of org.locationtech.udig.tools.edit.support.TestHandler

    /*
     * Test method for 'org.locationtech.udig.tools.edit.behaviour.StartEditingBehaviour.isValid(EditToolHandler, MapMouseEvent, EventType)'
     */
    @Test
    public void testIsValid() throws Exception {
        TestHandler handler=new TestHandler();
        handler.getTestEditBlackboard().util.setVertexRadius(4);
       
        AcceptWhenOverFirstVertexBehaviour behavior=new AcceptWhenOverFirstVertexBehaviour();

        handler.setCurrentState(EditState.CREATING);

        //Current Shape must be set
        MapMouseEvent event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertFalse(behavior.isValid(handler, event, EventType.RELEASED));
       
        EditGeom editGeom = handler.getEditBlackboard().getGeoms().get(0);
        handler.setCurrentShape(editGeom.getShell());
        handler.getEditBlackboard().addPoint(11,11, handler.getCurrentShape());
       
        event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertTrue(behavior.isValid(handler, event, EventType.RELEASED));
        // no buttons should be down
        event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.BUTTON2, MapMouseEvent.BUTTON1);
        assertFalse(behavior.isValid(handler, event, EventType.RELEASED));
        // button2 isn't legal
        event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON2);
        assertFalse(behavior.isValid(handler, event, EventType.RELEASED));

        // no modifiers only
        event = new MapMouseEvent(null, 10,10, MapMouseEvent.ALT_DOWN_MASK, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertFalse(behavior.isValid(handler, event, EventType.RELEASED));

        // works only with CREATING
        handler.setCurrentState(EditState.MODIFYING);
        event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertFalse(behavior.isValid(handler, event, EventType.RELEASED));
       
        // works only with CREATING
        handler.setCurrentState(EditState.NONE);
        event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertFalse(behavior.isValid(handler, event, EventType.RELEASED));
       
        // should work, just checking state is still good;
        handler.setCurrentState(EditState.CREATING);
        event = new MapMouseEvent(null, 10,10, MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertTrue(behavior.isValid(handler, event, EventType.RELEASED));
       
        // doesn't work with event pressed
        assertFalse(behavior.isValid(handler, event, EventType.PRESSED));

        // not valid if not over first point
        event = new MapMouseEvent(null, 20,10, MapMouseEvent.NONE, MapMouseEvent.NONE, MapMouseEvent.BUTTON1);
        assertFalse(behavior.isValid(handler, event, EventType.RELEASED));
      
        // not valid if over a different vertex (IE not 1st vertex
        handler.getEditBlackboard().addPoint(20,10, handler.getCurrentShape());
        assertFalse(behavior.isValid(handler, event, EventType.RELEASED));
       
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.