Package slash.navigation.rest

Examples of slash.navigation.rest.HttpRequest


        assertEquals(readFileToString("filestest.gpx"), location2);
    }

    @Test
    public void testReadNotExisting() throws Exception {
        HttpRequest request = readFile(MAX_VALUE);
        assertNotNull(request.executeAsString());
        assertEquals(404, request.getStatusCode());
        assertFalse(request.isSuccessful());
    }
View Full Code Here


    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());
        assertTrue(request2.isSuccessful());
        HttpRequest request3 = readFile(key);
        String result3 = request3.executeAsString();
        assertEquals(200, request3.getStatusCode());
        assertTrue(request3.isSuccessful());
        String expected3 = readFileToString("filestest.bcr");
        assertEquals(expected3.length(), result3.length());
        assertEquals(expected3, result3);
    }
View Full Code Here

    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());
        assertTrue(request2.isUnAuthorized());
    }
View Full Code Here

        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());
        assertTrue(request2.isForbidden());
    }
View Full Code Here

    public void testDelete() throws Exception {
        Post request1 = createFile("filestest.gpx");
        request1.executeAsString();
        String result1 = request1.getLocation();
        int key = parseFileKey(result1);
        HttpRequest request2 = deleteFile(key);
        String result2 = request2.executeAsString();
        assertEquals("file " + key + " deleted", result2);
        assertEquals(200, request2.getStatusCode());
        assertTrue(request2.isSuccessful());
        HttpRequest request3 = readFile(key);
        String result3 = request3.executeAsString();
        assertNotNull(result3);
        assertEquals(404, request3.getStatusCode());
        assertFalse(request3.isSuccessful());
    }
View Full Code Here

    public void testDeleteWithWrongPassword() throws Exception {
        Post request1 = createFile("filestest.gpx");
        request1.executeAsString();
        String result1 = request1.getLocation();
        int key = parseFileKey(result1);
        HttpRequest request2 = deleteFile(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

        createUser("userstest.gpx").executeAsString();
        Post request1 = createFile("filestest.gpx");
        request1.executeAsString();
        String result1 = request1.getLocation();
        int key = parseFileKey(result1);
        HttpRequest request2 = deleteFile(key, "ivan", "secret");
        assertNotNull(request2.executeAsString());
        assertEquals(403, request2.getStatusCode());
        assertFalse(request2.isSuccessful());
        assertTrue(request2.isForbidden());
    }
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.