List of usage examples for java.util EnumSet complementOf
public static <E extends Enum<E>> EnumSet<E> complementOf(EnumSet<E> s)
From source file:org.richfaces.tests.metamer.ftest.extension.attributes.coverage.result.SimpleCoverageResult.java
private EnumSet getNotCovered(EnumSet covered, EnumSet ignored) { EnumSet notCovered = EnumSet.complementOf(covered); notCovered.removeAll(ignored);/*from w w w . j a va 2s . co m*/ return notCovered; }
From source file:schemacrawler.test.SchemaCrawlerOutputTest.java
@Test public void compareCompositeOutput() throws Exception { FileUtils.deleteDirectory(new File("./target/unit_tests_results_output", COMPOSITE_OUTPUT)); final String queryCommand1 = "all_tables"; final Config queriesConfig = new Config(); queriesConfig.put(queryCommand1,/*from ww w .j a v a 2 s. com*/ "SELECT * FROM INFORMATION_SCHEMA.SYSTEM_TABLES ORDER BY TABLE_SCHEM, TABLE_NAME"); final String queryCommand2 = "dump_tables"; queriesConfig.put(queryCommand2, "SELECT ${orderbycolumns} FROM ${table} ORDER BY ${orderbycolumns}"); final BaseTextOptionsBuilder baseTextOptions = new BaseTextOptionsBuilder(); queriesConfig.putAll(baseTextOptions.toConfig()); final String[] commands = new String[] { SchemaTextDetailType.details + "," + Operation.count + "," + Operation.dump, SchemaTextDetailType.list + "," + Operation.count, queryCommand1 + "," + queryCommand2 + "," + Operation.count + "," + SchemaTextDetailType.list, }; final List<String> failures = new ArrayList<>(); for (final OutputFormat outputFormat : EnumSet.complementOf(EnumSet.of(OutputFormat.tsv))) { for (final String command : commands) { final String referenceFile = command + "." + outputFormat.name(); final File testOutputFile = File.createTempFile("schemacrawler." + referenceFile + ".", ".test"); testOutputFile.delete(); final OutputOptions outputOptions = new OutputOptions(outputFormat.name(), testOutputFile); final Config config = Config.loadResource("/hsqldb.INFORMATION_SCHEMA.config.properties"); final SchemaCrawlerOptions schemaCrawlerOptions = new SchemaCrawlerOptions(config); schemaCrawlerOptions.setSchemaInfoLevel(SchemaInfoLevel.maximum()); final SchemaCrawlerExecutable executable = new SchemaCrawlerExecutable(command); executable.setSchemaCrawlerOptions(schemaCrawlerOptions); executable.setOutputOptions(outputOptions); executable.setAdditionalConfiguration(queriesConfig); executable.execute(getConnection()); failures.addAll( compareOutput(COMPOSITE_OUTPUT + referenceFile, testOutputFile, outputFormat.name())); } } if (failures.size() > 0) { fail(failures.toString()); } }
From source file:schemacrawler.test.SchemaCrawlerOutputTest.java
@Test public void compareHideConstraintNamesOutput() throws Exception { FileUtils.deleteDirectory(new File("./target/unit_tests_results_output", HIDE_CONSTRAINT_NAMES_OUTPUT)); final List<String> failures = new ArrayList<>(); final SchemaTextOptions textOptions = new SchemaTextOptions(); textOptions.setNoInfo(false);//from w ww.j a va2 s. c o m textOptions.setNoHeader(false); textOptions.setNoFooter(false); textOptions.setHidePrimaryKeyNames(true); textOptions.setHideForeignKeyNames(true); textOptions.setHideIndexNames(true); textOptions.setHideConstraintNames(true); for (final OutputFormat outputFormat : EnumSet.complementOf(EnumSet.of(OutputFormat.tsv))) { final String referenceFile = "details_maximum." + outputFormat.name(); final File testOutputFile = File.createTempFile("schemacrawler." + referenceFile + ".", ".test"); testOutputFile.delete(); final OutputOptions outputOptions = new OutputOptions(outputFormat.name(), testOutputFile); final Config config = Config.loadResource("/hsqldb.INFORMATION_SCHEMA.config.properties"); final SchemaCrawlerOptions schemaCrawlerOptions = new SchemaCrawlerOptions(config); schemaCrawlerOptions.setSchemaInfoLevel(SchemaInfoLevel.maximum()); final SchemaCrawlerExecutable executable = new SchemaCrawlerExecutable( SchemaTextDetailType.details + "," + Operation.count + "," + Operation.dump); executable.setSchemaCrawlerOptions(schemaCrawlerOptions); executable.setOutputOptions(outputOptions); executable.setAdditionalConfiguration(textOptions.toConfig()); executable.execute(getConnection()); failures.addAll(compareOutput(HIDE_CONSTRAINT_NAMES_OUTPUT + referenceFile, testOutputFile, outputFormat.name())); } if (failures.size() > 0) { fail(failures.toString()); } }
From source file:schemacrawler.test.SchemaCrawlerOutputTest.java
@Test public void compareOrdinalOutput() throws Exception { FileUtils.deleteDirectory(new File("./target/unit_tests_results_output", ORDINAL_OUTPUT)); final List<String> failures = new ArrayList<>(); final SchemaTextOptions textOptions = new SchemaTextOptions(); textOptions.setNoInfo(false);/*from w w w . ja va2 s.co m*/ textOptions.setNoHeader(false); textOptions.setNoFooter(false); textOptions.setShowOrdinalNumbers(true); for (final OutputFormat outputFormat : EnumSet.complementOf(EnumSet.of(OutputFormat.tsv))) { final String referenceFile = "details_maximum." + outputFormat.name(); final File testOutputFile = File.createTempFile("schemacrawler." + referenceFile + ".", ".test"); testOutputFile.delete(); final OutputOptions outputOptions = new OutputOptions(outputFormat.name(), testOutputFile); final Config config = Config.loadResource("/hsqldb.INFORMATION_SCHEMA.config.properties"); final SchemaCrawlerOptions schemaCrawlerOptions = new SchemaCrawlerOptions(config); schemaCrawlerOptions.setSchemaInfoLevel(SchemaInfoLevel.maximum()); final SchemaCrawlerExecutable executable = new SchemaCrawlerExecutable( SchemaTextDetailType.details + "," + Operation.count + "," + Operation.dump); executable.setSchemaCrawlerOptions(schemaCrawlerOptions); executable.setOutputOptions(outputOptions); executable.setAdditionalConfiguration(textOptions.toConfig()); executable.execute(getConnection()); failures.addAll(compareOutput(ORDINAL_OUTPUT + referenceFile, testOutputFile, outputFormat.name())); } if (failures.size() > 0) { fail(failures.toString()); } }
From source file:schemacrawler.test.SchemaCrawlerOutputTest.java
@Test public void compareRoutinesOutput() throws Exception { FileUtils.deleteDirectory(new File("./target/unit_tests_results_output", ROUTINES_OUTPUT)); final List<String> failures = new ArrayList<>(); final BaseTextOptions textOptions = new SchemaTextOptions(); textOptions.setNoInfo(false);/*ww w . j a v a2s . c o m*/ textOptions.setNoHeader(false); textOptions.setNoFooter(false); textOptions.setShowUnqualifiedNames(true); for (final OutputFormat outputFormat : EnumSet.complementOf(EnumSet.of(OutputFormat.tsv))) { final String referenceFile = "routines." + outputFormat.name(); final File testOutputFile = File.createTempFile("schemacrawler." + referenceFile + ".", ".test"); testOutputFile.delete(); final OutputOptions outputOptions = new OutputOptions(outputFormat.name(), testOutputFile); final Config config = Config.loadResource("/hsqldb.INFORMATION_SCHEMA.config.properties"); final SchemaCrawlerOptions schemaCrawlerOptions = new SchemaCrawlerOptions(config); schemaCrawlerOptions.setTableInclusionRule(new ExcludeAll()); schemaCrawlerOptions.setRoutineInclusionRule(new IncludeAll()); schemaCrawlerOptions.setSchemaInfoLevel(SchemaInfoLevel.maximum()); final SchemaCrawlerExecutable executable = new SchemaCrawlerExecutable( SchemaTextDetailType.details.name()); executable.setSchemaCrawlerOptions(schemaCrawlerOptions); executable.setOutputOptions(outputOptions); executable.setAdditionalConfiguration(textOptions.toConfig()); executable.execute(getConnection()); failures.addAll(compareOutput(ROUTINES_OUTPUT + referenceFile, testOutputFile, outputFormat.name())); } if (failures.size() > 0) { fail(failures.toString()); } }
From source file:schemacrawler.test.SchemaCrawlerOutputTest.java
@Test public void compareUnqualifiedNamesOutput() throws Exception { FileUtils.deleteDirectory(new File("./target/unit_tests_results_output", UNQUALIFIED_NAMES_OUTPUT)); final List<String> failures = new ArrayList<>(); final BaseTextOptions textOptions = new SchemaTextOptions(); textOptions.setNoInfo(false);//w ww . j av a 2s.c o m textOptions.setNoHeader(false); textOptions.setNoFooter(false); textOptions.setShowUnqualifiedNames(true); for (final OutputFormat outputFormat : EnumSet.complementOf(EnumSet.of(OutputFormat.tsv))) { final String referenceFile = "details_maximum." + outputFormat.name(); final File testOutputFile = File.createTempFile("schemacrawler." + referenceFile + ".", ".test"); testOutputFile.delete(); final OutputOptions outputOptions = new OutputOptions(outputFormat.name(), testOutputFile); final Config config = Config.loadResource("/hsqldb.INFORMATION_SCHEMA.config.properties"); final SchemaCrawlerOptions schemaCrawlerOptions = new SchemaCrawlerOptions(config); schemaCrawlerOptions.setSchemaInfoLevel(SchemaInfoLevel.maximum()); final SchemaCrawlerExecutable executable = new SchemaCrawlerExecutable( SchemaTextDetailType.details + "," + Operation.count + "," + Operation.dump); executable.setSchemaCrawlerOptions(schemaCrawlerOptions); executable.setOutputOptions(outputOptions); executable.setAdditionalConfiguration(textOptions.toConfig()); executable.execute(getConnection()); failures.addAll( compareOutput(UNQUALIFIED_NAMES_OUTPUT + referenceFile, testOutputFile, outputFormat.name())); } if (failures.size() > 0) { fail(failures.toString()); } }