org.eclipse.collections.impl.factory.Sets Java Examples

The following examples show how to use org.eclipse.collections.impl.factory.Sets. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MongoDbDeployExecutionDaoIT.java    From obevo with Apache License 2.0 6 votes vote down vote up
@Test
public void test() {
    ChangeType changeType = mock(ChangeType.class);
    when(changeType.getName()).thenReturn("type");

    MongoDbPlatform platform = mock(MongoDbPlatform.class);
    when(platform.getChangeType(Mockito.anyString())).thenReturn(changeType);
    when(platform.convertDbObjectName()).thenReturn(StringFunctions.toUpperCase());

    Schema schema = new Schema("mydb");

    MongoDbEnvironment env = new MongoDbEnvironment();
    env.setPlatform(platform);
    env.setSchemas(Sets.immutable.of(schema));

    MongoDbDeployExecutionDao deployExecDao = new MongoDbDeployExecutionDao(mongoClient, env);

    DeployExecutionImpl exec = new DeployExecutionImpl("requester", "executor", schema.getName(), "1.0.0", new Timestamp(new Date().getTime()), false, false, "1.0.0", "reason", Sets.immutable.<DeployExecutionAttribute>empty());
    deployExecDao.persistNew(exec, new PhysicalSchema("mydb"));

    ImmutableCollection<DeployExecution> execs = deployExecDao.getDeployExecutions("mydb");
    assertEquals(1, execs.size());

    deployExecDao.update(execs.getFirst());
}
 
Example #2
Source File: UnitTestDbBuilder.java    From obevo with Apache License 2.0 6 votes vote down vote up
private MainDeployerArgs getMainDeployerArgs() {
    MainDeployerArgs args = new MainDeployerArgs();

    if (this.tables != null || this.views != null) {
        MutableList<Predicate<? super ChangeKey>> predicates = Lists.mutable.empty();
        if (this.tables != null) {
            predicates.add(ChangeKeyPredicateBuilder.newBuilder()
                    .setChangeTypes(ChangeType.TABLE_STR, ChangeType.FOREIGN_KEY_STR, ChangeType.TRIGGER_INCREMENTAL_OLD_STR, ChangeType.STATICDATA_STR)
                    .setObjectNames(Sets.immutable.withAll(this.tables))
                    .build());
        }
        if (this.views != null) {
            predicates.add(ChangeKeyPredicateBuilder.newBuilder()
                    .setChangeTypes(ChangeType.VIEW_STR)
                    .setObjectNames(Sets.immutable.withAll(this.views))
                    .build());
        }

        args.setChangeInclusionPredicate(Predicates.or(predicates));
    }

    args.setAllChangesets(true);  // for unit tests, we always want all changes to deploy
    return args;
}
 
Example #3
Source File: TextMarkupDocumentReaderTest.java    From obevo with Apache License 2.0 6 votes vote down vote up
@Test
public void testQuotedSplitWithEqualSign() {
    String input = "attr=1234 attr2=\"56=78\" mytog1";
    if (legacyMode) {
        try {
            textMarkupDocumentReader.parseAttrsAndToggles(input);
            fail("Should have failed here");
        } catch (IllegalArgumentException e) {
            assertThat(e.getMessage(), containsString("Cannot mark = multiple times"));
        }
    } else {
        Pair<ImmutableMap<String, String>, ImmutableSet<String>> results = textMarkupDocumentReader.parseAttrsAndToggles(input);

        assertEquals(Maps.mutable.of("attr", "1234", "attr2", "56=78"), results.getOne());
        assertEquals(Sets.mutable.of("mytog1"), results.getTwo());
    }
}
 
