Package slash.navigation.gpx.binding11

Examples of slash.navigation.gpx.binding11.ObjectFactory


        ExtensionsType extensionsType = gpxFactory.createExtensionsType();
        extensionsType.getAny().add(userextensionType);
        metadataType.setExtensions(extensionsType);

        GpxType gpxType = createGpxType();
        gpxType.setMetadata(metadataType);
        return toXml(gpxType);
    }
View Full Code Here


        HttpRequest request2 = readUser(key);
        String result2 = request2.executeAsString();
        assertEquals(200, request2.getStatusCode());
        assertTrue(request2.isSuccessful());

        GpxType gpxType = GpxUtil.unmarshal11(result2);
        assertNotNull(gpxType);
        assertEquals(key, gpxType.getMetadata().getName());
        assertNull(gpxType.getMetadata().getDesc());
        assertNull(gpxType.getMetadata().getKeywords());
        List<Object> anys = gpxType.getMetadata().getExtensions().getAny();
        assertEquals(1, anys.size());
        JAXBElement any = (JAXBElement) anys.get(0);
        UserextensionType extension = (UserextensionType) any.getValue();
        assertEquals("ivan@secret.org", extension.getEmail());
        assertEquals("Ivan", extension.getFirstname());
View Full Code Here

        HttpRequest request3 = readUser("alif");
        String result3 = request3.executeAsString();
        assertEquals(200, request3.getStatusCode());
        assertTrue(request3.isSuccessful());

        GpxType gpxType = GpxUtil.unmarshal11(result3);
        assertNotNull(gpxType);
        assertEquals("alif", gpxType.getMetadata().getName());
        assertNull(gpxType.getMetadata().getDesc());
        assertNull(gpxType.getMetadata().getKeywords());
        List<Object> anys = gpxType.getMetadata().getExtensions().getAny();
        assertEquals(1, anys.size());
        JAXBElement any = (JAXBElement) anys.get(0);
        UserextensionType extension = (UserextensionType) any.getValue();
        assertEquals("ali@top.org", extension.getEmail());
        assertEquals("Ali", extension.getFirstname());
View Full Code Here

        HttpRequest request3 = readRoute(routeKey);
        String result2 = request3.executeAsString();
        assertEquals(200, request3.getStatusCode());
        assertTrue(request3.isSuccessful());

        GpxType gpxType = GpxUtil.unmarshal11(result2);
        assertNotNull(gpxType);
        assertEquals(Integer.toString(routeKey), gpxType.getMetadata().getName());
        assertEquals(USERNAME, gpxType.getMetadata().getAuthor().getName());
        assertEquals(USERS_URL + USERNAME + GPX_URL_POSTFIX, gpxType.getMetadata().getAuthor().getLink().getHref());
        assertNull(gpxType.getMetadata().getDesc());
        assertEquals(0, gpxType.getMetadata().getLink().size());
        assertEquals("/Upload", gpxType.getMetadata().getKeywords());

        Calendar expectedCal = Calendar.getInstance();
        GregorianCalendar actualCal = gpxType.getMetadata().getTime().toGregorianCalendar();
        actualCal.setTimeZone(expectedCal.getTimeZone());
        assertTrue(actualCal.before(expectedCal));

        assertEquals(1, gpxType.getRte().size());
        RteType rteType = gpxType.getRte().get(0);
        assertEquals(Integer.toString(routeKey), rteType.getName());
        assertEquals("Description" + fileKey, rteType.getDesc());
        assertEquals(FILES_URL + fileKey, rteType.getLink().get(0).getHref());
    }
View Full Code Here

        assertTrue(request2.isSuccessful());
        HttpRequest request3 = readRoute(routeKey);
        String result3 = request3.executeAsString();
        assertEquals(200, request3.getStatusCode());
        assertTrue(request3.isSuccessful());
        GpxType gpxType = GpxUtil.unmarshal11(result3);
        assertNotNull(gpxType);
    }
View Full Code Here

        description = null;
        fromCategory = false;
    }

    private RteType getRte() throws IOException {
        GpxType gpx = getGpx();
        return gpx != null ? gpx.getRte().get(0) : null;
    }
View Full Code Here

    @Test
    public void testAddUser() throws Exception {
        String name = "User " + System.currentTimeMillis();
        String location = routeFeedback.addUser(name, "secret", "First", "Last", "first@last.com");
        assertNotNull(location);
        GpxType gpxType = routeFeedback.fetchGpx(location);
        assertNotNull(gpxType);
        assertEquals(name, gpxType.getMetadata().getName());
        List<Object> anys = gpxType.getMetadata().getExtensions().getAny();
        assertEquals(1, anys.size());
        JAXBElement any = (JAXBElement) anys.get(0);
        UserextensionType extension = (UserextensionType) any.getValue();
        assertEquals("first@last.com", extension.getEmail());
        assertEquals("First", extension.getFirstname());
View Full Code Here

    @Test
    public void testAddUserWithUmlauts() throws Exception {
        String name = "User äöüßÄÖÜ Umlauts " + System.currentTimeMillis();
        String location = routeFeedback.addUser(name, "secretÄÖÜ", "First ÄÖÜ", "Last ÄÖÜ", "first@last.com");
        assertNotNull(location);
        GpxType gpxType = routeFeedback.fetchGpx(location);
        assertNotNull(gpxType);
        assertEquals(name, gpxType.getMetadata().getName());
        List<Object> anys = gpxType.getMetadata().getExtensions().getAny();
        assertEquals(1, anys.size());
        JAXBElement any = (JAXBElement) anys.get(0);
        UserextensionType extension = (UserextensionType) any.getValue();
        assertEquals("first@last.com", extension.getEmail());
        assertEquals("First ÄÖÜ", extension.getFirstname());
View Full Code Here

        GpxType gpxType = createGpxType();
        gpxType.setMetadata(metadataType);

        if (fileKey != null) {
            RteType rteType = gpxFactory.createRteType();
            LinkType linkType = gpxFactory.createLinkType();
            linkType.setHref(FILES_URL + fileKey);
            rteType.getLink().add(linkType);
            gpxType.getRte().add(rteType);
        }

        return toXml(gpxType);
View Full Code Here

            gpx = getCatalog().fetchGpx(getUrl());

            // avoid subsequent NullPointerExceptions on server errors
            if (gpx == null) {
                gpx = new GpxType();
                gpx.setMetadata(new MetadataType());
            }
        }
        return gpx;
    }
View Full Code Here

TOP

Related Classes of slash.navigation.gpx.binding11.ObjectFactory

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.