@Test
  public void testRolesInLonerVM() {
    final String rolesProp = "A,B,C,D,E,F,G";
    final String[] rolesArray = new String[] {"A", "B", "C", "D", "E", "F", "G"};

    distributionProperties = new Properties();
    distributionProperties.setProperty(MCAST_PORT, "0");
    distributionProperties.setProperty(LOCATORS, "");
    distributionProperties.setProperty(ROLES, rolesProp);

    InternalDistributedSystem system = getSystem(distributionProperties);
    try {
      DistributionManager dm = system.getDistributionManager();
      Set allRoles = dm.getAllRoles();
      assertEquals(rolesArray.length, allRoles.size());

      InternalDistributedMember member = dm.getDistributionManagerId();
      Set roles = member.getRoles();
      assertEquals(rolesArray.length, roles.size());

      Role roleA = InternalRole.getRole("roleA");
      assertEquals(false, roleA.isPresent());
      assertEquals(0, roleA.getCount());

      for (final Object o : roles) {
        Role role = (Role) o;
        assertEquals(true, role.isPresent());
        assertEquals(1, role.getCount());
      }
    } finally {
      system.disconnect();
    }
  }
Tests usage of Roles in a Loner vm.
geode-core/src/distributedTest/java/org/apache/geode/distributed/RoleDUnitTest.java