Example #4
Source File: ApiExampleForDocumentation.java    From obevo with Apache License 2.0 6 votes vote down vote up
public void programmaticEnvCreation() {
    DbEnvironment dbEnv = new DbEnvironment();
    dbEnv.setSourceDirs(Lists.immutable.with(FileRetrievalMode.FILE_SYSTEM.resolveSingleFileObject("./src/test/resources/platforms/h2/step1")));
    dbEnv.setName("test");
    dbEnv.setPlatform(new H2DbPlatform());
    dbEnv.setSchemas(Sets.immutable.with(new Schema("SCHEMA1"), new Schema("SCHEMA2")));
    dbEnv.setDbServer("BLAH");

    dbEnv.setSchemaNameOverrides(Maps.immutable.of("SCHEMA1", "bogusSchema"));
    dbEnv.setNullToken("(null)");
    dbEnv.setDataDelimiter('^');

    DeployerAppContext context = Obevo.buildContext(dbEnv, new Credential("sa", ""));

    context.setupEnvInfra();
    context.cleanEnvironment();
    context.deploy();
}
 
Example #5
Source File: TextMarkupDocumentReaderTest.java    From obevo with Apache License 2.0 6 votes vote down vote up
@Test
public void testQuotedSplitWithEqualSignAndSpace() {
    String input = "attr=1234 attr2=\"56 = 78\" mytog1";
    if (legacyMode) {
        try {
            textMarkupDocumentReader.parseAttrsAndToggles(input);
            fail("Should have failed here");
        } catch (ArrayIndexOutOfBoundsException e) {
            assertThat(e.getMessage(), notNullValue());
        }
    } else {
        Pair<ImmutableMap<String, String>, ImmutableSet<String>> results = textMarkupDocumentReader.parseAttrsAndToggles(input);

        assertEquals(Maps.mutable.of("attr", "1234", "attr2", "56 = 78"), results.getOne());
        assertEquals(Sets.mutable.of("mytog1"), results.getTwo());
    }
}
 
Example #6
Source File: GraphEnricherImplTest.java    From obevo with Apache License 2.0 6 votes vote down vote up
private SortableDependencyGroup newChangeWithDependency(String schema, String changeTypeName, String objectName, String changeName, int orderWithinObject, ImmutableSet<CodeDependency> dependencies) {
    ChangeType changeType = mock(ChangeType.class);
    when(changeType.getName()).thenReturn(changeTypeName);
    when(changeType.isRerunnable()).thenReturn(true);

    SortableDependency sort = mock(SortableDependency.class);
    ObjectKey key = new ObjectKey(schema, objectName, changeType);
    when(sort.getChangeKey()).thenReturn(new ChangeKey(key, changeName));
    if (dependencies != null) {
        when(sort.getCodeDependencies()).thenReturn(dependencies);
    }
    when(sort.getOrderWithinObject()).thenReturn(orderWithinObject);

    // to print out a nice message for the mock; we do need the string variable on a separate line
    String keyString = key.toStringShort() + "-" + changeName;
    when(sort.toString()).thenReturn(keyString);

    SortableDependencyGroup depGroup = mock(SortableDependencyGroup.class);
    when(depGroup.getComponents()).thenReturn(Sets.immutable.<SortableDependency>with(sort));
    when(depGroup.toString()).thenReturn(keyString);
    return depGroup;
}
 
Example #7
Source File: TextMarkupDocumentReaderTest.java    From obevo with Apache License 2.0 6 votes vote down vote up
@Test
public void testWordEndingInEqualSignWillFailInLegacy() {
    String input = "   attr= abc";
    if (legacyMode) {
        try {
            textMarkupDocumentReader.parseAttrsAndToggles(input);
            fail("Should have failed here");
        } catch (ArrayIndexOutOfBoundsException expected) {
        }
    } else {
        Pair<ImmutableMap<String, String>, ImmutableSet<String>> results = textMarkupDocumentReader.parseAttrsAndToggles(input);

        assertEquals(Maps.mutable.of("attr", ""), results.getOne());
        assertEquals(Sets.mutable.of("abc"), results.getTwo());
    }
}
 
