Package org.exolab.castor.builder.info

Examples of org.exolab.castor.builder.info.FieldInfo


    /**
     * Tests get and set of read only.
     */
    public void testReadOnly() {
        FieldInfoFactory factory = new FieldInfoFactory();
        FieldInfo flat = factory.createFieldInfo(
                new XSClass(new JClass("House")), "flat");
        flat.addNature(JDOOneToManyNature.class.getName());
        JDOOneToManyNature relation = new JDOOneToManyNature(flat);
        relation.setReadOnly(true);
        assertEquals(true, relation.isReadOnly());
    }
View Full Code Here


    /**
     * Tests get and set of dirty.
     */
    public void testDirty() {
        FieldInfoFactory factory = new FieldInfoFactory();
        FieldInfo flat = factory.createFieldInfo(
                new XSClass(new JClass("House")), "flat");
        flat.addNature(JDOOneToManyNature.class.getName());
        JDOOneToManyNature jdo = new JDOOneToManyNature(flat);
        jdo.setDirty(true);
        assertEquals(true, jdo.isDirty());
    }
View Full Code Here

         *  - firstName
         *  - lastName
         */
        assertEquals(3, cInfo.getFieldCount());

        FieldInfo fInfo = cInfo.getElementField("ssnr");

        assertNotNull(fInfo);

        JDOFieldInfoNature fNature = new JDOFieldInfoNature(fInfo);

View Full Code Here

                 *  - title
                 */
                assertEquals(3, cInfo.getFieldCount());

                // FieldInfo for coverType
                FieldInfo fInfo = cInfo.getAttributeField("coverType");
               
                assertNotNull(fInfo);
               
                fInfo.addNature(JDOFieldInfoNature.class.getName());
                JDOFieldInfoNature fNature = new JDOFieldInfoNature(fInfo);
               
                assertEquals("cover_type", fNature.getColumnName());
                assertEquals("varchar", fNature.getColumnType());
               
View Full Code Here

                FieldInfo[] fInfos = cInfo.getElementFields();
               
                assertNotNull(fInfos);
               
                for (int j = 0; j < fInfos.length; ++j) {
                    FieldInfo fInfo = fInfos[j];
                    assertNotNull(fInfo);
                    JDOFieldInfoNature fNature = new JDOFieldInfoNature(fInfo);
                    assertNotNull(fNature);
                   
                    String columnName = fNature.getColumnName();
                    String columnType = fNature.getColumnType();
                   
                    XMLInfoNature xmlFieldNature = new XMLInfoNature(fInfo);
                   
                    if (xmlFieldNature.getNodeName().equals("ssn")) {   
                        assertEquals("ssn", columnName);
                        assertEquals("bigint", columnType);
                    } else if (xmlFieldNature.getNodeName().equals("firstName")) {
                        assertEquals("firstName", columnName);
                        assertEquals("varchar", columnType);
                    } else if (xmlFieldNature.getNodeName().equals("lastName")) {
                        assertEquals("lastName", columnName);
                        assertEquals("varchar", columnType);
                    } else if (xmlFieldNature.getNodeName().equals("birthdate")) {
                        assertEquals("birthdate", columnName);
                        assertEquals("date", columnType);
                    } else {
                        fail("Unexpected FieldInfo Element encountered!");
                    }
                }
            } else if (xmlNature.getNodeName().equals("insurant")) {
                String tableName = cNature.getTableName();
                assertEquals("insurant", tableName);
               
                List primaryKeys = cNature.getPrimaryKeys();
               
                assertEquals(2, primaryKeys.size());
                assertEquals("ssn", (String) primaryKeys.get(0));
                assertEquals("policyNumber", (String) primaryKeys.get(1));
               
                assertEquals(1, cInfo.getFieldCount());
               
                FieldInfo fInfo = cInfo.getElementField("policyNumber");
               
                assertNotNull(fInfo);
               
                JDOFieldInfoNature fNature = new JDOFieldInfoNature(fInfo);
               
View Full Code Here

    /**
     * Tests get and set of column name.
     */
    public void testColumnName() {
        FieldInfoFactory factory = new FieldInfoFactory();
        FieldInfo isbn = factory.createFieldInfo(
                new XSClass(new JClass("Book")), "isbn");
        isbn.addNature(JDOFieldInfoNature.class.getName());
        JDOFieldInfoNature jdo = new JDOFieldInfoNature(isbn);

        jdo.setColumnName("ISBN");
        assertEquals("ISBN", jdo.getColumnName());

View Full Code Here

    /**
     * Tests get and set of column type.
     */
    public void testColumnType() {
        FieldInfoFactory factory = new FieldInfoFactory();
        FieldInfo isbn = factory.createFieldInfo(
                new XSClass(new JClass("Book")), "isbn");
        isbn.addNature(JDOFieldInfoNature.class.getName());
        JDOFieldInfoNature jdo = new JDOFieldInfoNature(isbn);

        jdo.setColumnType("varchar");
        assertEquals("varchar", jdo.getColumnType());
    }
View Full Code Here

    /**
     * Tests get and set of read only.
     */
    public void testReadOnly() {
        FieldInfoFactory factory = new FieldInfoFactory();
        FieldInfo isbn = factory.createFieldInfo(
                new XSClass(new JClass("Book")), "isbn");
        isbn.addNature(JDOFieldInfoNature.class.getName());
        JDOFieldInfoNature jdo = new JDOFieldInfoNature(isbn);
        jdo.setReadOnly(true);
        assertEquals(true, jdo.isReadOnly());
    }
View Full Code Here

    /**
     * Tests get and set of dirty.
     */
    public void testDirty() {
        FieldInfoFactory factory = new FieldInfoFactory();
        FieldInfo isbn = factory.createFieldInfo(
                new XSClass(new JClass("Book")), "isbn");
        isbn.addNature(JDOFieldInfoNature.class.getName());
        JDOFieldInfoNature jdo = new JDOFieldInfoNature(isbn);
        jdo.setDirty(true);
        assertEquals(true, jdo.isDirty());
    }
View Full Code Here

     * Tests if getFields returns a list of {@link JDOFieldInfoNature}s.
     */
    public void testGetElementFields() {
        ClassInfo classInfo = new ClassInfo(new JClass("test"));
        FieldInfoFactory factory = new FieldInfoFactory();
        FieldInfo field = factory.createFieldInfo(new XSClass(
                new JClass("Book")), "isbn");
        field.addNature(JDOFieldInfoNature.class.getName());
        JDOFieldInfoNature jdoField = new JDOFieldInfoNature(field);
        jdoField.setColumnName("isbn");
        jdoField.setColumnType("integer");
        classInfo.addFieldInfo(field);
        classInfo.addNature(JDOClassInfoNature.class.getName());
View Full Code Here

TOP

Related Classes of org.exolab.castor.builder.info.FieldInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.