Package com.dotmarketing.portlets.structure.model

Examples of com.dotmarketing.portlets.structure.model.Structure


     */
    @Test
    public void getStructureByInode () {

        //Getting a known structure
        Structure structure = structures.iterator().next();

        //Search the structure
        Structure foundStructure = StructureFactory.getStructureByInode( structure.getInode() );

        //Validations
        assertNotNull( foundStructure );
        assertEquals( foundStructure.getInode(), structure.getInode() );
    }
View Full Code Here


     */
    @Test
    public void getStructureByType () {

        //Getting a known structure
        Structure structure = structures.iterator().next();

        //Search the structure
        //TODO: The method is called getStructureByType but it actually search by name...
        Structure foundStructure = StructureFactory.getStructureByType( structure.getName() );

        //Validations
        assertNotNull( foundStructure );
        assertEquals( foundStructure.getInode(), structure.getInode() );
    }
View Full Code Here

     */
    @Test
    public void getStructureByVelocityVarName () {

        //Getting a known structure
        Structure structure = structures.iterator().next();

        //Search the structure
        Structure foundStructure = StructureFactory.getStructureByVelocityVarName( structure.getVelocityVarName() );

        //Validations
        assertNotNull( foundStructure );
        assertEquals( foundStructure.getInode(), structure.getInode() );
    }
View Full Code Here

     */
    @Test
    public void getDefaultStructure () {

        //Getting the default structure
        Structure defaultStructure = StructureFactory.getDefaultStructure();

        //Validations
        assertNotNull( defaultStructure );
        assertNotNull( defaultStructure.getInode() );
    }
View Full Code Here

        //Validations
        assertTrue( variablesNames != null && !variablesNames.isEmpty() );

        //Validate the variable names
        Structure structure = StructureFactory.getStructureByVelocityVarName( variablesNames.iterator().next() );

        //Validations
        assertTrue( structure != null && structure.getInode() != null );
    }
View Full Code Here

        //Validations
        assertTrue( structuresCollection != null && !structuresCollection.isEmpty() );

        //Validate the integrity of the array
        Structure structure = StructureFactory.getStructureByVelocityVarName( structuresCollection.iterator().next().getVelocityVarName() );

        //Validations
        assertTrue( structure != null && structure.getInode() != null );
    }
View Full Code Here

     */
    @Test
    public void getStructuresByUser () {

        //Getting a known structure
        Structure structure = structures.iterator().next();

        //Search for the structures
        Collection<Structure> structures = StructureFactory.getStructuresByUser( user, "structuretype=" + structure.getStructureType(), "upper(name)", 0, 0, "asc" );

        //Validations
        assertTrue( structures != null && !structures.isEmpty() );
    }
View Full Code Here

     */
    @Test
    public void structures () throws DotDataException {

        //Create the new structures
        Structure testStructure1 = new Structure();

        testStructure1.setDefaultStructure( false );
        testStructure1.setDescription( "JUnit Test Structure Description." );
        testStructure1.setFixed( false );
        testStructure1.setIDate( new Date() );
        testStructure1.setName( "JUnit Test Structure_4" );
        testStructure1.setOwner( user.getUserId() );
        testStructure1.setDetailPage( "" );
        testStructure1.setStructureType( Structure.STRUCTURE_TYPE_CONTENT );
        testStructure1.setSystem( true );
        testStructure1.setType( "structure" );
        testStructure1.setVelocityVarName( "junit_test_structure_4" );

        Structure testStructure2 = new Structure();

        testStructure2.setDefaultStructure( false );
        testStructure2.setDescription( "JUnit Test Structure Description." );
        testStructure2.setFixed( false );
        testStructure2.setIDate( new Date() );
        testStructure2.setName( "JUnit Test Structure_5" );
        testStructure2.setOwner( user.getUserId() );
        testStructure2.setDetailPage( "" );
        testStructure2.setStructureType( Structure.STRUCTURE_TYPE_CONTENT );
        testStructure2.setSystem( true );
        testStructure2.setType( "structure" );
        testStructure2.setVelocityVarName( "junit_test_structure_5" );

        //++++++++++++++++++++++++++++++++++++++++++++
        //Saving the structures
        StructureFactory.saveStructure( testStructure1 );
        StructureFactory.saveStructure( testStructure2 );

        //Validations
        assertNotNull( testStructure1.getInode() );
        assertNotNull( testStructure2.getInode() );

        //++++++++++++++++++++++++++++++++++++++++++++
        //Getting the structure we just saved
        Structure savedStructure = StructureFactory.getStructureByInode( testStructure1.getInode() );

        //Validations
        assertEquals( testStructure1.getInode(), savedStructure.getInode() );

        //++++++++++++++++++++++++++++++++++++++++++++
        //Updating the structure
        String updatedName = "UPDATED --- " + savedStructure.getName();
        savedStructure.setName( updatedName );
        StructureFactory.saveStructure( savedStructure );

        //Getting again the saved structure
        testStructure1 = StructureFactory.getStructureByInode( savedStructure.getInode() );

        //Validations
        assertNotNull( testStructure1.getInode() );
        assertEquals( testStructure1.getName(), updatedName );

        //++++++++++++++++++++++++++++++++++++++++++++
        //Delete the structure
        String inode = savedStructure.getInode();
        StructureFactory.deleteStructure( inode );

        //Verify what we just deleted
        Structure tempStructure = StructureFactory.getStructureByInode( inode );

        //validations
        assertTrue( tempStructure == null || tempStructure.getInode() == null || tempStructure.getInode().isEmpty() );

        //++++++++++++++++++++++++++++++++++++++++++++
        //Delete the structure
        inode = testStructure2.getInode();
        StructureFactory.deleteStructure( testStructure2 );

        //Verify what we just deleted
        tempStructure = StructureFactory.getStructureByInode( inode );

        //validations
        assertTrue( tempStructure == null || tempStructure.getInode() == null || tempStructure.getInode().isEmpty() );
    }
View Full Code Here

     */
    @Test
    public void disableDefault () throws DotHibernateException {

        //Getting the default structure
        Structure defaultStructure = StructureFactory.getDefaultStructure();

        if ( defaultStructure.getInode() == null || defaultStructure.getInode().isEmpty() ) {
            //Getting a known structure and make it the default
            defaultStructure = structures.iterator().next();
            defaultStructure.setDefaultStructure( true );
            StructureFactory.saveStructure( defaultStructure );
        }

        //Disable the default structure
        StructureFactory.disableDefault();

        //Getting the one that was the default
        defaultStructure = StructureFactory.getStructureByInode( defaultStructure.getInode() );

        //Validations
        assertFalse( defaultStructure.isDefaultStructure() );

        //Set the default structure back to normal
        defaultStructure.setDefaultStructure( true );
        StructureFactory.saveStructure( defaultStructure );
    }
View Full Code Here

     */
    @Test
    public void getTotalDates () {

        //Getting a known structure
        Structure structure = structures.iterator().next();

        //Getting all the date fields for this structure
        int totalDates = StructureFactory.getTotalDates( structure );

        //Validations
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.structure.model.Structure

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.