Example #8
Source File: DefaultRollbackDetectorTest.java    From obevo with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetActiveDeploymentsOnNormalCase() throws Exception {
    assertEquals(Lists.immutable.with(1L), rollbackDetector.getActiveDeployments(Sets.immutable.with(
            newExecution(1, "a")
    )).collect(new Function<DeployExecution, Long>() {
        @Override
        public Long valueOf(DeployExecution deployExecution1) {
            return deployExecution1.getId();
        }
    }));

    assertEquals(Lists.immutable.with(1L, 2L, 3L), rollbackDetector.getActiveDeployments(Sets.immutable.with(
            newExecution(1, "a")
            , newExecution(2, "b")
            , newExecution(3, "c")
    )).collect(new Function<DeployExecution, Long>() {
        @Override
        public Long valueOf(DeployExecution deployExecution) {
            return deployExecution.getId();
        }
    }));
}
 
Example #9
Source File: DbDeployer.java    From obevo with Apache License 2.0 6 votes vote down vote up
private Predicate<? super ChecksumEntry> getPlatformInclusionPredicate(DbEnvironment env) {
    // 1) exclude those tables that are excluded by default from source code, e.g. explain tables or others that users configure
    ImmutableSet<Predicate<? super ChecksumEntry>> schemaObjectNamePredicates = env.getSchemas().collect(new Function<Schema, Predicate<? super ChecksumEntry>>() {
        @Override
        public Predicate<? super ChecksumEntry> valueOf(Schema schema) {
            return schema.getObjectExclusionPredicateBuilder().build(ChecksumEntry.TO_OBJECT_TYPE, ChecksumEntry.TO_NAME1);
        }
    });

    // 2) exclude the audit tables
    MutableMultimap<String, String> tablesToExclude = Multimaps.mutable.set.empty();

    tablesToExclude.putAll(ChangeType.TABLE_STR, Sets.immutable.with(
            env.getPlatform().convertDbObjectName().valueOf(getArtifactDeployerDao().getAuditContainerName()),
            env.getPlatform().convertDbObjectName().valueOf(dbChecksumManager.getChecksumContainerName()),
            env.getPlatform().convertDbObjectName().valueOf(getDeployExecutionDao().getExecutionContainerName()),
            env.getPlatform().convertDbObjectName().valueOf(getDeployExecutionDao().getExecutionAttributeContainerName())
    ));
    ObjectTypeAndNamePredicateBuilder auditTablePredicateBuilder = new ObjectTypeAndNamePredicateBuilder(tablesToExclude.toImmutable(), ObjectTypeAndNamePredicateBuilder.FilterType.EXCLUDE);
    Predicates<? super ChecksumEntry> auditTablePredicate = auditTablePredicateBuilder.build(ChecksumEntry.TO_OBJECT_TYPE, ChecksumEntry.TO_NAME1);

    return auditTablePredicate.and(schemaObjectNamePredicates);
}
 
Example #10
Source File: DbDeployer.java    From obevo with Apache License 2.0 6 votes vote down vote up
private ChecksumEntryInclusionPredicate createLookupIndexForObjectType(DbEnvironment env, ImmutableList<Change> sourceChanges, final String changeTypeName) {
    LookupIndex objectTypeIndex = new LookupIndex(Sets.immutable.with(changeTypeName));
    ImmutableList<Change> objectTypeChanges = sourceChanges.select(new Predicate<Change>() {
        @Override
        public boolean accept(Change it) {
            return it.getChangeTypeName().equals(changeTypeName);
        }
    });
    MutableSet<String> objectNames = objectTypeChanges.collect(new Function<Change, String>() {
        @Override
        public String valueOf(Change change) {
            return change.getObjectName();
        }
    }).collect(env.getPlatform().convertDbObjectName()).toSet();
    LookupIndex objectNameIndex = new LookupIndex(objectNames.toImmutable());
    return new ChecksumEntryInclusionPredicate(
            Lists.immutable.with(objectTypeIndex),
            Lists.immutable.with(objectNameIndex)
    );
}
 
