@Test public void generateCompositeId_null_empty() { RegistryUtil util = new RegistryUtil(); assertNull(util.generateCompositeId()); assertNull(util.generateCompositeId(null)); assertEquals("$NULL$~$EMPTY$~ ~ ", util.generateCompositeId(null, "", " ", " ")); }
@Test public void testTypedId() { RegistryUtil util = new RegistryUtil(); String id = util.generateTypedId("name1", "type1"); String parts[] = util.splitCompositeId(id); assertEquals("Wrong number of parts", 2, parts.length); assertEquals("Document name is wrong", "type1", parts[0]); assertEquals("Document id is wrong", "name1", parts[1]); }
@Test public void generateCompositeId() { RegistryUtil util = new RegistryUtil(); String id = util.generateCompositeId("test"); assertEquals("test", id); id = util.generateCompositeId("a", "b", "c"); assertEquals("a~b~c", id); }
@Test public void testTableId() { RegistryUtil util = new RegistryUtil(); String id = util.generateTableId("database1", null, "table1"); String parts[] = util.splitCompositeId(id); assertEquals("Wrong number of parts", 3, parts.length); assertEquals("Database name is wrong", "database1", parts[0]); assertEquals("Schema name is wrong", null, parts[1]); assertEquals("Table name is wrong", "table1", parts[2]); id = util.generateTableId("database1", "", "table1"); parts = util.splitCompositeId(id); assertEquals("Database name is wrong", "database1", parts[0]); assertEquals("Schema name is wrong", "", parts[1]); assertEquals("Table name is wrong", "table1", parts[2]); }
public ModelImportWizard( Class<? extends MApplicationElement> applicationElement, AbstractComponentEditor editor, String hint, IResourcePool resourcePool) { this.applicationElement = applicationElement; this.editor = editor; this.hint = hint; this.application = (MApplication) editor.getEditor().getModelProvider().getRoot().get(0); setWindowTitle("Model " + applicationElement.getSimpleName() + " Import Wizard"); setDefaultPageImageDescriptor( ImageDescriptor.createFromImage( resourcePool.getImageUnchecked(ResourceProvider.IMG_Wizban16_imp3x_wiz))); Assert.isNotNull( RegistryUtil.getStruct(applicationElement, getHint()), "Unknown Element: " + applicationElement.getClass().getName()); }
/** * @return the extension point id associated with the {@link MApplicationElement} that is passed * in the constructor of this wizard. * @see #MAPPING_EXTENSION * @see #getApplicationElement() */ protected String getExtensionPoint() { return RegistryUtil.getStruct(applicationElement, getHint()).getExtensionPoint(); }
/** * Returns the list of {@link MApplicationElement}s of the type passed in the constructor of the * wizard. * * @param <T> * @return */ public MApplicationElement[] getElements(Class<? extends MApplicationElement> type) { return RegistryUtil.getModelElements( type, getHint(), application, page1.getConfigurationElements()); }
/** * @return the attribute name of the {@link IConfigurationElement} that contains the description * that you want to see in the wizard page. * @see #MAPPING_NAME */ protected String getMappingName() { return RegistryUtil.getStruct(applicationElement, getHint()).getMappingName(); }
@Test public void splitCompositeId_null_empty() { RegistryUtil util = new RegistryUtil(); assertNull(util.splitCompositeId(null)); assertArrayEquals(new String[] {" ", null, ""}, util.splitCompositeId(" ~$NULL$~$EMPTY$")); }
@Test public void splitCompositeId() { RegistryUtil util = new RegistryUtil(); assertArrayEquals(new String[] {"a"}, util.splitCompositeId("a")); assertArrayEquals(new String[] {"a", "b", "c"}, util.splitCompositeId("a~b~c")); }