Package org.geoserver.ManifestLoader

Examples of org.geoserver.ManifestLoader.AboutModel


            }
        };
    }

    public BuildInfo geoserver() throws Exception {
        AboutModel about = ManifestLoader.getVersions();
        about = about.filterNameByRegex("GeoServer");

        final AboutModel.ManifestModel manifest = about.getManifests().iterator().next();
        return new BuildInfo() {
            @Override
            public String version() {
                return manifest.getEntries().get("Version");
            }
View Full Code Here


        return false;
    }

    @Override
    protected Object handleObjectGet() throws Exception {
        AboutModel model = null;

        // filter name by regex
        final String regex = getQueryStringValue("manifest", String.class, null);
        if (regex != null) {
            model = buildAboutModel(type).filterNameByRegex(regex);
        }

        // filter name by range
        final String from = getQueryStringValue("from", String.class, null);
        final String to = getQueryStringValue("to", String.class, null);
        if (from != null && to != null) {
            if (model != null) {
                model = model.filterNameByRange(from, to);
            } else {
                model = buildAboutModel(type).filterNameByRange(from, to);
            }
        }

        // filter by properties
        final String key = getQueryStringValue("key", String.class, null);
        final String value = getQueryStringValue("value", String.class, null);
        if (model == null) {
            model = buildAboutModel(type);
        }
        if (key != null && value != null) {
            model = model.filterPropertyByKeyValue(value, key);
        } else if (key != null) {
            model = model.filterPropertyByKey(key);
        } else if (value != null) {
            model = model.filterPropertyByValue(value);
        }

        if (model != null)
            return model;
        else
View Full Code Here

    }

    @Test
    public void filterNameByRegex() throws IllegalArgumentException {

        AboutModel resources = ManifestLoader.getResources();
        AboutModel filtered = resources.filterNameByRegex(resourceName);

        // extract first resource
        ManifestModel mm = filtered.getManifests().first();
        if (mm != null) {
            Assert.isTrue(mm.getName().matches(resourceName));
        } else {
            LOGGER.log(Level.WARNING, "Unable to test with this resource name: " + resourceName
                    + "\nNo resource found.");
View Full Code Here

    }

    @Test
    public void filterPropertyByKeyOrValueTest() throws IllegalArgumentException {
        AboutModel resources = ManifestLoader.getResources();

        // extract first resource
        ManifestModel mm = resources.getManifests().first();
        if (mm == null) {
            LOGGER.log(Level.WARNING, "Unable to test with this resource name: " + resourceName
                    + "\nNo resource found.");
            return;
        }

        // extract first property
        Iterator<Entry<String, String>> it = mm.getEntries().entrySet().iterator();
        if (!it.hasNext()) {
            LOGGER.log(Level.WARNING,
                    "Unable to test with this resource name which does not has properties.");
            return;
        }
        Entry<String, String> entry = it.next();
        String propertyKey = entry.getKey();
        String propertyVal = entry.getValue();

        // check keys
        AboutModel filtered = resources.filterPropertyByKey(propertyKey);
        Iterator<ManifestModel> mit = filtered.getManifests().iterator();
        while (mit.hasNext()) {
            final ManifestModel model = mit.next();
            Assert.isTrue(model.getEntries().containsKey(propertyKey));
        }

        // check values
        filtered = resources.filterPropertyByValue(propertyVal);
        mit = filtered.getManifests().iterator();
        while (mit.hasNext()) {
            final ManifestModel model = mit.next();
            Assert.isTrue(model.getEntries().containsValue(propertyVal));
        }
    }
View Full Code Here

        }
    }

    @Test
    public void filterPropertyByKeyAndValueTest() throws IllegalArgumentException {
        AboutModel resources = ManifestLoader.getResources();

        // extract first resource
        ManifestModel mm = resources.getManifests().first();
        if (mm == null) {
            LOGGER.log(Level.WARNING, "Unable to test with this resource name: " + resourceName
                    + "\nNo resource found.");
            return;
        }

        // extract first property
        Iterator<Entry<String, String>> it = mm.getEntries().entrySet().iterator();
        if (!it.hasNext()) {
            LOGGER.log(Level.WARNING,
                    "Unable to test with this resource name which does not has properties.");
            return;
        }
        Entry<String, String> entry = it.next();
        String propertyKey = entry.getKey();
        String propertyVal = entry.getValue();

        // extract models
        AboutModel filtered = resources.filterPropertyByKeyValue(propertyKey, propertyVal);
        // check keys and values
        Iterator<ManifestModel> mit = filtered.getManifests().iterator();
        while (mit.hasNext()) {
            final ManifestModel model = mit.next();
            // check keys
            Assert.isTrue(model.getEntries().containsKey(propertyKey));
            String value = model.getEntries().get(propertyKey);
View Full Code Here

    }

    @Test
    public void removeTest() {

        AboutModel resources = ManifestLoader.getResources();
        AboutModel newResources = ManifestLoader.getResources();

        ManifestModel mm = newResources.getManifests().first();

        Assert.isTrue(resources.getManifests().contains(mm));

        // test remove
        resources.remove(mm.getName());
View Full Code Here

            }
        }

        @Override
        protected void onSetUp(SystemTestData testData) throws Exception {
            AboutModel resources = ManifestLoader.getResources();

            // extract first resource
            ManifestModel mm = resources.getManifests().first();
            if (mm == null) {
                LOGGER.log(Level.WARNING, "Unable to test with this resource name: " + resourceName
                        + "\nNo resource found.");
                return;
            }
View Full Code Here

        }

        @Test
        public void filterExcludingAttributes() {
            // load resources filtering attributes EXCLUDING propertyKey
            final AboutModel resources = ManifestLoader.getResources();

            // extract resources
            final Iterator<ManifestModel> mmit = resources.getManifests().iterator();
            while (mmit.hasNext()) {
                // extract properties
                Iterator<Entry<String, String>> it = mmit.next().getEntries().entrySet().iterator();
                while (it.hasNext()) {
                    Entry<String, String> entry = it.next();
View Full Code Here

        }

        @Test
        public void filterIncludingAttributes() {
            // load resources filtering attributes INCLUDING propertyKey
            final AboutModel versions = ManifestLoader.getVersions();

            // extract resources
            final Iterator<ManifestModel> mmit = versions.getManifests().iterator();
            while (mmit.hasNext()) {
                // extract first property
                Iterator<Entry<String, String>> it = mmit.next().getEntries().entrySet().iterator();
                while (it.hasNext()) {
                    Entry<String, String> entry = it.next();
View Full Code Here

TOP

Related Classes of org.geoserver.ManifestLoader.AboutModel

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.