Example #11
Source File: ChangeKeyPredicateBuilderTest.java    From obevo with Apache License 2.0 6 votes vote down vote up
@Test
public void testSchema() {
    Predicate<ChangeKey> allSchemaPredicate =
            ChangeKeyPredicateBuilder.parseSinglePredicate("sch%");
    assertEquals(allChanges.toSet(),
            allChanges.select(allSchemaPredicate).toSet());

    Predicate<ChangeKey> schema1Predicate =
            ChangeKeyPredicateBuilder.parseSinglePredicate("sch1%~%~%~%");

    assertEquals(Sets.mutable.with(tableSch1ObjAChng1, tableSch1ObjAChng2, tableSch1ObjAChng3, tableSch1ObjBChng1, tableSch1ObjCChng1, viewSch1ObjD, viewSch1ObjE),
            allChanges.select(schema1Predicate).toSet());

    Predicate<ChangeKey> schema2Predicate =
            ChangeKeyPredicateBuilder.parseSinglePredicate("%2~%~%~%");

    assertEquals(Sets.mutable.with(tableSch2ObjAChng1, viewSch2ObjF),
            allChanges.select(schema2Predicate).toSet());
}
 
Example #12
Source File: GraphEnricherImplTest.java    From obevo with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetChangesCaseInsensitive() {
    this.enricher = new GraphEnricherImpl(String::toUpperCase);
    String schema1 = "schema1";
    String schema2 = "schema2";
    String type1 = "type1";

    SortableDependencyGroup sp1 = newChange(schema1, type1, "SP1", "n/a", 0, Sets.immutable.with("sp2"));
    SortableDependencyGroup sp2 = newChange(schema1, type1, "SP2", Sets.immutable.<String>with());
    SortableDependencyGroup sp3 = newChange(schema1, type1, "SP3", Sets.immutable.with("sp1", "sp2"));
    SortableDependencyGroup spA = newChange(schema1, type1, "SPA", Sets.immutable.with("sp3"));
    SortableDependencyGroup sp1Schema2 = newChange(schema2, type1, "sp1", "n/a", 0, Sets.immutable.with("sp2", schema1 + ".sp3"));
    SortableDependencyGroup sp2Schema2 = newChange(schema2, type1, "sP2", "n/a", 0, Sets.immutable.<String>with());

    Graph<SortableDependencyGroup, DefaultEdge> sortGraph = enricher.createDependencyGraph(Lists.mutable.with(
            sp1, sp2, sp3, spA, sp1Schema2, sp2Schema2), false);

    validateChange(sortGraph, sp1, Sets.immutable.with(sp2), Sets.immutable.with(sp3));
    validateChange(sortGraph, sp2, Sets.immutable.<SortableDependencyGroup>with(), Sets.immutable.with(sp1, sp3));
    validateChange(sortGraph, sp3, Sets.immutable.with(sp1, sp2), Sets.immutable.with(spA, sp1Schema2));
    validateChange(sortGraph, spA, Sets.immutable.with(sp3), Sets.immutable.<SortableDependencyGroup>with());
    validateChange(sortGraph, sp1Schema2, Sets.immutable.with(sp2Schema2, sp3), Sets.immutable.<SortableDependencyGroup>with());
    validateChange(sortGraph, sp2Schema2, Sets.immutable.<SortableDependencyGroup>with(), Sets.immutable.with(sp1Schema2));
}
 
Example #13
Source File: ChangeKeyPredicateBuilderTest.java    From obevo with Apache License 2.0 6 votes vote down vote up
@Test
public void testComboInFullPredicate() {
    Predicate<ChangeKey> singleComboPredicate1 =
            ChangeKeyPredicateBuilder.parseFullPredicate("sc%1~%~objA,mytableC~%");
    assertEquals(Sets.mutable.with(tableSch1ObjAChng1, tableSch1ObjAChng2, tableSch1ObjAChng3, tableSch1ObjCChng1),
            allChanges.select(singleComboPredicate1).toSet());

    Predicate<ChangeKey> pred2 =
            ChangeKeyPredicateBuilder.parseFullPredicate("%~%~%~CCCC%");
    assertEquals(Sets.mutable.with(tableSch1ObjBChng1, tableSch2ObjAChng1),
            allChanges.select(pred2).toSet());

    Predicate<ChangeKey> fullComboPredicate =
            ChangeKeyPredicateBuilder.parseFullPredicate("sc%1~%~objA,mytableC~%;%~%~%~CCCC%");
    assertEquals(Sets.mutable.with(tableSch1ObjAChng1, tableSch1ObjAChng2, tableSch1ObjAChng3, tableSch1ObjCChng1, tableSch1ObjBChng1, tableSch2ObjAChng1),
            allChanges.select(fullComboPredicate).toSet());
}
 
