Package com.dtolabs.rundeck.core.common

Examples of com.dtolabs.rundeck.core.common.INodeSet


        props.setProperty("directory", directory.getAbsolutePath());
        DirectoryResourceModelSource.Configuration config = new DirectoryResourceModelSource.Configuration(props);
        final DirectoryResourceModelSource directoryNodesProvider = new DirectoryResourceModelSource(getFrameworkInstance());
        directoryNodesProvider.configure(config);

        final INodeSet nodes = directoryNodesProvider.getNodes();
        assertNotNull(nodes);
        assertEquals(0, nodes.getNodes().size());
        FileUtils.deleteDir(directory);
    }
View Full Code Here


        props.setProperty("directory", directory.getAbsolutePath());
        DirectoryResourceModelSource.Configuration config = new DirectoryResourceModelSource.Configuration(props);
        final DirectoryResourceModelSource directoryNodesProvider = new DirectoryResourceModelSource(getFrameworkInstance());
        directoryNodesProvider.configure(config);

        final INodeSet nodes = directoryNodesProvider.getNodes();
        assertNotNull(nodes);
        assertEquals(0, nodes.getNodes().size());
        FileUtils.deleteDir(directory);
    }
View Full Code Here

        props.setProperty("directory", directory.getAbsolutePath());
        DirectoryResourceModelSource.Configuration config = new DirectoryResourceModelSource.Configuration(props);
        final DirectoryResourceModelSource directoryNodesProvider = new DirectoryResourceModelSource(getFrameworkInstance());
        directoryNodesProvider.configure(config);

        final INodeSet nodes = directoryNodesProvider.getNodes();
        assertNotNull(nodes);
        assertEquals(2, nodes.getNodes().size());
        assertNotNull(nodes.getNode("test1"));
        assertNotNull(nodes.getNode("testnode2"));
        FileUtils.deleteDir(directory);
    }
View Full Code Here

        props.setProperty("directory", directory.getAbsolutePath());
        DirectoryResourceModelSource.Configuration config = new DirectoryResourceModelSource.Configuration(props);
        final DirectoryResourceModelSource directoryNodesProvider = new DirectoryResourceModelSource(getFrameworkInstance());
        directoryNodesProvider.configure(config);

        final INodeSet nodes = directoryNodesProvider.getNodes();
        assertNotNull(nodes);
        assertEquals(3, nodes.getNodes().size());
        assertNotNull(nodes.getNode("test1"));
        assertNotNull(nodes.getNode("testnode2"));
        assertNotNull(nodes.getNode("testyaml1"));
        FileUtils.deleteDir(directory);
    }
View Full Code Here

        props.setProperty("directory", directory.getAbsolutePath());
        DirectoryResourceModelSource.Configuration config = new DirectoryResourceModelSource.Configuration(props);
        final DirectoryResourceModelSource directoryNodesProvider = new DirectoryResourceModelSource(getFrameworkInstance());
        directoryNodesProvider.configure(config);

        final INodeSet nodes = directoryNodesProvider.getNodes();
        assertNotNull(nodes);
        assertEquals(3, nodes.getNodes().size());
        assertNotNull(nodes.getNode("test1"));
        assertNotNull(nodes.getNode("testnode2"));
        assertNotNull(nodes.getNode("testyaml1"));

        assertEquals("a description", nodes.getNode("testyaml1").getDescription());

        //now sleep 100ms, modify file
        Thread.sleep(10001);
        final BufferedWriter bufferedWriter2 = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
            (file2))));
        bufferedWriter2.write("testyaml1: \n"
                             + "  hostname: test\n"
                             + "  description: a new description\n"
                             + "  tags: a, b, c\n"
                             + "  osArch: x86_64\n"
                             + "  osFamily: unix\n"
                             + "  osVersion: 10.6.5\n"
                             + "  osName: Mac OS X\n"
                             + "  username: a user\n"
                             + "testyaml2: \n"
                             + "  hostname: test\n"
                             + "  description: a description\n"
                             + "  tags: a, b, c\n"
                             + "  osArch: x86_64\n"
                             + "  osFamily: unix\n"
                             + "  osVersion: 10.6.5\n"
                             + "  osName: Mac OS X\n"
                             + "  username: a user\n");
        bufferedWriter2.flush();
        bufferedWriter2.close();


        final INodeSet nodes2 = directoryNodesProvider.getNodes();
        assertNotNull(nodes2);
        assertEquals(4, nodes2.getNodes().size());
        assertNotNull(nodes2.getNode("test1"));
        assertNotNull(nodes2.getNode("testnode2"));
        assertNotNull(nodes2.getNode("testyaml1"));
        assertNotNull(nodes2.getNode("testyaml2"));

        assertEquals("a new description", nodes2.getNode("testyaml1").getDescription());
        FileUtils.deleteDir(directory);
    }
