Package net.pterodactylus.sone.freenet

Examples of net.pterodactylus.sone.freenet.SimpleFieldSetBuilder


     * Returns the reply parameters.
     *
     * @return The reply parameters
     */
    public SimpleFieldSet getReplyParameters() {
      return new SimpleFieldSetBuilder(replyParameters).put("Message", messageName).get();
    }
View Full Code Here


     *
     * @param message
     *            The error message
     */
    public ErrorResponse(String message) {
      super("Error", new SimpleFieldSetBuilder().put("ErrorMessage", message).get());
    }
View Full Code Here

     *            The error code
     * @param message
     *            The error message
     */
    public ErrorResponse(int code, String message) {
      super("Error", new SimpleFieldSetBuilder().put("ErrorMessage", message).put("ErrorCode", code).get());
    }
View Full Code Here

    when(localSone.getId()).thenReturn("LocalSone");
    when(localSone.isLocal()).thenReturn(true);
    Core core = mock(Core.class);
    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));
View Full Code Here

  @Test(expected = FcpException.class)
  public void testLockingARemoteSone() throws FcpException {
    Sone removeSone = mock(Sone.class);
    Core core = mock(Core.class);
    when(core.getSone(eq("RemoteSone"))).thenReturn(Optional.of(removeSone));
    SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "RemoteSone").get();

    LockSoneCommand lockSoneCommand = new LockSoneCommand(core);
    lockSoneCommand.execute(fields, null, null);
  }
View Full Code Here

  }

  @Test(expected = FcpException.class)
  public void testMissingSone() throws FcpException {
    Core core = mock(Core.class);
    SimpleFieldSet fields = new SimpleFieldSetBuilder().get();

    LockSoneCommand lockSoneCommand = new LockSoneCommand(core);
    lockSoneCommand.execute(fields, null, null);
  }
View Full Code Here

    when(localSone.getId()).thenReturn("LocalSone");
    when(localSone.isLocal()).thenReturn(true);
    Core core = mock(Core.class);
    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));
View Full Code Here

  @Test(expected = FcpException.class)
  public void testUnlockingARemoteSone() throws FcpException {
    Sone removeSone = mock(Sone.class);
    Core core = mock(Core.class);
    when(core.getSone(eq("RemoteSone"))).thenReturn(Optional.of(removeSone));
    SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "RemoteSone").get();

    UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);
    unlockSoneCommand.execute(fields, null, null);
  }
View Full Code Here

  }

  @Test(expected = FcpException.class)
  public void testMissingSone() throws FcpException {
    Core core = mock(Core.class);
    SimpleFieldSet fields = new SimpleFieldSetBuilder().get();

    UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);
    unlockSoneCommand.execute(fields, null, null);
  }
View Full Code Here

  @Override
  public Response execute(SimpleFieldSet parameters, Bucket data, AccessType accessType) throws FcpException {
    Post post = getPost(parameters, "Post");
    Sone sone = getSone(parameters, "Sone", true);
    sone.addLikedPostId(post.getId());
    return new Response("PostLiked", new SimpleFieldSetBuilder().put("LikeCount", getCore().getLikes(post).size()).get());
  }
View Full Code Here

TOP

Related Classes of net.pterodactylus.sone.freenet.SimpleFieldSetBuilder

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.