Package net.pterodactylus.sone.freenet.fcp.Command

Examples of net.pterodactylus.sone.freenet.fcp.Command.Response


    when(core.getSone(eq("LocalSone"))).thenReturn(Optional.of(localSone));
    when(core.getLocalSone(eq("LocalSone"), anyBoolean())).thenReturn(localSone);
    SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "LocalSone").get();

    LockSoneCommand lockSoneCommand = new LockSoneCommand(core);
    Response response = lockSoneCommand.execute(fields, null, null);

    verify(core).lockSone(eq(localSone));
    assertThat(response, notNullValue());
    assertThat(response.getReplyParameters(), notNullValue());
    assertThat(response.getReplyParameters().get("Message"), is("SoneLocked"));
    assertThat(response.getReplyParameters().get("Sone"), is("LocalSone"));
  }
View Full Code Here


    when(core.getSone(eq("LocalSone"))).thenReturn(Optional.of(localSone));
    when(core.getLocalSone(eq("LocalSone"), anyBoolean())).thenReturn(localSone);
    SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "LocalSone").get();

    UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);
    Response response = unlockSoneCommand.execute(fields, null, null);

    verify(core).unlockSone(eq(localSone));
    assertThat(response, notNullValue());
    assertThat(response.getReplyParameters(), notNullValue());
    assertThat(response.getReplyParameters().get("Message"), is("SoneUnlocked"));
    assertThat(response.getReplyParameters().get("Sone"), is("LocalSone"));
  }
View Full Code Here

      if ((identifier == null) || (identifier.length() == 0)) {
        sendReply(pluginReplySender, null, new ErrorResponse("Missing Identifier."));
        return;
      }
      try {
        Response response = command.execute(parameters, data, AccessType.values()[accessType]);
        sendReply(pluginReplySender, identifier, response);
      } catch (Exception e1) {
        logger.log(Level.WARNING, "Could not process FCP command ā€œ%sā€.", command);
        sendReply(pluginReplySender, identifier, new ErrorResponse("Error executing command: " + e1.getMessage()));
      }
View Full Code Here

TOP

Related Classes of net.pterodactylus.sone.freenet.fcp.Command.Response

Copyright © 2018 www.massapicom. 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.