Examples of LocalRepository


Examples of com.staxnet.repository.LocalRepository

    private String getHome() {
        return System.getProperty("bees.home");
    }

    private void initialize(boolean force) throws Exception {
        LocalRepository localRepository = new LocalRepository();

        String beesRepoPath = localRepository.getRepositoryPath();
        File lastCheckFile = new File(beesRepoPath, CHECK_FILE);
        boolean checkVersion = true;
        Properties p = new Properties();
        if (!force && Helper.loadProperties(lastCheckFile, p)) {
            String str = p.getProperty("last");
            if (str != null) {
                long interval = System.currentTimeMillis() - Long.parseLong(str);
                if (interval < CHECK_INTERVAL)
                    checkVersion = false;
            }
        }

        if (checkVersion) {
            // Check SDK version
            File sdkConfig = getURLAsFile(localRepository, app_template_xml_url + app_template_xml_name,
                    app_template_xml_name, app_template_xml_desc);
            Document doc = XmlHelper.readXMLFromFile(sdkConfig.getCanonicalPath());
            Element e = doc.getDocumentElement();
            String availVersion = e.getAttribute("version");
            String minVersion = e.getAttribute("min-version");

            VersionNumber currentVersion = version;
            VersionNumber availableVersion = new VersionNumber(availVersion);
            VersionNumber minimunVersion = new VersionNumber(minVersion);

            if (currentVersion.compareTo(availableVersion) < 0) {
                System.out.println();
                if (currentVersion.compareTo(minimunVersion) < 0) {
                    throw new AbortException("ERROR - This version of the CloudBees SDK is no longer supported," + "" +
                            " please install the latest version (" + availVersion + ").");
                } else if (currentVersion.compareTo(availableVersion) < 0) {
                    System.out.println("WARNING - A new version of the CloudBees SDK is available, please install the latest version (" + availVersion + ").");
                }

                String hRef = e.getAttribute("href");

                String homeRef = "www.cloudbees.com";
                NodeList nodeList = e.getElementsByTagName("link");
                for (int i = 0; i < nodeList.getLength(); i++) {
                    Node node = nodeList.item(i);
                    NamedNodeMap nodeMap = node.getAttributes();
                    Node rel = nodeMap.getNamedItem("rel");
                    Node href = nodeMap.getNamedItem("href");
                    if (rel != null && rel.getTextContent().trim().equalsIgnoreCase("alternate") && href != null) {
                        homeRef = href.getTextContent();
                    }
                }

                NodeList libsNL = e.getElementsByTagName("libraries");
                Node libsNode = null;
                if (libsNL.getLength() > 0) {
                    libsNode = libsNL.item(0);
                }
                if (libsNode != null) {
                    NodeList libNL = e.getElementsByTagName("library");
                    for (int i = 0; i < libNL.getLength(); i++) {
                        Node node = libNL.item(i);
                        NamedNodeMap nodeMap = node.getAttributes();
                        Node nameNode = nodeMap.getNamedItem("name");
                        Node refNode = nodeMap.getNamedItem("href");
                        if (nameNode != null && refNode != null) {
                            String libName = nameNode.getTextContent();
                            String libUrlString = refNode.getTextContent().trim();
                            int idx = libUrlString.lastIndexOf('/');
                            String libFileName = libUrlString.substring(idx);
                            localRepository.getURLAsFile(libUrlString, "lib1" + libFileName, libName);
                        }
                    }
                }

                System.out.println("  SDK home:     " + homeRef);
View Full Code Here

Examples of com.volantis.mcs.repository.LocalRepository

                    new DeviceRepositoryLocationImpl(
                            configuration.getRepositoryUrl().getFile());

            XMLRepositoryFactory factory =
                    XMLRepositoryFactory.getDefaultInstance();
            LocalRepository repository =
                    factory.createXMLRepository(null);

            // Create the XML accessor.

            DeviceRepositoryAccessor accessor =
View Full Code Here

Examples of org.apache.continuum.buildagent.model.LocalRepository

    }

    private List<LocalRepository> createLocalRepositories()
    {
        List<LocalRepository> localRepos = new ArrayList<LocalRepository>();
        LocalRepository localRepo = new LocalRepository();
        localRepo.setName( "temp" );
        localRepo.setLocation( "/tmp/.m2/repository" );
        localRepo.setLayout( "default" );

        localRepos.add( localRepo );

        localRepo = new LocalRepository();
        localRepo.setName( "default" );
        localRepo.setLocation( "/home/user/.m2/repository" );
        localRepo.setLayout( "default" );

        localRepos.add( localRepo );

        return localRepos;
    }
View Full Code Here

Examples of org.apache.continuum.buildagent.model.LocalRepository

        assertEquals( "Tool", installation.getType() );
        assertEquals( "Maven 2.2.1 Installation", installation.getName() );
        assertEquals( "M2_HOME", installation.getVarName() );
        assertEquals( "/tmp/apache-maven-2.2.1", installation.getVarValue() );
       
        LocalRepository localRepo = generalConfig.getLocalRepositories().get( 0 );
        assertLocalRepository( getExpectedLocalRepo(), localRepo )
    }
View Full Code Here

Examples of org.apache.continuum.buildagent.model.LocalRepository

        generalConfig.setContinuumServerUrl( expected );
       
        Installation expectedInstallation = getExpectedInstallation();       
        generalConfig.getInstallations().add( expectedInstallation );
       
        LocalRepository expectedLocalRepo = getExpectedLocalRepo();
       
        List<LocalRepository> localRepos = new ArrayList<LocalRepository>();
        localRepos.add( expectedLocalRepo );
       
        generalConfig.setLocalRepositories( localRepos );
       
        config.save();
       
        config.reload();
       
        assertEquals( expected, config.getContinuumBuildAgentConfiguration().getContinuumServerUrl() );
        assertEquals( 2, config.getContinuumBuildAgentConfiguration().getInstallations().size() );
       
        Installation installation = generalConfig.getInstallations().get( 1 );
        assertInstallation( expectedInstallation, installation );
       
        LocalRepository localRepo = generalConfig.getLocalRepositories().get( 0 );
        assertLocalRepository( expectedLocalRepo, localRepo );
    }  