Example #14
Source File: GraphEnricherImplTest.java    From obevo with Apache License 2.0 6 votes vote down vote up
@Test
public void testCycleValidationWithIncrementalChanges() {
    this.enricher = new GraphEnricherImpl(Functions.getStringPassThru()::valueOf);

    SortableDependencyGroup sch1Obj1C1 = newChange(schema1, type1, "obj1", "c1", 0, null);
    SortableDependencyGroup sch1Obj1C2 = newChangeWithDependency(schema1, type1, "obj1", "c2", 1, Sets.immutable.of(new CodeDependency("obj2", CodeDependencyType.DISCOVERED)));
    SortableDependencyGroup sch1Obj1C3 = newChange(schema1, type1, "obj1", "c3", 2, null);
    SortableDependencyGroup sch1Obj2C1 = newChange(schema1, type1, "obj2", "c1", 0, null);
    SortableDependencyGroup sch1Obj2C2 = newChange(schema1, type1, "obj2", "c2", 1, null);
    SortableDependencyGroup sch1Obj2C3 = newChange(schema1, type1, "obj2", "c3", 2, Sets.immutable.<String>with("obj1.c3"));
    SortableDependencyGroup sch1Obj3 = newChange(schema1, type1, "obj3", Sets.immutable.with("obj1"));

    try {
        enricher.createDependencyGraph(Lists.mutable.with(
                sch1Obj1C1, sch1Obj1C2, sch1Obj1C3, sch1Obj2C1, sch1Obj2C2, sch1Obj2C3, sch1Obj3), false);
        fail("Expecting an exception here due to a cycle exception, but a cycle exception was not found");
    } catch (IllegalArgumentException exc) {
        exc.printStackTrace();
        assertThat(exc.getMessage(), containsString("Found cycles"));
        // verify that we print a legible error message for discovered dependencies
        assertThat(exc.getMessage(), containsString("[obj1.c2] == depends on ==> [obj2]   (DISCOVERED dependency)"));
    }
}
 
Example #15
Source File: GraphEnricherImplTest.java    From obevo with Apache License 2.0 6 votes vote down vote up
/**
 * The test data in this class is all written w/ case-sensitivy as the default.
 * If we pass caseInsensitive == true, then we enable that mode in the graph enricher and tweak the object names
 * a bit so that we can verify that the resolution works either way.
 */
