Examples of CitationImpl


Examples of org.geotools.metadata.iso.citation.CitationImpl

        Citation citation = Citations.EPSG;
        assertFalse(std.shallowEquals(citation, Citations.GEOTIFF, true ));
        assertFalse(std.shallowEquals(citation, Citations.GEOTIFF, false));
        assertTrue (std.shallowEquals(citation, Citations.EPSG,    false));

        citation = new CitationImpl();
        std.shallowCopy(Citations.EPSG, citation, true);
        assertFalse(std.shallowEquals(citation, Citations.GEOTIFF, true ));
        assertFalse(std.shallowEquals(citation, Citations.GEOTIFF, false));
        assertTrue (std.shallowEquals(citation, Citations.EPSG,    false));
View Full Code Here

Examples of org.geotools.metadata.iso.citation.CitationImpl

    /**
     * Tests the {@link PropertyMap} implementation.
     */
    @Test
    public void testMap() {
        final Citation citation = new CitationImpl(Citations.EPSG);
        final Map<String,Object> map = MetadataStandard.ISO_19115.asMap(citation);
        assertFalse(map.isEmpty());
        assertTrue (map.size() > 1);

        final Set<String> keys = map.keySet();
        assertTrue ("Property exists and should be defined.",            keys.contains("title"));
        assertFalse("Property exists but undefined for Citations.EPSG.", keys.contains("ISBN"));
        assertFalse("Property do not exists.",                           keys.contains("dummy"));

        final String s = keys.toString();
        assertTrue (s.indexOf("title")       >= 0);
        assertTrue (s.indexOf("identifiers") >= 0);
        assertFalse(s.indexOf("ISBN")        >= 0);

        final Object identifiers = map.get("identifiers");
        assertTrue(identifiers instanceof Collection);
        assertTrue(PropertyAccessorTest.containsEPSG(identifiers));

        final Map<String,Object> copy = new HashMap<String,Object>(map);
        assertEquals(map, copy);

        // Note: AbstractCollection do not defines hashCode(); we have to wraps in a HashSet.
        final int hashCode = citation.hashCode();
        assertEquals("hashCode() should be as in a Set.", hashCode, new HashSet<Object>(map .values()).hashCode());
        assertEquals("hashCode() should be as in a Set.", hashCode, new HashSet<Object>(copy.values()).hashCode());

        map.remove("identifiers");
        final int newHashCode = citation.hashCode();
        assertFalse(map.equals(copy));
        assertFalse(hashCode == newHashCode);
        assertEquals(newHashCode, new HashSet<Object>(map.values()).hashCode());
    }
View Full Code Here

