org.eclipse.collections.impl.block.factory.Functions.getStringPassThru()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(108)

本文整理了Java中org.eclipse.collections.impl.block.factory.Functions.getStringPassThru()方法的一些代码示例,展示了Functions.getStringPassThru()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Functions.getStringPassThru()方法的具体详情如下:
包路径:org.eclipse.collections.impl.block.factory.Functions
类名称:Functions
方法名:getStringPassThru

Functions.getStringPassThru介绍

暂无

代码示例

代码示例来源:origin: goldmansachs/obevo

@Override
public Function<String, String> convertDbObjectName() {
  return Functions.getStringPassThru();
}

代码示例来源:origin: com.goldmansachs.obevo/obevo-mongodb

@Override
public Function<String, String> convertDbObjectName() {
  return Functions.getStringPassThru();
}

代码示例来源:origin: goldmansachs/obevo

@Before
public void setup() {
  when(tableChangeType.getName()).thenReturn(ChangeType.TABLE_STR);
  when(platform.getChangeType(ChangeType.TABLE_STR)).thenReturn(tableChangeType);
  when(platform.convertDbObjectName()).thenReturn(Functions.getStringPassThru());
}

代码示例来源:origin: goldmansachs/obevo

private void conversionTest(String testName, String platformName) {
    final File outputFolder = new File("./target/revengTest/" + testName);
    FileUtils.deleteQuietly(outputFolder);
    final ReladomoSchemaConverter reladomoSchemaConverter = new ReladomoSchemaConverter();

    final ChangeType tableChangeType = mock(ChangeType.class);
    when(tableChangeType.getName()).thenReturn(ChangeType.TABLE_STR);
    when(tableChangeType.getDirectoryName()).thenReturn("table");

    DbPlatform platform = mock(DbPlatform.class);
    when(platform.getName()).thenReturn(platformName);
    when(platform.getChangeType(ChangeType.TABLE_STR)).thenReturn(tableChangeType);
    when(platform.getObjectExclusionPredicateBuilder()).thenReturn(new ObjectTypeAndNamePredicateBuilder(ObjectTypeAndNamePredicateBuilder.FilterType.EXCLUDE));
    when(platform.convertDbObjectName()).thenReturn(Functions.getStringPassThru());

    reladomoSchemaConverter.convertDdlsToDaFormat(platform, new File("./src/test/resources/reveng/input/" + testName),
        outputFolder, "yourSchema", true, null);

    DirectoryAssert.assertDirectoriesEqual(new File("./src/test/resources/reveng/expected/" + testName), new File(outputFolder, "final"));
  }
}

代码示例来源:origin: goldmansachs/obevo

@Test
public void testCycleValidationWithIncrementalChanges() {
  this.enricher = new GraphEnricherImpl(Functions.getStringPassThru());
  SortableDependencyGroup sch1Obj1C1 = newChange(schema1, type1, "obj1", "c1", 0, null);
  SortableDependencyGroup sch1Obj1C2 = newChange(schema1, type1, "obj1", "c2", 1, Sets.immutable.<String>with("obj2"));
  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"));
  }
}

代码示例来源:origin: goldmansachs/obevo

@Test
public void testCycleValidation() {
  this.enricher = new GraphEnricherImpl(Functions.getStringPassThru());
  SortableDependencyGroup cyc1Obj1 = newChange(schema1, type1, "cyc1Obj1", Sets.immutable.with(schema2 + ".cyc1Obj3"));
  SortableDependencyGroup cyc1Obj2 = newChange(schema1, type2, "cyc1Obj2", Sets.immutable.with("cyc1Obj1"));
  SortableDependencyGroup cyc1Obj3 = newChange(schema2, type1, "cyc1Obj3", Sets.immutable.with(schema1 + ".cyc1Obj2", schema2 + ".cyc1Obj4", schema2 + ".notcyc1ObjB"));
  SortableDependencyGroup cyc1Obj4 = newChange(schema2, type1, "cyc1Obj4", Sets.immutable.with(schema2 + ".cyc1Obj5"));
  SortableDependencyGroup cyc1Obj5 = newChange(schema2, type1, "cyc1Obj5", Sets.immutable.with(schema2 + ".cyc1Obj3"));
  SortableDependencyGroup notcyc1ObjA = newChange(schema2, type1, "notcyc1ObjA", Sets.immutable.with(schema2 + ".cyc1Obj3"));  // inbound edge to cycle, but not in it
  SortableDependencyGroup notcyc1ObjB = newChange(schema2, type1, "notcyc1ObjB", Sets.immutable.<String>with());  // outbound edge from cycle, but not in it
  SortableDependencyGroup cyc2Obj1 = newChange(schema2, type1, "cyc2Obj1", Sets.immutable.with(schema2 + ".cyc2Obj2"));
  SortableDependencyGroup cyc2Obj2 = newChange(schema2, type1, "cyc2Obj2", Sets.immutable.with(schema2 + ".cyc2Obj3"));
  SortableDependencyGroup cyc2Obj3 = newChange(schema2, type1, "cyc2Obj3", Sets.immutable.with(schema2 + ".cyc2Obj1"));
  SortableDependencyGroup loneObj1 = newChange(schema2, type1, "loneObj1", Sets.immutable.<String>with());
  try {
    enricher.createDependencyGraph(Lists.mutable.with(
        cyc1Obj1, cyc1Obj2, cyc1Obj3, cyc1Obj4, cyc1Obj5, notcyc1ObjA, notcyc1ObjB, cyc2Obj1, cyc2Obj2, cyc2Obj3, loneObj1), 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"));
  }
}

代码示例来源:origin: goldmansachs/obevo

/**
 * 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 ? StringFunctions.toUpperCase() : Functions.getStringPassThru());
  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"));
  DirectedGraph<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));
}

代码示例来源:origin: goldmansachs/obevo

private void testSchemaObjectChangeDependencies(boolean caseInsensitive, boolean rollback) {
  this.enricher = new GraphEnricherImpl(caseInsensitive ? StringFunctions.toUpperCase() : Functions.getStringPassThru());

相关文章