View Full Code Here

Examples of org.apache.continuum.buildagent.model.LocalRepository

        Installation expectedInstallation = getExpectedInstallation();
       
        List<Installation> installations = new ArrayList<Installation>();
        installations.add( expectedInstallation );
       
        LocalRepository expectedLocalRepo = getExpectedLocalRepo();
       
        List<LocalRepository> localRepos = new ArrayList<LocalRepository>();
        localRepos.add( expectedLocalRepo );
       
        generalConfig.setContinuumServerUrl( expectedUrl );
        generalConfig.setBuildOutputDirectory( expectedBuildOutputDir );
        generalConfig.setWorkingDirectory( expectedWorkingDir );
        generalConfig.setInstallations( installations );
        generalConfig.setLocalRepositories( localRepos );
       
        config.save();
       
        config.reload();
       
        assertTrue( configFile.exists() );
        assertEquals( expectedUrl, config.getContinuumBuildAgentConfiguration().getContinuumServerUrl() );
        assertEquals( expectedBuildOutputDir, config.getContinuumBuildAgentConfiguration().getBuildOutputDirectory() );
        assertEquals( expectedWorkingDir, config.getContinuumBuildAgentConfiguration().getWorkingDirectory() );
        assertEquals( 1, config.getContinuumBuildAgentConfiguration().getInstallations().size() );
       
        Installation installation = generalConfig.getInstallations().get( 0 );
        assertInstallation( expectedInstallation, installation );
       
        LocalRepository localRepo = generalConfig.getLocalRepositories().get( 0 );
        assertLocalRepository( expectedLocalRepo, localRepo );
    }
View Full Code Here

Examples of org.apache.continuum.buildagent.model.LocalRepository

        return expectedInstallation;
    }

    private LocalRepository getExpectedLocalRepo()
    {
        LocalRepository expectedLocalRepo = new LocalRepository();
        expectedLocalRepo.setName( "default" );
        expectedLocalRepo.setLayout( "default" );
        expectedLocalRepo.setLocation( "/tmp/.m2/repository" );
        return expectedLocalRepo;
    }
View Full Code Here

Examples of org.apache.continuum.buildagent.model.LocalRepository

        final BuildContext buildContext = createBuildContext();

        final List<LocalRepository> localRepos = new ArrayList<LocalRepository>();

        LocalRepository localRepo = new LocalRepository();
        localRepo.setName( "temp" );
        localRepo.setLocation( "/tmp/.m2/repository" );
        localRepo.setLayout( "default" );

        localRepos.add( localRepo );

        localRepo = new LocalRepository();
        localRepo.setName( "default" );
        localRepo.setLocation( "/home/user/.m2/repository" );
        localRepo.setLayout( "default" );

        localRepos.add( localRepo );

        final Map<String, String> buildEnvironments = new HashMap<String, String>();
        buildEnvironments.put( "M2_HOME", "/tmp/apache-maven-2.2.1" );
View Full Code Here

Examples of org.apache.continuum.model.repository.LocalRepository

                {
                    context.put( ContinuumBuildConstant.KEY_LATEST_UPDATE_DATE,
                                 new Date( buildResult.getStartTime() ) );
                }

                LocalRepository localRepo = project.getProjectGroup().getLocalRepository();

                if ( localRepo != null )
                {
                    context.put( ContinuumBuildConstant.KEY_LOCAL_REPOSITORY, localRepo.getLocation() );
                }
                else
                {
                    context.put( ContinuumBuildConstant.KEY_LOCAL_REPOSITORY, "" );
                }
View Full Code Here

Examples of org.apache.continuum.model.repository.LocalRepository

        throws Exception
    {
        Continuum continuum = getContinuum();
        RepositoryService service = (RepositoryService) lookup( RepositoryService.ROLE );

        LocalRepository repository = new LocalRepository();
        repository.setName( "defaultRepo" );
        repository.setLocation( getTestFile( "target/default-repository" ).getAbsolutePath() );
        repository = service.addLocalRepository( repository );

        ProjectGroup group = new ProjectGroup();
        group.setGroupId( "testGroup" );
        group.setName( "testGroup" );
        group.setLocalRepository( repository );
        continuum.addProjectGroup( group );

        ProjectGroup retrievedDefaultProjectGroup = continuum.getProjectGroupByGroupId( "testGroup" );
        assertNotNull( retrievedDefaultProjectGroup.getLocalRepository() );

        continuum.removeProjectGroup( retrievedDefaultProjectGroup.getId() );

        try
        {
            continuum.getProjectGroupByGroupId( "testGroup" );
            fail( "project group was not deleted" );
        }
        catch ( Exception e )
        {
            // should fail. do nothing.
        }

        LocalRepository retrievedRepository = service.getLocalRepository( repository.getId() );
        assertNotNull( retrievedRepository );
        assertEquals( repository, retrievedRepository );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.