Examples of org.geotools.metadata.iso.citation.CitationImpl

    /**
     * Tests the set method.
     */
    @Test
    public void testSet() {
        Citation citation = new CitationImpl();
        final PropertyAccessor accessor = createPropertyAccessor(citation);

        // Tries with ISBN, which expect a String.
        Object value = "Random number";
        int index = accessor.indexOf("ISBN");
        assertTrue(index >= 0);
        assertNull(accessor.set(index, citation, value));
        assertSame(value, accessor.get(index, citation));
        assertSame(value, citation.getISBN());

        // Tries with the title. Automatic conversion from String to InternationalString expected.
        index = accessor.indexOf("title");
        assertTrue(index >= 0);
        assertNull(accessor.set(index, citation, "A random title"));
        value = accessor.get(index, citation);
        assertTrue(value instanceof InternationalString);
        assertEquals("A random title", value.toString());
        assertSame(value, citation.getTitle());

        // Tries with an element to be added in a collection.
        index = accessor.indexOf("alternateTitle");
        assertTrue(index >= 0);

View Full Code Here

Examples of org.geotools.metadata.iso.citation.CitationImpl

        final PropertyAccessor accessor = createPropertyAccessor(citation);
        assertFalse(accessor.shallowEquals(citation, Citations.GEOTIFF, true ));
        assertFalse(accessor.shallowEquals(citation, Citations.GEOTIFF, false));
        assertTrue (accessor.shallowEquals(citation, Citations.EPSG,    false));

        citation = new CitationImpl();
        assertTrue (accessor.shallowCopy  (Citations.EPSG, citation,    true ));
        assertFalse(accessor.shallowEquals(citation, Citations.GEOTIFF, true ));
        assertFalse(accessor.shallowEquals(citation, Citations.GEOTIFF, false));
        assertTrue (accessor.shallowEquals(citation, Citations.EPSG,    false));
View Full Code Here

Examples of org.geotools.metadata.iso.citation.CitationImpl

    /**
     * Tests the hash code computation.
     */
    @Test
    public void testHashCode() {
        final CitationImpl citation = new CitationImpl();
        final PropertyAccessor accessor = createPropertyAccessor(citation);
        int hashCode = accessor.hashCode(citation);
        assertEquals("Empty metadata.", 0, hashCode);

        final String ISBN = "Dummy ISBN";
        citation.setISBN(ISBN);
        hashCode = accessor.hashCode(citation);
        assertEquals("Metadata with a single String value.", ISBN.hashCode(), hashCode);

        final Set<Object> set = new HashSet<Object>();
        assertEquals("By Set.hashCode() contract.", 0, set.hashCode());
        assertTrue(set.add(ISBN));
        assertEquals("Expected Metadata.hashCode() == Set.hashCode().", set.hashCode(), hashCode);

        final InternationalString title = new SimpleInternationalString("Dummy title");
        citation.setTitle(title);
        hashCode = accessor.hashCode(citation);
        assertEquals("Metadata with two values.", ISBN.hashCode() + title.hashCode(), hashCode);
        assertTrue(set.add(title));
        assertEquals("Expected Metadata.hashCode() == Set.hashCode().", set.hashCode(), hashCode);
        assertEquals("CitationsImpl.hashCode() should delegate.", hashCode, citation.hashCode());

        final Collection<Object> values = citation.asMap().values();
        assertEquals(hashCode, new HashSet<Object>(values).hashCode());
        assertTrue(values.containsAll(set));
        assertTrue(set.containsAll(values));
    }
View Full Code Here

Examples of org.geotools.metadata.iso.citation.CitationImpl

    private List<Expression> list( Expression expr ){
        return Collections.singletonList(expr);
    }
    @Test
    public void testEvaluatePojo() {
        Citation pojo = new CitationImpl();

        f.setParameters( list(ff.property("edition")));
        Assert.assertEquals(Boolean.TRUE, f.evaluate(pojo));

        f.setParameters(list(ff.property("alternateTitles")));
View Full Code Here

Examples of org.geotools.metadata.iso.citation.CitationImpl

            try {
                final URI uri = new URI(bundle.getString("DocURL"));
                final OnLineResourceImpl resource = new OnLineResourceImpl(uri);
                resource.setFunction(OnLineFunction.INFORMATION);
                resource.setDescription(description);
                final CitationImpl citation = new CitationImpl(authority);
                final Collection<ResponsibleParty> parties = citation.getCitedResponsibleParties();
                final ResponsibleParty oldParty;
                if (true) {
                    final Iterator<ResponsibleParty> it = parties.iterator();
                    if (it.hasNext()) {
                        oldParty = it.next();
                        it.remove(); // This party will be re-injected with a new URI below.
                    }
                    else {
                        oldParty = null;
                    }
                }
                final ResponsiblePartyImpl party = new ResponsiblePartyImpl(oldParty);
                party.setRole(Role.RESOURCE_PROVIDER);
                party.setContactInfo(new ContactImpl(resource));
                parties.add(party);
                authority = (Citation) citation.unmodifiable();
            } catch (URISyntaxException exception) {
                // Invalid URI syntax. Ignore, since this property
                // was really just for information purpose.
            }
            /*
 
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.