private void testSchemaObjectDependencies(boolean caseInsensitive) {
    this.enricher = new GraphEnricherImpl(caseInsensitive ? String::toUpperCase : Functions.getStringPassThru()::valueOf);

    SortableDependencyGroup sch1Obj1 = newChange(schema1, type1, "obj1", Sets.immutable.with("obj3", schema2 + ".obj2"));
    SortableDependencyGroup sch1Obj2 = newChange(schema1, type2, "obj2", Sets.immutable.<String>with());
    // change the case of the object name to ensure others can still point to it
    SortableDependencyGroup sch1Obj3 = newChange(schema1, type1, caseInsensitive ? "obj3".toUpperCase() : "obj3", Sets.immutable.with("obj2"));
    // change the case of the dependency name to ensure that it can point to others
    SortableDependencyGroup sch2Obj1 = newChange(schema2, type1, "obj1", Sets.immutable.with(caseInsensitive ? "obj2".toUpperCase() : "obj2"));
    SortableDependencyGroup sch2Obj2 = newChange(schema2, type2, "obj2", Sets.immutable.with(schema1 + ".obj3"));

    Graph<SortableDependencyGroup, DefaultEdge> sortGraph = enricher.createDependencyGraph(Lists.mutable.with(
            sch1Obj1, sch1Obj2, sch1Obj3, sch2Obj1, sch2Obj2), false);

    validateChange(sortGraph, sch1Obj1, Sets.immutable.with(sch1Obj3, sch2Obj2), Sets.immutable.<SortableDependencyGroup>with());
    validateChange(sortGraph, sch1Obj2, Sets.immutable.<SortableDependencyGroup>with(), Sets.immutable.with(sch1Obj3));
    validateChange(sortGraph, sch1Obj3, Sets.immutable.with(sch1Obj2), Sets.immutable.with(sch1Obj1, sch2Obj2));
    validateChange(sortGraph, sch2Obj1, Sets.immutable.with(sch2Obj2), Sets.immutable.<SortableDependencyGroup>with());
    validateChange(sortGraph, sch2Obj2, Sets.immutable.with(sch1Obj3), Sets.immutable.with(sch1Obj1, sch2Obj1));
}
 
Example #16
Source File: PackageMetadataReaderTest.java    From obevo with Apache License 2.0 6 votes vote down vote up
@Test
public void testPackageMetadataWithMetadataAndProperties() {
    PackageMetadataReader packageMetadataReader = new PackageMetadataReader(new TextMarkupDocumentReader(false));

    PackageMetadata packageMetadata = packageMetadataReader.getPackageMetadata("\n\n  \n  \n" +
            "//// METADATA k1=v1 k2=v2 toggle1 toggle2\n" +
            "sourceEncodings.UTF-8=a1,a2,a3\n" +
            "sourceEncodings.UTF-16=a4\n" +
            "otherProps=abc\n" +
            "\n");

    assertEquals(Maps.immutable.of("k1", "v1", "k2", "v2"), packageMetadata.getMetadataSection().getAttrs());
    assertEquals(Sets.immutable.of("toggle1", "toggle2"), packageMetadata.getMetadataSection().getToggles());

    assertEquals(Maps.mutable.of(
            "a1", "UTF-8",
            "a2", "UTF-8",
            "a3", "UTF-8",
            "a4", "UTF-16"
            )
            , packageMetadata.getFileToEncodingMap());
}
 
Example #17
Source File: MsSqlToHsqlTranslationDialect.java    From obevo with Apache License 2.0 5 votes vote down vote up
@Override
public ImmutableSet<String> getDisabledChangeTypeNames() {
    return Sets.immutable.with(
            ChangeType.DEFAULT_STR,
            ChangeType.FUNCTION_STR,
            ChangeType.RULE_STR,
            ChangeType.SP_STR,
            ChangeType.TRIGGER_STR,
            ChangeType.TRIGGER_INCREMENTAL_OLD_STR
    );
}
 
Example #18
Source File: MsSqlToH2TranslationDialect.java    From obevo with Apache License 2.0 5 votes vote down vote up
@Override
public ImmutableSet<String> getDisabledChangeTypeNames() {
    return Sets.immutable.with(
            ChangeType.DEFAULT_STR,
            ChangeType.FUNCTION_STR,
            ChangeType.RULE_STR,
            ChangeType.SP_STR,
            ChangeType.TRIGGER_STR,
            ChangeType.TRIGGER_INCREMENTAL_OLD_STR
    );
}
 
Example #19
Source File: RawDeserializationTest.java    From jackson-datatypes-collections with Apache License 2.0 5 votes vote down vote up
@Test
public void objectSet() throws IOException {
    testCollection(Sets.mutable.of("a", Collections.emptyMap(), 1), "[\"a\", {}, 1]",
            new TypeReference<MutableSet>() {},
            new TypeReference<ImmutableSet>() {});
    testCollection(Sets.mutable.of("a", Collections.emptyMap(), 1), "[\"a\", {}, 1]",
            MutableSet.class,
            ImmutableSet.class);
}
 
