Search in sources :

Example 1 with ActionRegistry

use of com.canoo.dp.impl.server.legacy.communication.ActionRegistry in project dolphin-platform by canoo.

the class DolphinServerActionTests method setUp.

@BeforeMethod
protected void setUp() throws Exception {
    action = new DolphinServerAction() {

        @Override
        public void registerIn(ActionRegistry registry) {
        }
    };
    action.setDolphinResponse(new ArrayList());
}
Also used : ArrayList(java.util.ArrayList) ActionRegistry(com.canoo.dp.impl.server.legacy.communication.ActionRegistry) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with ActionRegistry

use of com.canoo.dp.impl.server.legacy.communication.ActionRegistry in project dolphin-platform by canoo.

the class StoreAttributeActionTests method setUp.

@BeforeMethod
public void setUp() throws Exception {
    serverModelStore = new ServerModelStore();
    serverModelStore.setCurrentResponse(new ArrayList<Command>());
    registry = new ActionRegistry();
}
Also used : Command(com.canoo.dp.impl.remoting.legacy.communication.Command) ChangeAttributeMetadataCommand(com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand) ServerModelStore(com.canoo.dp.impl.server.legacy.ServerModelStore) ActionRegistry(com.canoo.dp.impl.server.legacy.communication.ActionRegistry) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 3 with ActionRegistry

use of com.canoo.dp.impl.server.legacy.communication.ActionRegistry in project dolphin-platform by canoo.

the class TestDolphinCommandHandler method testInvocation.

@Test
public void testInvocation() throws Exception {
    // Given:
    final DolphinTestConfiguration configuration = createDolphinTestConfiguration();
    final ServerModelStore serverModelStore = configuration.getServerModelStore();
    final ClientModelStore clientModelStore = configuration.getClientModelStore();
    final DolphinCommandHandler dolphinCommandHandler = new DolphinCommandHandler(configuration.getClientConnector());
    final String modelId = UUID.randomUUID().toString();
    clientModelStore.createModel(modelId, null, new ClientAttribute("myAttribute", "UNKNOWN"));
    configuration.getServerConnector().register(new DolphinServerAction() {

        @Override
        public void registerIn(ActionRegistry registry) {
            registry.register(TestChangeCommand.class, new CommandHandler() {

                @Override
                public void handleCommand(Command command, List response) {
                    serverModelStore.findPresentationModelById(modelId).getAttribute("myAttribute").setValue("Hello World");
                }
            });
        }
    });
    // When:
    dolphinCommandHandler.invokeDolphinCommand(new TestChangeCommand()).get();
    // Then:
    assertEquals(clientModelStore.findPresentationModelById(modelId).getAttribute("myAttribute").getValue(), "Hello World");
}
Also used : ClientAttribute(com.canoo.dp.impl.client.legacy.ClientAttribute) ServerModelStore(com.canoo.dp.impl.server.legacy.ServerModelStore) CommandHandler(com.canoo.dp.impl.server.legacy.communication.CommandHandler) DolphinCommandHandler(com.canoo.dp.impl.client.DolphinCommandHandler) ActionRegistry(com.canoo.dp.impl.server.legacy.communication.ActionRegistry) DolphinCommandHandler(com.canoo.dp.impl.client.DolphinCommandHandler) Command(com.canoo.dp.impl.remoting.legacy.communication.Command) List(java.util.List) ClientModelStore(com.canoo.dp.impl.client.legacy.ClientModelStore) DolphinServerAction(com.canoo.dp.impl.server.legacy.action.DolphinServerAction) Test(org.testng.annotations.Test) AbstractDolphinBasedTest(com.canoo.dolphin.client.util.AbstractDolphinBasedTest)

Aggregations

ActionRegistry (com.canoo.dp.impl.server.legacy.communication.ActionRegistry)3 Command (com.canoo.dp.impl.remoting.legacy.communication.Command)2 ServerModelStore (com.canoo.dp.impl.server.legacy.ServerModelStore)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 AbstractDolphinBasedTest (com.canoo.dolphin.client.util.AbstractDolphinBasedTest)1 DolphinCommandHandler (com.canoo.dp.impl.client.DolphinCommandHandler)1 ClientAttribute (com.canoo.dp.impl.client.legacy.ClientAttribute)1 ClientModelStore (com.canoo.dp.impl.client.legacy.ClientModelStore)1 ChangeAttributeMetadataCommand (com.canoo.dp.impl.remoting.legacy.communication.ChangeAttributeMetadataCommand)1 DolphinServerAction (com.canoo.dp.impl.server.legacy.action.DolphinServerAction)1 CommandHandler (com.canoo.dp.impl.server.legacy.communication.CommandHandler)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Test (org.testng.annotations.Test)1