Example usage for java.util Set toString

List of usage examples for java.util Set toString

Introduction

In this page you can find the example usage for java.util Set toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:io.cloudslang.lang.compiler.modeller.transformers.AbstractTransformer.java

protected void validateKeySet(Set<String> keySet, Set<String> mandatoryKeys, Set<String> optionalKeys) {
    Validate.notNull(keySet);//from   w w  w.ja  va  2 s.  co  m
    Validate.notNull(mandatoryKeys);
    Validate.notNull(optionalKeys);

    Set<String> missingKeys = new HashSet<>(mandatoryKeys);
    missingKeys.removeAll(keySet);
    if (CollectionUtils.isNotEmpty(missingKeys)) {
        throw new RuntimeException(MISSING_KEYS_ERROR_MESSAGE_PREFIX + missingKeys.toString());
    }

    Set<String> invalidKeys = new HashSet<>(keySet);
    invalidKeys.removeAll(mandatoryKeys);
    invalidKeys.removeAll(optionalKeys);
    if (CollectionUtils.isNotEmpty(invalidKeys)) {
        throw new RuntimeException(
                INVALID_KEYS_ERROR_MESSAGE_PREFIX + invalidKeys.toString() + INVALID_KEYS_ERROR_MESSAGE_SUFFIX);
    }
}

From source file:org.apache.sentry.policy.indexer.AbstractTestIndexerPolicyEngine.java

@Test
public void testJuniorAnalyst() throws Exception {
    Set<String> expected = Sets
            .newTreeSet(Sets.newHashSet(JRANALYST_JRANALYST1_ALL, JRANALYST_PURCHASES_PARTIAL_READ));
    Assert.assertEquals(expected.toString(),
            new TreeSet<String>(policy.getPrivileges(set("jranalyst"), ActiveRoleSet.ALL)).toString());
}

From source file:org.apache.sentry.policy.search.AbstractTestSearchPolicyEngine.java

@Test
public void testJuniorAnalyst() throws Exception {
    Set<String> expected = Sets
            .newTreeSet(Sets.newHashSet(JRANALYST_JRANALYST1_ALL, JRANALYST_PURCHASES_PARTIAL_QUERY));
    Assert.assertEquals(expected.toString(),
            new TreeSet<String>(policy.getPrivileges(set("jranalyst"), ActiveRoleSet.ALL)).toString());
}

From source file:delfos.dataset.basic.user.UsersDatasetAdapter.java

@Override
public String toString() {
    Set<String> _entitiesById = new TreeSet<>();
    for (User user : this) {
        _entitiesById.add(user.getName() + " (User " + user.getId() + ")");
    }/* w w  w.  j  av  a2 s  .  c  o  m*/
    return _entitiesById.toString();
}

From source file:com.netflix.nicobar.core.persistence.ArchiveRepositoryTest.java

@Test
public void testExternalizedModuleSpec() throws Exception {
    ArchiveRepository repository = createRepository();
    ModuleId testModuleId = TEST_MODULE_SPEC_JAR.getModuleId();
    ScriptModuleSpec expectedModuleSpec = new ScriptModuleSpec.Builder(testModuleId)
            .addMetadata("externalizedMetaDataName1", "externalizedMetaDataValue1").build();
    JarScriptArchive jarScriptArchive = new JarScriptArchive.Builder(testArchiveJarFile)
            .setModuleSpec(expectedModuleSpec).build();
    repository.insertArchive(jarScriptArchive);
    Set<ScriptArchive> scriptArchives = repository.getScriptArchives(Collections.singleton(testModuleId));
    assertEquals(scriptArchives.size(), 1, scriptArchives.toString());
    ScriptModuleSpec actualModuleSpec = scriptArchives.iterator().next().getModuleSpec();
    assertEquals(actualModuleSpec, expectedModuleSpec);
}

From source file:org.g_node.srv.CliOptionServiceTest.java

/**
 * Test option letter, long option text, description, use of alternative description as well as
 * isRequired, hasArgument and hasArguments state of the report CLI option.
 * @throws Exception/*from  w w  w  .  j a va 2s  . c o m*/
 */
@Test
public void testReportOpt() throws Exception {
    final String shortOpt = "r";
    final String longOpt = "report";
    final Set reports = Collections.singleton("theOnlyReport");
    final String desc = String.join("", "Reports available to the selected tool: ", reports.toString());
    final String altDesc = "Different message.";
    final Boolean isRequired = true;
    final Boolean hasArgument = true;
    final Boolean hasArguments = false;

    final Option defaultOption = CliOptionService.getReportOption("", reports);
    this.assertOption(defaultOption, shortOpt, longOpt, desc, isRequired, hasArgument, hasArguments);

    final Option altDescOption = CliOptionService.getReportOption(altDesc, reports);
    this.assertOption(altDescOption, shortOpt, longOpt, altDesc, isRequired, hasArgument, hasArguments);
}

From source file:org.springframework.flex.core.io.AbstractAmfConversionServiceConfigProcessor.java

/**
 * Called during initialization, the default implementation configures and registers a {@link SpringPropertyProxy} instance 
 * for each type returned by {@link AbstractAmfConversionServiceConfigProcessor#findTypesToRegister() findTypesToRegister}. 
 * @param conversionService the conversion service to be used for property conversion
 * @param useDirectFieldAccess determines whether fields should be accessed directly
 *//*from  ww w. j  av a2s .  c  o  m*/
protected void registerAmfProxies(ConversionService conversionService, boolean useDirectFieldAccess) {
    Set<Class<?>> typesToRegister = findTypesToRegister();
    if (log.isInfoEnabled()) {
        log.info("Types detected for AMF serialization support: " + typesToRegister.toString());
    }
    for (Class<?> type : typesToRegister) {
        registerPropertyProxy(SpringPropertyProxy.proxyFor(type, useDirectFieldAccess, conversionService));
    }
}

From source file:org.apache.sentry.provider.file.AbstractTestSimplePolicyEngine.java

@Test
public void testJuniorAnalyst() throws Exception {
    Set<String> expected = Sets.newTreeSet(Sets.newHashSet(PERM_SERVER1_JUNIOR_ANALYST_ALL,
            PERM_SERVER1_CUSTOMERS_DB_CUSTOMERS_PARTIAL_SELECT));
    Assert.assertEquals(expected.toString(),
            new TreeSet<String>(policy.getPermissions(authorizables, list("jranalyst")).values()).toString());
}

From source file:org.apache.sentry.provider.file.AbstractTestSimplePolicyEngine.java

@Test
public void testAnalyst() throws Exception {
    Set<String> expected = Sets.newTreeSet(Sets.newHashSet(PERM_SERVER1_CUSTOMERS_SELECT,
            PERM_SERVER1_ANALYST_ALL, PERM_SERVER1_JUNIOR_ANALYST_READ));
    Assert.assertEquals(expected.toString(),
            new TreeSet<String>(policy.getPermissions(authorizables, list("analyst")).values()).toString());
}

From source file:org.apache.sentry.policy.db.AbstractTestSimplePolicyEngine.java

@Test
public void testJuniorAnalyst() throws Exception {
    Set<String> expected = Sets.newTreeSet(Sets.newHashSet(PERM_SERVER1_JUNIOR_ANALYST_ALL,
            PERM_SERVER1_CUSTOMERS_DB_CUSTOMERS_PARTIAL_SELECT));
    Assert.assertEquals(expected.toString(),
            new TreeSet<String>(policy.getAllPrivileges(set("jranalyst"), ActiveRoleSet.ALL)).toString());
}