Example #20
Source File: Db2ToH2TranslationDialect.java    From obevo with Apache License 2.0 5 votes vote down vote up
@Override
public ImmutableSet<String> getDisabledChangeTypeNames() {
    return Sets.immutable.with(
            ChangeType.DEFAULT_STR,
            ChangeType.FUNCTION_STR,
            ChangeType.RULE_STR,
            ChangeType.SP_STR,
            ChangeType.TRIGGER_STR,
            ChangeType.TRIGGER_INCREMENTAL_OLD_STR
    );
}
 
Example #21
Source File: LookupIndexTest.java    From obevo with Apache License 2.0 5 votes vote down vote up
@Test
public void lookupTest() {
    LookupIndex lookupIndex = new LookupIndex(Sets.immutable.with("ABC", "123"));

    Assert.assertTrue(lookupIndex.accept("ABC"));
    Assert.assertTrue(lookupIndex.accept("123"));
    Assert.assertFalse(lookupIndex.accept("blah"));
    Assert.assertFalse(lookupIndex.accept("ABc"));  // not case-insensitive
}
 
Example #22
Source File: OracleHikariPoolConfigBean.java    From datacollector with Apache License 2.0 5 votes vote down vote up
@Override
public List<Stage.ConfigIssue> validateConfigs(Stage.Context context, List<Stage.ConfigIssue> issues) {
  issues = superValidateConfigs(context, issues);

  try {
    if (isEncryptedConnection) {
      encryptionProperties = new Properties();
      KeyStoreBuilder builder = new KeyStoreBuilder().addCertificatePem(serverCertificatePem);
      KeyStoreIO.KeyStoreFile jks = KeyStoreIO.save(builder.build());
      encryptionProperties.setProperty(TRUSTSTORE_TYPE, "JKS");
      encryptionProperties.setProperty(TRUSTSTORE, jks.getPath());
      encryptionProperties.setProperty(TRUSTSTORE_PASSWORD, jks.getPassword());
      encryptionProperties.setProperty(SSL_CLIENT_AUTHENTICATION, "false");

      encryptionProperties.setProperty(SSL_CIPHER_SUITES, cipherSuites.trim());
      encryptionProperties.setProperty(SSL_SERVER_DN_MATCH, String.valueOf(verifyHostname));
    }

    constructConnectionString();

  } catch (StageException e) {
    issues.add(context.createConfigIssue("ENCRYPTION",
        "hikariConfigBean.serverCertificatePem",
        Errors.ORACLE_01,
        e.getMessage()
    ));
  }
  Set<String> blacklistedInUse = Sets.intersect(BLACKLISTED_PROPS, super.getDriverProperties().stringPropertyNames());
  if (!blacklistedInUse.isEmpty()) {
    issues.add(context.createConfigIssue("JDBC", "driverProperties", Errors.ORACLE_00, blacklistedInUse));
  }
  return issues;
}
 
Example #23
Source File: Db2DeployerMainIT.java    From obevo with Apache License 2.0 5 votes vote down vote up
private void verifyExecution1(DeployExecution execution1) {
    assertEquals("try1", execution1.getReason());
    assertEquals(
            Sets.immutable.with(
                    new DeployExecutionAttributeImpl("A", "aval"),
                    new DeployExecutionAttributeImpl("B", "bval")
            ),
            execution1.getAttributes());
}
 
Example #24
Source File: Db2PostDeployActionIT.java    From obevo with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() {
    this.env = new DbEnvironment();
    this.env.setSchemas(Sets.immutable.with(new Schema(physicalSchema.getPhysicalName())));

    this.sqlExecutor = new Db2SqlExecutor(dataSource, env);

    this.metricsCollector = new DeployMetricsCollectorImpl();
    this.db2PostDeployAction = new Db2PostDeployAction(sqlExecutor, metricsCollector);
}
 
