use of net.jangaroo.exml.model.ConfigClass in project jangaroo-tools by CoreMedia.
the class ConfigClassBuilderTest method testBuildConfigClass.
@Test
public void testBuildConfigClass() throws Exception {
ConfigClass configClass = buildConfigClass("/testNamespace/config/testComponent.as", "expected");
Assert.assertEquals("testNamespace.config", configClass.getPackageName());
Assert.assertEquals("testComponent", configClass.getName());
Assert.assertEquals("testPackage.TestComponent", configClass.getComponentClassName());
Assert.assertEquals("This is a TestComponent with panel as baseclass. <p>This class serves as a typed config object for the constructor of the class <code>testPackage.TestComponent</code>. It defines the EXML element <code><tc:testComponent></code> with <code>xmlns:tc=\"exml:testNamespace.config\"</code>.</p> <p>Using this config class also takes care of registering the target class under the xtype <code>\"testNamespace.config.testComponent\"</code> with Ext JS.</p> @see testPackage.TestComponent @see ext.Panel", configClass.getDescription());
Set<String> attributeNames = new HashSet<String>();
for (ConfigAttribute configAttribute : configClass.getCfgs()) {
attributeNames.add(configAttribute.getName());
if ("propertyOne".equals(configAttribute.getName())) {
Assert.assertEquals("Boolean", configAttribute.getType());
Assert.assertEquals("Some Boolean property @see Boolean", configAttribute.getDescription());
}
if ("propertyTwo".equals(configAttribute.getName())) {
Assert.assertEquals("Number", configAttribute.getType());
Assert.assertEquals("Some Number property", configAttribute.getDescription());
}
}
Assert.assertEquals(new HashSet<String>(Arrays.asList("propertyOne", "propertyTwo", "propertyThree", "propertyFour", "propertyFive", "propertySix", "propertySeven", "propertyEight", "propertyNine", "propertyTen", "propertyEleven", "propertyTwelve", "property13", "property14")), attributeNames);
}
use of net.jangaroo.exml.model.ConfigClass in project jangaroo-tools by CoreMedia.
the class ConfigClassBuilderTest method testBuildNonConfigClass.
@Test
public void testBuildNonConfigClass() throws Exception {
ConfigClass configClass = buildConfigClass("/testNamespace/config/NonConfig.as", "test-module");
Assert.assertNull(configClass);
}
use of net.jangaroo.exml.model.ConfigClass in project jangaroo-tools by CoreMedia.
the class ConfigClassRegistryTest method testScanInitially.
@Test
public void testScanInitially() throws Exception {
setUp("testNamespace.config");
ConfigClass configClass = getConfigClassRegistry().getConfigClassByName("testNamespace.config.testLabel");
Assert.assertNotNull(configClass);
Assert.assertEquals("testNamespace.config", configClass.getPackageName());
Assert.assertEquals("testPackage.TestLabel", configClass.getComponentClassName());
ConfigClass labelConfigClass = getConfigClassRegistry().getConfigClassByName("ext.config.label");
Assert.assertNotNull(labelConfigClass);
Assert.assertEquals("ext.config.label", labelConfigClass.getFullName());
Assert.assertEquals(labelConfigClass, configClass.getSuperClass());
Assert.assertEquals(1, configClass.getCfgs().size());
}
use of net.jangaroo.exml.model.ConfigClass in project jangaroo-tools by CoreMedia.
the class ConfigClassRegistryTest method testGenerateFromExml.
@Test
public void testGenerateFromExml() throws Exception {
setUp("testNamespace.config");
ConfigClass configClass = getConfigClassRegistry().getConfigClassByName("testNamespace.config.testLabel");
Assert.assertNotNull(configClass);
Assert.assertEquals("testNamespace.config", configClass.getPackageName());
Assert.assertEquals("testPackage.TestLabel", configClass.getComponentClassName());
Assert.assertEquals(1, configClass.getCfgs().size());
// 2nd try should return the same object
Assert.assertEquals(configClass, getConfigClassRegistry().getConfigClassByName("testNamespace.config.testLabel"));
}
use of net.jangaroo.exml.model.ConfigClass in project jangaroo-tools by CoreMedia.
the class ConfigClassRegistryTest method testGenerateFromExmlWithPregeneratedActionScript.
@Test
public void testGenerateFromExmlWithPregeneratedActionScript() throws Exception {
setUp("testNamespace.config", "/expected", "/ext-as");
File destDir = new File(outputFolder.getRoot(), "testNamespace/config");
destDir.mkdirs();
FileUtils.copyFileToDirectory(new File(getConfigClassRegistry().getConfig().getSourcePath().get(0), "testNamespace/config/testComponent.as"), destDir);
ConfigClass configClass = getConfigClassRegistry().getConfigClassByName("testNamespace.config.testComponent");
Assert.assertNotNull(configClass);
Assert.assertEquals("testNamespace.config", configClass.getPackageName());
Assert.assertEquals("testPackage.TestComponent", configClass.getComponentClassName());
Assert.assertEquals(14, configClass.getCfgs().size());
// 2nd try should return the same object
Assert.assertEquals(configClass, getConfigClassRegistry().getConfigClassByName("testNamespace.config.testComponent"));
}
Aggregations