Examples of CommandCallback


Examples of org.axonframework.commandhandling.CommandCallback

    }

    @Test
    public void testCommandHandlerCreatesAggregateInstance() {

        final CommandCallback callback = mock(CommandCallback.class);
        commandBus.dispatch(GenericCommandMessage.asCommandMessage(new CreateCommand("id", "Hi")), callback);
        verify(mockRepository).add(isA(StubCommandAnnotatedAggregate.class));
        // make sure the identifier was invoked in the callback
        verify(callback).onSuccess("id");
    }
View Full Code Here

Examples of org.axonframework.commandhandling.CommandCallback

    @Test(timeout = 2000)
    public void testCreateGateway_WaitForResultAndInvokeCallbacks_Success() {
        CountDownLatch cdl = new CountDownLatch(1);

        final CommandCallback callback1 = mock(CommandCallback.class);
        final CommandCallback callback2 = mock(CommandCallback.class);

        doAnswer(new Success(cdl, "OK"))
                .when(mockCommandBus).dispatch(isA(CommandMessage.class), isA(CommandCallback.class));

        Object result = gateway.fireAndWaitAndInvokeCallbacks("Command", callback1, callback2);
View Full Code Here

Examples of org.axonframework.commandhandling.CommandCallback

    }


    @Test(timeout = 2000)
    public void testCreateGateway_WaitForResultAndInvokeCallbacks_Failure() {
        final CommandCallback callback1 = mock(CommandCallback.class);
        final CommandCallback callback2 = mock(CommandCallback.class);

        final RuntimeException exception = new RuntimeException();
        doAnswer(new Failure(exception))
                .when(mockCommandBus).dispatch(isA(CommandMessage.class), isA(CommandCallback.class));
        try {
View Full Code Here

Examples of org.axonframework.commandhandling.CommandCallback

    @Test(timeout = 2000)
    public void testCreateGateway_AsyncWithCallbacks_Success() {
        CountDownLatch cdl = new CountDownLatch(1);

        final CommandCallback callback1 = mock(CommandCallback.class);
        final CommandCallback callback2 = mock(CommandCallback.class);

        doAnswer(new Success(cdl, "OK"))
                .when(mockCommandBus).dispatch(isA(CommandMessage.class), isA(CommandCallback.class));

        gateway.fireAsyncWithCallbacks("Command", callback1, callback2);
View Full Code Here

Examples of org.axonframework.commandhandling.CommandCallback

    @Test(timeout = 2000)
    public void testCreateGateway_AsyncWithCallbacks_Success_ButReturnTypeDoesntMatchCallback() {
        CountDownLatch cdl = new CountDownLatch(1);

        final CommandCallback callback1 = mock(CommandCallback.class);
        final CommandCallback callback2 = mock(CommandCallback.class);

        doAnswer(new Success(cdl, 42))
                .when(mockCommandBus).dispatch(isA(CommandMessage.class), isA(CommandCallback.class));

        gateway.fireAsyncWithCallbacks("Command", callback1, callback2);
View Full Code Here

Examples of org.axonframework.commandhandling.CommandCallback

        verify(callback, never()).onSuccess(anyObject());
    }

    @Test(timeout = 2000)
    public void testCreateGateway_AsyncWithCallbacks_Failure() {
        final CommandCallback callback1 = mock(CommandCallback.class);
        final CommandCallback callback2 = mock(CommandCallback.class);

        final RuntimeException exception = new RuntimeException();
        doAnswer(new Failure(exception))
                .when(mockCommandBus).dispatch(isA(CommandMessage.class), isA(CommandCallback.class));
View Full Code Here

Examples of org.eclipse.jface.action.ExternalActionManager.CommandCallback

   * Establishes the relationship between JFace actions and the command
   * manager.
   */
  private void initializeCommandResolver() {
    ExternalActionManager.getInstance().setCallback(
        new CommandCallback(bindingManager, commandManager,
            new IActiveChecker() {
              public final boolean isActive(final String commandId) {
                return workbenchActivitySupport
                    .getActivityManager().getIdentifier(
                        commandId).isEnabled();
View Full Code Here

Examples of org.geomajas.gwt.client.command.CommandCallback

    GwtCommand commandRequest = new GwtCommand(RasterizeMapRequest.COMMAND);
    RasterizeMapRequest request = new RasterizeMapRequest();
    request.setClientMapInfo(map.getMapModel().getMapInfo());
    commandRequest.setCommandRequest(request);
    final ImageUrlCallback callBack = imageCallBack;
    GwtCommandDispatcher.getInstance().execute(commandRequest, new CommandCallback() {

      public void execute(CommandResponse commandResponse) {
        if (commandResponse instanceof RasterizeMapResponse) {
          RasterizeMapResponse rasterizeMapResponse = (RasterizeMapResponse) commandResponse;
          callBack.onImageUrl(toUrl(rasterizeMapResponse.getMapKey()),
View Full Code Here

Examples of org.geomajas.gwt.client.command.CommandCallback

      exportRequest.setQuoteChar(messages.exportToCsvQuoteChar());
      exportRequest.setLayerId(layer.getServerLayerId());

      GwtCommand command = new GwtCommand(ExportToCsvRequest.COMMAND);
      command.setCommandRequest(exportRequest);
      Deferred deferred = GwtCommandDispatcher.getInstance().execute(command, new CommandCallback() {
        private static final String CONTENT_PRE = "<div style='margin-top: 20px; width: 200px; text-align: "
            + "center'><b>";
        private static final String CONTENT_POST = "</b><br />";
        private static final String LINK_POST = "</div>";
View Full Code Here

Examples of org.geomajas.gwt.client.command.CommandCallback

    getMapButton.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        GwtCommand commandRequest = new GwtCommand(GetMapConfigurationRequest.COMMAND);
        commandRequest.setCommandRequest(new GetMapConfigurationRequest("mapOsm", "gwt-samples"));
        GwtCommandDispatcher.getInstance().execute(commandRequest, new CommandCallback() {

          public void execute(CommandResponse response) {
            SC.say("Command executed successfully");
          }
        });
      }
    });
    commandLayout.addMember(getMapButton);

    // Create a button that calls the GetMapConfigurationCommand:
    IButton getResourcesButton = new IButton("command.GetResources");
    getResourcesButton.setWidth(150);
    getResourcesButton.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        GetResourcesRequest request = new GetResourcesRequest(
            new String[] { "WEB-INF/security.xml" });
        GwtCommand command = new GwtCommand("example.gwt.server.samples.GetSourceCommand");
        command.setCommandRequest(request);
        GwtCommandDispatcher.getInstance().execute(command, new CommandCallback() {

          public void execute(CommandResponse response) {
            // User mark should never get here...
            SC.say("Command executed successfully");
          }
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.