Example #25
Source File: AseToH2TranslationDialect.java    From obevo with Apache License 2.0 5 votes vote down vote up
@Override
public ImmutableSet<String> getDisabledChangeTypeNames() {
    return Sets.immutable.with(
            ChangeType.DEFAULT_STR,
            ChangeType.FUNCTION_STR,
            ChangeType.RULE_STR,
            ChangeType.SP_STR,
            ChangeType.TRIGGER_STR,
            ChangeType.TRIGGER_INCREMENTAL_OLD_STR
    );
}
 
Example #26
Source File: DeployExecutionImpl.java    From obevo with Apache License 2.0 5 votes vote down vote up
public DeployExecutionImpl(String requesterId, String deployExecutorId, String schema, String toolVersion, Timestamp deployTime, boolean init, boolean rollback, String productVersion, String reason, ImmutableSet<? extends DeployExecutionAttribute> attributes) {
    this.requesterId = requesterId;
    this.executorId = deployExecutorId;
    this.schema = schema;
    this.toolVersion = toolVersion;
    this.deployTime = deployTime;
    this.init = init;
    this.rollback = rollback;
    this.productVersion = productVersion;
    this.reason = reason;
    this.attributes = attributes != null ? attributes : Sets.immutable.<DeployExecutionAttribute>empty();
}
 
Example #27
Source File: IqToH2TranslationDialect.java    From obevo with Apache License 2.0 5 votes vote down vote up
@Override
public ImmutableSet<String> getDisabledChangeTypeNames() {
    return Sets.immutable.with(
            ChangeType.DEFAULT_STR,
            ChangeType.FUNCTION_STR,
            ChangeType.RULE_STR,
            ChangeType.SP_STR,
            ChangeType.TRIGGER_STR,
            ChangeType.TRIGGER_INCREMENTAL_OLD_STR
    );
}
 
Example #28
Source File: IqToHsqlTranslationDialect.java    From obevo with Apache License 2.0 5 votes vote down vote up
@Override
public ImmutableSet<String> getDisabledChangeTypeNames() {
    return Sets.immutable.with(
            ChangeType.DEFAULT_STR,
            ChangeType.FUNCTION_STR,
            ChangeType.RULE_STR,
            ChangeType.SEQUENCE_STR,
            ChangeType.SP_STR,
            ChangeType.TRIGGER_STR,
            ChangeType.TRIGGER_INCREMENTAL_OLD_STR
    );
}
 
Example #29
Source File: ChangeKeyPredicateBuilderTest.java    From obevo with Apache License 2.0 5 votes vote down vote up
@Test
public void testObjectType() {
    Predicate<ChangeKey> tablePredicate =
            ChangeKeyPredicateBuilder.parseSinglePredicate("%~table");
    assertEquals(Sets.mutable.with(tableSch1ObjAChng1, tableSch1ObjAChng2, tableSch1ObjAChng3, tableSch1ObjBChng1, tableSch1ObjCChng1, tableSch2ObjAChng1),
            allChanges.select(tablePredicate).toSet());

    Predicate<ChangeKey> viewPredicate =
            ChangeKeyPredicateBuilder.parseSinglePredicate("%~view~%~%");
    assertEquals(Sets.mutable.with(viewSch1ObjD, viewSch1ObjE, viewSch2ObjF),
            allChanges.select(viewPredicate).toSet());
}
 
Example #30
Source File: TextMarkupDocumentReaderTest.java    From obevo with Apache License 2.0 5 votes vote down vote up
@Test
public void testSlash() {
    Pair<ImmutableMap<String, String>, ImmutableSet<String>> results = textMarkupDocumentReader.parseAttrsAndToggles(
            " 123  attr=\"abc\\def\"  \\  456=789"
    );

    if (legacyMode) {
        assertEquals(Maps.mutable.of("attr", "abc\\def", "456", "789"), results.getOne());
        assertEquals(Sets.mutable.of("123", "\\"), results.getTwo());
    } else {
        assertEquals(Maps.mutable.of("attr", "abc\\def", "456", "789"), results.getOne());
        assertEquals(Sets.mutable.of("123", "\\"), results.getTwo());
    }
}