Package slash.navigation.rest

Examples of slash.navigation.rest.HttpRequest


        int fileKey = parseFileKey(request0.getLocation());

        Post request1 = createRoute("Upload", fileKey, "Description");
        request1.executeAsString();
        int routeKey = parseRouteKey(request1.getLocation());
        HttpRequest request2 = updateRoute(routeKey, "Upload", -2, "Updated description", "alif", "toop");
        request2.executeAsString();
        assertEquals(403, request2.getStatusCode());
        assertFalse(request2.isSuccessful());
        assertTrue(request2.isForbidden());
    }
View Full Code Here


        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, "Upload", null, "Updated description");
        String result2 = request2.executeAsString();
        assertTrue(result2.contains("no"));
        assertTrue(result2.contains("url"));
        assertTrue(result2.contains("given"));
        assertEquals(412, request2.getStatusCode());
        assertFalse(request2.isSuccessful());
    }
View Full Code Here

        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, null, fileKey, "Updated description");
        String result2 = request2.executeAsString();
        assertTrue(result2.contains("no"));
        assertTrue(result2.contains("category"));
        assertTrue(result2.contains("given"));
        assertEquals(412, request2.getStatusCode());
        assertFalse(request2.isSuccessful());
    }
View Full Code Here

        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"));
        assertEquals(412, request2.getStatusCode());
        assertFalse(request2.isSuccessful());
    }
View Full Code Here

        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());
        HttpRequest request3 = readRoute(key);
        String result3 = request3.executeAsString();
        assertNotNull(result3);
        assertEquals(404, request3.getStatusCode());
        assertFalse(request3.isSuccessful());
    }
View Full Code Here

        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

        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

        assertTrue(request.isSuccessful());
    }

    @Test
    public void testCreateWithNotExistingUser() throws Exception {
        HttpRequest request = createFile("filestest.gpx", "user-does-not-exist", PASSWORD);
        assertNull(request.executeAsString());
        assertEquals(401, request.getStatusCode());
        assertFalse(request.isSuccessful());
        assertTrue(request.isUnAuthorized());
    }
View Full Code Here

        assertTrue(request.isUnAuthorized());
    }

    @Test
    public void testCreateWithWrongPassword() throws Exception {
        HttpRequest request = createFile("filestest.gpx", USERNAME, "password-is-wrong");
        assertNull(request.executeAsString());
        assertEquals(401, request.getStatusCode());
        assertFalse(request.isSuccessful());
        assertTrue(request.isUnAuthorized());
    }
View Full Code Here

        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());
        assertTrue(request2.isSuccessful());
        assertEquals(readFileToString("filestest.gpx"), location2);
    }
View Full Code Here

TOP

Related Classes of slash.navigation.rest.HttpRequest

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.