Package slash.navigation.rest

Examples of slash.navigation.rest.Post.addFile()


    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())
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;
    }

    private Post createCategoryFromFile(String fileName) throws IOException {
        return createCategoryFromFile(fileName, USERNAME, PASSWORD);
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;
    }

    private Post createCategory(String parent, String name) throws IOException, JAXBException {
        return createCategory(parent, name, USERNAME, PASSWORD);
View Full Code Here

    public String addUser(String userName, String password, String firstName, String lastName, String email) throws IOException {
        log.fine("Adding " + userName + "," + firstName + "," + lastName + "," + email);
        String xml = createUserXml(userName, password, firstName, lastName, email);
        Post request = new Post(getUsersUrl(), credentials);
        request.addFile("file", xml.getBytes());

        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot add user " + userName, getUsersUrl());
        if (request.isForbidden())
View Full Code Here

                (file != null ? ", file " + file.getAbsolutePath() : ""));
        Post request = new Post(getErrorReportUrl(), credentials);
        request.addString("log", logOutput);
        request.addString("description", description);
        if (file != null)
            request.addFile("file", file);

        String result = request.executeAsString();
        if (request.isUnAuthorized())
            throw new UnAuthorizedException("Cannot send error report " + (file != null ? ", file " + file.getAbsolutePath() : ""), getErrorReportUrl());
        if (!request.isSuccessful())
View Full Code Here

    protected Post createRoute(String category, Integer fileKey, String description,
                               String authenticationUserName, String authenticationPassword) throws IOException, JAXBException {
        String xml = createRouteXml(category, fileKey, description);
        Post request = new Post(ROUTES_URL, new SimpleCredentials(authenticationUserName, authenticationPassword));
        request.addFile("file", xml.getBytes());
        return request;
    }

    protected Post createRoute(String category, Integer fileKey, String description) throws IOException, JAXBException {
        return createRoute(category, fileKey, description, USERNAME, PASSWORD);
View Full Code Here

    }

    protected Post createUser(String fileName,
                              String authenticationUserName, String authenticationPassword) throws IOException {
        Post request = new Post(POST_USERS_URL, new SimpleCredentials(authenticationUserName, authenticationPassword));
        request.addFile("file", new File(TEST_PATH + fileName));
        return request;
    }

    protected Post createUser(String fileName) throws IOException {
        return createUser(fileName, USERNAME, PASSWORD);
View Full Code Here

    protected Post createUser(String userName, String password,
                              String firstName, String lastName, String email,
                              String authenticationUserName, String authenticationPassword) throws IOException, JAXBException {
        String xml = createUserXml(userName, password, firstName, lastName, email);
        Post request = new Post(POST_USERS_URL, new SimpleCredentials(authenticationUserName, authenticationPassword));
        request.addFile("file", xml.getBytes());
        return request;
    }

    protected Delete deleteUser(String userName,
                                String authenticationUserName, String authenticationPassword) {
View Full Code Here

    protected Post createFile(String fileName,
                              String authenticationUserName, String authenticationPassword) throws IOException {
        Post request = new Post(FILES_URL, new SimpleCredentials(authenticationUserName, authenticationPassword));
        File file = new File(TEST_PATH + fileName);
        assertTrue(file.exists());
        request.addFile("file", file);
        return request;
    }

    protected Post createFile(String fileName) throws IOException {
        return createFile(fileName, USERNAME, PASSWORD);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.