Package slash.navigation.rest

Examples of slash.navigation.rest.Post


    public String checkForUpdate(String routeConverterVersion, String routeConverterBits, long startCount,
                                 String javaVersion, String javaBits,
                                 String osName, String osVersion, String osArch,
                                 String webstartVersion, long startTime) throws IOException {
        log.fine("Checking for update for version " + routeConverterVersion);
        Post request = new Post(rootUrl + UPDATE_CHECK_URI, credentials);
        request.addString("id", valueOf(startTime));
        request.addString("javaBits", javaBits);
        request.addString("javaVersion", javaVersion);
        request.addString("locale", getDefault().getLanguage());
        request.addString("osArch", osArch);
        request.addString("osName", osName);
        request.addString("osVersion", osVersion);
        request.addString("rcStartCount", Long.toString(startCount));
        request.addString("rcVersion", routeConverterVersion);
        request.addString("rcBits", routeConverterBits);
        if (webstartVersion != null)
            request.addString("webstartVersion", webstartVersion);
        return request.executeAsString().replace("\"", "");
    }
View Full Code Here


    }

    public String sendChecksums(DataSource dataSource, Map<FileAndChecksum, List<FileAndChecksum>> fileAndChecksums, String... filterUrls) throws IOException {
        String xml = createDataSourceXml(dataSource, fileAndChecksums, filterUrls);
        log.info(format("Sending checksums for %s filtered with %s:\n%s", fileAndChecksums, printArrayToDialogString(filterUrls), xml));
        Post request = new Post(getDataSourcesUrl(), credentials);
        request.addFile("file", xml.getBytes());

        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot send checksums ", getDataSourcesUrl());
        if (!request.isSuccessful())
            throw new IOException("POST on " + getDataSourcesUrl() + " for data source " + dataSource +
                    " not successful: " + result);

        log.info(format("Sent checksum for %s filtered with %s with result:\n%s", fileAndChecksums, printArrayToDialogString(filterUrls), result));
        return result;
View Full Code Here

public class CategoryIT extends RouteCatalogClientBase {

    private Post createCategoryFromFile(String fileName,
                                        String authenticationUserName, String authenticationPassword) throws IOException {
        Post request = new Post(CATEGORIES_URL, new SimpleCredentials(authenticationUserName, authenticationPassword));
        request.addFile("file", new File(TEST_PATH + fileName));
        return request;
    }
View Full Code Here

    private Post createCategory(String parent, String name,
                                String authenticationUserName, String authenticationPassword) throws IOException, JAXBException {
        String xml = createCategoryXml(name);

        Post request = new Post(CATEGORIES_URL + encodeUri(parent) + "/", new SimpleCredentials(authenticationUserName, authenticationPassword));
        request.addFile("file", writeToTempFile(xml));
        return request;
    }
View Full Code Here

        return updateCategory(key, name, USERNAME, PASSWORD);
    }

    @Test
    public void testCreateFromFile() throws Exception {
        Post request2 = createCategoryFromFile("categoriestest.gpx");
        String result = request2.executeAsString();
        assertTrue(result.contains("category"));
        assertTrue(result.contains("created"));
        String location = request2.getLocation();
        assertTrue(location.contains("/catalog/categories/"));
        assertEquals(201, request2.getStatusCode());
        assertTrue(request2.isSuccessful());
    }
View Full Code Here

    }

    @Test
    public void testCreateRootCategoryFromJAXB() throws Exception {
        String name = "Category " + System.currentTimeMillis();
        Post request2 = createCategory("", name);
        String result = request2.executeAsString();
        assertTrue(result.contains("category"));
        assertTrue(result.contains(name));
        assertTrue(result.contains("created"));
        String location = request2.getLocation();
        assertTrue(location.contains("/catalog/categories/"));
        assertEquals(201, request2.getStatusCode());
        assertTrue(request2.isSuccessful());
    }
View Full Code Here

    }

    @Test
    public void testCreateUploadCategoryFromJAXB() throws Exception {
        String name = "Category " + System.currentTimeMillis();
        Post request2 = createCategory("Upload", name);
        String result = request2.executeAsString();
        assertTrue(result.contains("category"));
        assertTrue(result.contains(name));
        assertTrue(result.contains("created"));
        String location = request2.getLocation();
        assertTrue(location.contains("/catalog/categories/"));
        assertEquals(201, request2.getStatusCode());
        assertTrue(request2.isSuccessful());
    }
View Full Code Here

        assertTrue(request2.isSuccessful());
    }

    @Test
    public void testRead() throws Exception {
        Post request1 = createCategoryFromFile("categoriestest.gpx");
        request1.executeAsString();
        String key = parseCategoryKey(request1.getLocation());

        HttpRequest request2 = readCategory(key);
        String result2 = request2.executeAsString();
        assertEquals(200, request2.getStatusCode());
        assertTrue(request2.isSuccessful());
View Full Code Here

    }

    @Test
    public void testReadWithSpaces() throws Exception {
        String name = "Category " + System.currentTimeMillis();
        Post request1 = createCategory("Upload", name);
        request1.executeAsString();
        String key = parseCategoryKey(request1.getLocation());

        HttpRequest request2 = readCategory(key);
        String result2 = request2.executeAsString();
        assertEquals(200, request2.getStatusCode());
        assertTrue(request2.isSuccessful());
View Full Code Here

        assertEquals(0, gpxType.getMetadata().getLink().size());
    }

    @Test
    public void testUpdate() throws Exception {
        Post request1 = createCategory("Upload", "Interesting");
        request1.executeAsString();
        String key = parseCategoryKey(request1.getLocation());
        String newName = "Interesting" + System.currentTimeMillis();
        Put request2 = updateCategory(key, newName);
        String result2 = request2.executeAsString();
        assertEquals("category /Upload/" + newName + " updated", result2);
        assertEquals(201, request2.getStatusCode());
View Full Code Here

TOP

Related Classes of slash.navigation.rest.Post

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.