Exemplo n.º 1
0
  @Test
  public void info() {
    res = vrouter.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    assertTrue(vrouter.getName().equals(name));
  }
Exemplo n.º 2
0
  @Test
  public void attributes() {
    res = vrouter.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    assertTrue(vrouter.xpath("NAME").equals(name));
  }
Exemplo n.º 3
0
  @Test
  public void publish() {
    res = vrouter.publish();
    assertTrue(res.getErrorMessage(), !res.isError());

    vrouter.info();
    assertTrue(vrouter.xpath("PERMISSIONS/GROUP_U").equals("1"));
  }
Exemplo n.º 4
0
  @Test
  public void delete() {
    res = vrouter.delete();
    assertTrue(res.getErrorMessage(), !res.isError());

    res = vrouter.info();
    assertTrue(res.isError());
  }
Exemplo n.º 5
0
  @Test
  public void chmod_octet() {
    res = vrouter.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    res = vrouter.chmod(640);
    assertTrue(res.getErrorMessage(), !res.isError());

    res = vrouter.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    assertTrue(vrouter.xpath("PERMISSIONS/OWNER_U").equals("1"));
    assertTrue(vrouter.xpath("PERMISSIONS/OWNER_M").equals("1"));
    assertTrue(vrouter.xpath("PERMISSIONS/OWNER_A").equals("0"));
    assertTrue(vrouter.xpath("PERMISSIONS/GROUP_U").equals("1"));
    assertTrue(vrouter.xpath("PERMISSIONS/GROUP_M").equals("0"));
    assertTrue(vrouter.xpath("PERMISSIONS/GROUP_A").equals("0"));
    assertTrue(vrouter.xpath("PERMISSIONS/OTHER_U").equals("0"));
    assertTrue(vrouter.xpath("PERMISSIONS/OTHER_M").equals("0"));
    assertTrue(vrouter.xpath("PERMISSIONS/OTHER_A").equals("0"));

    res = vrouter.chmod("147");
    assertTrue(res.getErrorMessage(), !res.isError());

    res = vrouter.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    assertTrue(vrouter.xpath("PERMISSIONS/OWNER_U").equals("0"));
    assertTrue(vrouter.xpath("PERMISSIONS/OWNER_M").equals("0"));
    assertTrue(vrouter.xpath("PERMISSIONS/OWNER_A").equals("1"));
    assertTrue(vrouter.xpath("PERMISSIONS/GROUP_U").equals("1"));
    assertTrue(vrouter.xpath("PERMISSIONS/GROUP_M").equals("0"));
    assertTrue(vrouter.xpath("PERMISSIONS/GROUP_A").equals("0"));
    assertTrue(vrouter.xpath("PERMISSIONS/OTHER_U").equals("1"));
    assertTrue(vrouter.xpath("PERMISSIONS/OTHER_M").equals("1"));
    assertTrue(vrouter.xpath("PERMISSIONS/OTHER_A").equals("1"));
  }
Exemplo n.º 6
0
  @Test
  public void chown() {
    // Create a new User and Group
    res = User.allocate(client, "template_test_user", "password");
    assertTrue(res.getErrorMessage(), !res.isError());

    int uid = Integer.parseInt(res.getMessage());

    res = Group.allocate(client, "template_test_group");
    assertTrue(res.getErrorMessage(), !res.isError());

    int gid = Integer.parseInt(res.getMessage());

    res = vrouter.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    assertTrue(vrouter.uid() == 0);
    assertTrue(vrouter.gid() == 0);

    res = vrouter.chown(uid, gid);
    assertTrue(res.getErrorMessage(), !res.isError());

    res = vrouter.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    assertTrue(vrouter.uid() == uid);
    assertTrue(vrouter.gid() == gid);

    res = vrouter.chgrp(0);

    res = vrouter.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    assertTrue(vrouter.uid() == uid);
    assertTrue(vrouter.gid() == 0);
  }
Exemplo n.º 7
0
  @Test
  public void chmod() {
    res = vrouter.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    String owner_a = vrouter.xpath("PERMISSIONS/OWNER_A");
    String group_a = vrouter.xpath("PERMISSIONS/GROUP_A");

    res = vrouter.chmod(0, 1, -1, 1, 0, -1, 1, 1, 0);
    assertTrue(res.getErrorMessage(), !res.isError());

    res = vrouter.info();
    assertTrue(res.getErrorMessage(), !res.isError());

    assertTrue(vrouter.xpath("PERMISSIONS/OWNER_U").equals("0"));
    assertTrue(vrouter.xpath("PERMISSIONS/OWNER_M").equals("1"));
    assertTrue(vrouter.xpath("PERMISSIONS/OWNER_A").equals(owner_a));
    assertTrue(vrouter.xpath("PERMISSIONS/GROUP_U").equals("1"));
    assertTrue(vrouter.xpath("PERMISSIONS/GROUP_M").equals("0"));
    assertTrue(vrouter.xpath("PERMISSIONS/GROUP_A").equals(group_a));
    assertTrue(vrouter.xpath("PERMISSIONS/OTHER_U").equals("1"));
    assertTrue(vrouter.xpath("PERMISSIONS/OTHER_M").equals("1"));
    assertTrue(vrouter.xpath("PERMISSIONS/OTHER_A").equals("0"));
  }