本文整理汇总了Java中org.eclipse.collections.api.list.ImmutableList.get方法的典型用法代码示例。如果您正苦于以下问题:Java ImmutableList.get方法的具体用法?Java ImmutableList.get怎么用?Java ImmutableList.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.collections.api.list.ImmutableList
的用法示例。
在下文中一共展示了ImmutableList.get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readFileWithMetaAndDrop
import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
@Test
public void readFileWithMetaAndDrop() throws Exception {
RerunnableChangeParser parser = new RerunnableChangeParser();
String fileContent = "\n" +
"//// METADATA dependencies=\"abc,123\"\n" +
"mycontent\n" +
"line2\n" +
"//// DROP_COMMAND\n" +
"mydrop" +
"";
ImmutableList<Change> changes = parser.value(mock(ChangeType.class), null, fileContent, objectName, "schema", null);
Verify.assertSize(1, changes);
Change change = changes.get(0);
assertEquals(objectName, change.getObjectName());
assertEquals("mycontent\nline2", change.getContent());
assertEquals(Sets.immutable.with(new CodeDependency("abc", CodeDependencyType.EXPLICIT), new CodeDependency("123", CodeDependencyType.EXPLICIT)), change.getCodeDependencies());
assertEquals("mydrop", change.getDropContent());
}
示例2: readFileWithBody
import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
@Test
public void readFileWithBody() throws Exception {
RerunnableChangeParser parser = new RerunnableChangeParser();
String fileContent =
"main\n" +
"//// BODY\n" +
"body content\n" +
"";
ChangeType mainChangeType = mock(ChangeType.class);
ChangeType bodyChangeType = mock(ChangeType.class);
when(mainChangeType.getBodyChangeType()).thenReturn(bodyChangeType);
ImmutableList<Change> changes = parser.value(mainChangeType, null, fileContent, objectName, "schema", null);
Verify.assertSize(2, changes);
Change c1 = changes.get(0);
assertEquals(objectName, c1.getObjectName());
assertEquals("main", c1.getContent());
Change c2 = changes.get(1);
assertEquals(objectName, c2.getObjectName());
assertEquals("body", c2.getChangeName());
assertEquals("body content", c2.getContent());
}
示例3: findTableChanges
import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
private ImmutableList<Change> findTableChanges(ChangeType changeType, FileObject tableDir, String schema, boolean useBaseline) {
WildcardFileFilter baselineFilter = new WildcardFileFilter("*.baseline.*");
ImmutableList<FileObject> nonBaselineFiles = findFiles(tableDir,
this.isUsingChangesConvention(tableDir) ? CHANGES_WILDCARD_FILTER : new NotFileFilter(baselineFilter));
ImmutableList<Change> nonBaselineChanges = parseChanges(changeType, nonBaselineFiles, this.tableChangeParser, schema);
ImmutableListMultimap<String, Change> nonBaselineChangeMap = nonBaselineChanges
.groupBy(Change.TO_DB_OBJECT_KEY);
if (useBaseline) {
LOG.info("Using the 'useBaseline' mode to read in the db changes");
ImmutableList<FileObject> baselineFiles = findFiles(tableDir,
this.isUsingChangesConvention(tableDir) ? CHANGES_WILDCARD_FILTER : baselineFilter);
ImmutableList<Change> baselineChanges = parseChanges(changeType, baselineFiles, this.baselineTableChangeParser, schema);
for (Change baselineChange : baselineChanges) {
ImmutableList<Change> regularChanges = nonBaselineChangeMap.get(baselineChange
.getDbObjectKey());
if (regularChanges.isEmpty()) {
throw new IllegalArgumentException("Invalid state - expecting a change here for this object key: "
+ baselineChange.getDbObjectKey());
}
Change regularChange = regularChanges.get(0);
this.copyDbObjectMetadataOverToBaseline(regularChange, baselineChange);
}
MutableSet<String> baselineDbObjectKeys = baselineChanges.collect(Change.TO_DB_OBJECT_KEY)
.toSet();
LOG.info("Found the following baseline changes: will try to deploy via baseline for these db objects: "
+ baselineDbObjectKeys.makeString(","));
nonBaselineChanges = nonBaselineChanges
.reject(Predicates.attributeIn(Change.TO_DB_OBJECT_KEY, baselineDbObjectKeys))
.newWithAll(baselineChanges);
}
return nonBaselineChanges;
}
示例4: readSimpleFile
import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
@Test
public void readSimpleFile() throws Exception {
RerunnableChangeParser parser = new RerunnableChangeParser();
String fileContent = "\n" +
"mycontent" +
"";
ImmutableList<Change> changes = parser.value(mock(ChangeType.class), null, fileContent, objectName, "schema", null);
Verify.assertSize(1, changes);
Change change = changes.get(0);
assertEquals(objectName, change.getObjectName());
assertEquals("\nmycontent", change.getContent());
assertEquals(null, change.getDropContent());
}
示例5: testSchemaExtraction
import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
@Test
public void testSchemaExtraction() {
ImmutableList<AbstractDdlReveng.RevengPattern> patterns = Db2lookReveng.getRevengPatterns().select(Predicates.attributeEqual(AbstractDdlReveng.RevengPattern.TO_CHANGE_TYPE, "VIEW"));
AbstractDdlReveng.RevengPattern revengPattern = patterns.get(0);
assertEquals("MYVIEW", revengPattern.evaluate("CREATE or REPLACE VIEW SCHEMA.MYVIEW AS ABC DEF GHI").getPrimaryName());
assertEquals("MYVIEW", revengPattern.evaluate("CREATE or REPLACE VIEW \"SCHEMA\".\"MYVIEW\" AS ABC DEF GHI").getPrimaryName());
assertEquals("MYVIEW", revengPattern.evaluate("CREATE or REPLACE VIEW MYVIEW AS ABC DEF GHI").getPrimaryName());
assertEquals("MYVIEW", revengPattern.evaluate("CREATE or REPLACE VIEW \"MYVIEW\" AS ABC DEF GHI").getPrimaryName());
}
示例6: convertCfgToSchema
import org.eclipse.collections.api.list.ImmutableList; //导入方法依赖的package包/类
private Function<HierarchicalConfiguration, Schema> convertCfgToSchema(final DbPlatform systemDbPlatform, final int schemaNameValidation) {
return new Function<HierarchicalConfiguration, Schema>() {
private static final long serialVersionUID = 1L;
@Override
public Schema valueOf(HierarchicalConfiguration object) {
String schemaName = object.getString("[@name]");
if (schemaNameValidation >= 2) {
validateSchemaName(schemaName);
}
boolean readOnly = object.getBoolean("[@readOnly]", false);
MutableSetMultimap<String, String> excludedNameMap = Multimaps.mutable.set.empty();
ImmutableList<HierarchicalConfiguration> excludes = iterConfig(object, "excludes");
if (!excludes.isEmpty()) {
if (excludes.size() > 1) {
throw new IllegalArgumentException("Only expecting 1 excludes element under <schema>");
}
HierarchicalConfiguration excludesConfig = excludes.get(0);
if (excludesConfig != null) {
for (ChangeType changeType : systemDbPlatform.getChangeTypes()) {
ImmutableList<String> excludedNames = iterString(excludesConfig, changeType.getName().toLowerCase());
if (excludedNames.notEmpty()) {
excludedNameMap.putAll(changeType.getName(), excludedNames);
}
ImmutableList<String> excludedPatterns = iterString(excludesConfig, changeType.getName().toLowerCase() + "Pattern");
if (excludedPatterns.notEmpty()) {
throw new IllegalArgumentException("The <objectType>Pattern element is deprecated. Use just the <objectType> element w/ wildcards (% or *)");
}
}
if (iterString(excludesConfig, "procedure").notEmpty() || iterString(excludesConfig, "procedurePattern").notEmpty()) {
throw new IllegalArgumentException("The procedure and procedurePattern elements are no longer supported. Use <sp> only, with wildcards (% or *) if needed");
}
}
}
return new Schema(schemaName, systemDbPlatform.getObjectExclusionPredicateBuilder().add(excludedNameMap.toImmutable()), readOnly);
}
};
}