View Full Code Here

        directoryNodesProvider.configure(config);

        File file2 = new File(directory, "test1.yaml");
        assertFalse(file2.exists());
       
        final INodeSet nodes = directoryNodesProvider.getNodes();
        assertNotNull(nodes);
        assertEquals(2, nodes.getNodes().size());
        assertNotNull(nodes.getNode("test1"));
        assertNotNull(nodes.getNode("testnode2"));

        //add a new file

        final BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
            (file2))));
        bufferedWriter.write("testyaml1: \n"
                             + "  hostname: test\n"
                             + "  description: a description\n"
                             + "  tags: a, b, c\n"
                             + "  osArch: x86_64\n"
                             + "  osFamily: unix\n"
                             + "  osVersion: 10.6.5\n"
                             + "  osName: Mac OS X\n"
                             + "  username: a user\n");
        bufferedWriter.flush();
        bufferedWriter.close();

        final INodeSet nodes2 = directoryNodesProvider.getNodes();
        assertNotNull(nodes2);
        assertEquals(3, nodes2.getNodes().size());
        assertNotNull(nodes2.getNode("test1"));
        assertNotNull(nodes2.getNode("testnode2"));
        assertNotNull(nodes2.getNode("testyaml1"));

        FileUtils.deleteDir(directory);
    }
View Full Code Here

        props.setProperty("directory", directory.getAbsolutePath());
        DirectoryResourceModelSource.Configuration config = new DirectoryResourceModelSource.Configuration(props);
        final DirectoryResourceModelSource directoryNodesProvider = new DirectoryResourceModelSource(getFrameworkInstance());
        directoryNodesProvider.configure(config);

        final INodeSet nodes = directoryNodesProvider.getNodes();
        assertNotNull(nodes);
        assertEquals(3, nodes.getNodes().size());
        assertNotNull(nodes.getNode("test1"));
        assertNotNull(nodes.getNode("testnode2"));
        assertNotNull(nodes.getNode("testyaml1"));

        assertEquals("a description", nodes.getNode("testyaml1").getDescription());

        //now remove file
        file2.delete();


        final INodeSet nodes2 = directoryNodesProvider.getNodes();
        assertNotNull(nodes2);
        assertEquals(2, nodes2.getNodes().size());
        assertNotNull(nodes2.getNode("test1"));
        assertNotNull(nodes2.getNode("testnode2"));
        assertNull(nodes2.getNode("testyaml1"));

        FileUtils.deleteDir(directory);
    }
View Full Code Here

        props.setProperty("directory", directory.getAbsolutePath());
        DirectoryResourceModelSource.Configuration config = new DirectoryResourceModelSource.Configuration(props);
        final DirectoryResourceModelSource directoryNodesProvider = new DirectoryResourceModelSource(getFrameworkInstance());
        directoryNodesProvider.configure(config);

        final INodeSet nodes = directoryNodesProvider.getNodes();
        assertNotNull(nodes);
        assertEquals(3, nodes.getNodes().size());
        assertNotNull(nodes.getNode("test1"));
        assertNotNull(nodes.getNode("test2"));
        assertNotNull(nodes.getNode("test3"));

        assertEquals("A description", nodes.getNode("test1").getDescription());
        assertEquals("B description", nodes.getNode("test2").getDescription());
        assertEquals("C description", nodes.getNode("test3").getDescription());


        //change modification time of a file
        assertTrue(file1.setLastModified(System.currentTimeMillis()));
        final INodeSet nodes2 = directoryNodesProvider.getNodes();
        assertNotNull(nodes2);
        assertEquals(3, nodes2.getNodes().size());
        assertNotNull(nodes2.getNode("test1"));
        assertNotNull(nodes2.getNode("test2"));
        assertNotNull(nodes2.getNode("test3"));

        assertEquals("A description", nodes2.getNode("test1").getDescription());
        assertEquals("B description", nodes2.getNode("test2").getDescription());
        assertEquals("C description", nodes2.getNode("test3").getDescription());


        FileUtils.deleteDir(directory);
    }
View Full Code Here

        this.identity = identity;
    }

    @Override
    public INodeSet getNodes() throws ResourceModelSourceException {
        INodeSet nodes = null;
        try {
            nodes = getDelegate().getNodes();
        } catch (ResourceModelSourceException e) {
            logException(e);
        } catch (Throwable e) {
View Full Code Here

TOP

Related Classes of com.dtolabs.rundeck.core.common.INodeSet

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.