Package slash.navigation.rest

Examples of slash.navigation.rest.Post


        assertFalse(request2.isSuccessful());
    }

    @Test
    public void testUpdateWithInvalidCategory() throws Exception {
        Post request0 = createFile("filestest.gpx");
        request0.executeAsString();
        int fileKey = parseFileKey(request0.getLocation());

        Post request1 = createRoute("Upload", fileKey, "Description");
        String result1 = request1.executeAsString();
        assertTrue(result1.contains("route"));
        assertTrue(result1.contains("created"));
        int routeKey = parseRouteKey(request1.getLocation());
        HttpRequest request2 = updateRoute(routeKey, "Invalid category " + System.currentTimeMillis(), fileKey, "Updated description");
        String result2 = request2.executeAsString();
        assertTrue(result2.contains("no"));
        assertTrue(result2.contains("valid"));
        assertTrue(result2.contains("category"));
View Full Code Here


        assertFalse(request2.isSuccessful());
    }

    @Test
    public void testDelete() throws Exception {
        Post request0 = createFile("filestest.gpx");
        request0.executeAsString();
        int fileKey = parseFileKey(request0.getLocation());

        Post request1 = createRoute("Upload", fileKey, "Description");
        request1.executeAsString();
        int key = parseRouteKey(request1.getLocation());
        HttpRequest request2 = deleteRoute(key);
        String result2 = request2.executeAsString();
        assertEquals("route " + key + " deleted", result2);
        assertEquals(200, request2.getStatusCode());
        assertTrue(request2.isSuccessful());
View Full Code Here

        assertFalse(request3.isSuccessful());
    }

    @Test
    public void testDeleteWithWrongPassword() throws Exception {
        Post request0 = createFile("filestest.gpx");
        request0.executeAsString();
        int fileKey = parseFileKey(request0.getLocation());

        Post request1 = createRoute("Upload", fileKey, "Description");
        request1.executeAsString();
        int key = parseRouteKey(request1.getLocation());
        HttpRequest request2 = deleteRoute(key, "user-does-not-exist", "password-is-wrong");
        assertNull(request2.executeAsString());
        assertEquals(401, request2.getStatusCode());
        assertFalse(request2.isSuccessful());
        assertTrue(request2.isUnAuthorized());
View Full Code Here

    @Test
    public void testDeleteNotMyUser() throws Exception {
        createUser("alif", "topg", "Ali", "Top", "ali@top.org", USERNAME, PASSWORD).executeAsString();

        Post request0 = createFile("filestest.gpx");
        request0.executeAsString();
        int fileKey = parseFileKey(request0.getLocation());

        Post request1 = createRoute("Upload", fileKey, "Description");
        request1.executeAsString();
        int key = parseRouteKey(request1.getLocation());
        HttpRequest request2 = deleteRoute(key, "alif", "topg");
        request2.executeAsString();
        assertEquals(403, request2.getStatusCode());
        assertFalse(request2.isSuccessful());
        assertTrue(request2.isForbidden());
View Full Code Here

    }


    @Test
    public void testCreate() throws Exception {
        Post request = createFile("filestest.gpx");
        String result = request.executeAsString();
        assertTrue(result.contains("file"));
        assertTrue(result.contains("created"));
        String location = request.getLocation();
        assertTrue(location.contains("/catalog/files/"));
        assertEquals(201, request.getStatusCode());
        assertTrue(request.isSuccessful());
    }
View Full Code Here

        assertTrue(request.isUnAuthorized());
    }

    @Test
    public void testCreateCheckIncreasingIds() throws Exception {
        Post request1 = createFile("filestest.gpx");
        request1.executeAsString();
        String result1 = request1.getLocation();
        Post request2 = createFile("filestest.gpx");
        request2.executeAsString();
        String result2 = request2.getLocation();
        int key1 = parseFileKey(result1);
        int key2 = parseFileKey(result2);
        assertEquals(key1 + 1, key2);
    }
View Full Code Here

        assertEquals(key1 + 1, key2);
    }

    @Test
    public void testRead() throws Exception {
        Post request1 = createFile("filestest.gpx");
        request1.executeAsString();
        String location1 = request1.getLocation();
        assertNotNull(location1);
        int key = parseFileKey(location1);
        HttpRequest request2 = readFile(key);
        String location2 = request2.executeAsString();
        assertEquals(200, request2.getStatusCode());
View Full Code Here

        assertFalse(request.isSuccessful());
    }

    @Test
    public void testUpdate() throws Exception {
        Post request1 = createFile("filestest.gpx");
        request1.executeAsString();
        String result1 = request1.getLocation();
        int key = parseFileKey(result1);
        HttpRequest request2 = updateFile(key, "filestest.bcr");
        String result2 = request2.executeAsString();
        assertEquals("file " + key + " updated", result2);
        assertEquals(200, request2.getStatusCode());
View Full Code Here

        assertEquals(expected3, result3);
    }

    @Test
    public void testUpdateWithWrongPassword() throws Exception {
        Post request1 = createFile("filestest.gpx");
        request1.executeAsString();
        String result1 = request1.getLocation();
        int key = parseFileKey(result1);
        HttpRequest request2 = updateFile(key, "filestest.bcr", "user-does-not-exist", "password-is-wrong");
        assertNull(request2.executeAsString());
        assertEquals(401, request2.getStatusCode());
        assertFalse(request2.isSuccessful());
View Full Code Here

    }

    @Test
    public void testUpdateNotMyRoute() throws Exception {
        createUser("userstest.gpx").executeAsString();
        Post request1 = createFile("filestest.gpx");
        request1.executeAsString();
        String result1 = request1.getLocation();
        int key = parseFileKey(result1);
        HttpRequest request2 = updateFile(key, "filestest.bcr", "ivan", "secret");
        assertNotNull(request2.executeAsString());
        assertEquals(403, request2.getStatusCode());
        assertFalse(request2.isSuccessful());
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.