Package org.apache.maven.wagon.authorization

Examples of org.apache.maven.wagon.authorization.AuthorizationException


                throw e;
            }

            case HttpStatus.SC_FORBIDDEN:
                fireSessionConnectionRefused();
                throw new AuthorizationException( "Access denied to: " + url );

            case HttpStatus.SC_UNAUTHORIZED:
                fireSessionConnectionRefused();
                throw new AuthorizationException( "Not authorized." );

            case HttpStatus.SC_PROXY_AUTHENTICATION_REQUIRED:
                fireSessionConnectionRefused();
                throw new AuthorizationException( "Not authorized by proxy." );

            case HttpStatus.SC_NOT_FOUND:
                throw new ResourceDoesNotExistException( "File: " + url + " does not exist" );

                // add more entries here
View Full Code Here


        }
        catch ( FileNotFoundException e )
        {
            fireSessionConnectionRefused();

            throw new AuthorizationException( e.getMessage() );
        }
        Commandline cl = createBaseCommandLine( putty, scpExecutable, privateKey );

        cl.setWorkingDirectory( localFile.getParentFile().getAbsolutePath() );
View Full Code Here

                // TODO: handle all response codes
                int responseCode = urlConnection.getResponseCode();
                if ( responseCode == HttpURLConnection.HTTP_FORBIDDEN
                    || responseCode == HttpURLConnection.HTTP_UNAUTHORIZED )
                {
                    throw new AuthorizationException( "Access denied to: " + buildUrl( resource.getName() ) );
                }
                if ( responseCode == HttpURLConnection.HTTP_MOVED_PERM
                    || responseCode == HttpURLConnection.HTTP_MOVED_TEMP )
                {
                    visitingUrl = urlConnection.getHeaderField( "Location" );
View Full Code Here

                case HttpURLConnection.HTTP_ACCEPTED: // 202
                case HttpURLConnection.HTTP_NO_CONTENT: // 204
                    break;

                case HttpURLConnection.HTTP_FORBIDDEN:
                    throw new AuthorizationException( "Access denied to: " + buildUrl( resource.getName() ) );

                case HttpURLConnection.HTTP_NOT_FOUND:
                    throw new ResourceDoesNotExistException(
                        "File: " + buildUrl( resource.getName() ) + " does not exist" );
View Full Code Here

            {
                case HttpURLConnection.HTTP_OK:
                    return true;

                case HttpURLConnection.HTTP_FORBIDDEN:
                    throw new AuthorizationException( "Access denied to: " + url );

                case HttpURLConnection.HTTP_NOT_FOUND:
                    return false;

                case HttpURLConnection.HTTP_UNAUTHORIZED:
                    throw new AuthorizationException( "Access denied to: " + url );

                default:
                    throw new TransferFailedException(
                        "Failed to look for file: " + buildUrl( resourceName ) + ". Return code is: " + statusCode );
            }
View Full Code Here

    }

    @Test
    public void getAuthorizationException() throws TransferFailedException, ResourceDoesNotExistException,
            AuthorizationException {
        AuthorizationException exception = new AuthorizationException("");
        doThrow(exception).when(this.wagon).getResource(eq("foo"), eq(new File("bar")), any(TransferProgress.class));

        try {
            this.wagon.get("foo", new File("bar"));
            fail();
View Full Code Here

    }

    @Test
    public void getFileListAuthorizationException() throws TransferFailedException, ResourceDoesNotExistException,
            AuthorizationException {
        AuthorizationException exception = new AuthorizationException("");
        when(this.wagon.listDirectory("foo")).thenThrow(exception);

        try {
            this.wagon.getFileList("foo");
            fail();
View Full Code Here

    }

    @Test
    public void getIfNewerAuthorizationException() throws TransferFailedException, ResourceDoesNotExistException,
            AuthorizationException {
        AuthorizationException exception = new AuthorizationException("");
        when(this.wagon.isRemoteResourceNewer("foo", 0)).thenThrow(exception);

        try {
            this.wagon.getIfNewer("foo", new File("bar"), 0);
            fail();
View Full Code Here

    }

    @Test
    public void putAuthorizationException() throws TransferFailedException, ResourceDoesNotExistException,
            AuthorizationException {
        AuthorizationException exception = new AuthorizationException("");
        doThrow(exception).when(this.wagon).putResource(eq(new File("foo")), eq("bar"), any(TransferProgress.class));

        try {
            this.wagon.put(new File("foo"), "bar");
            fail();
View Full Code Here

        verify(this.wagon).doesRemoteResourceExist("foo");
    }

    @Test
    public void resourceExistsAuthorizationException() throws TransferFailedException, AuthorizationException {
        AuthorizationException exception = new AuthorizationException("");
        when(this.wagon.doesRemoteResourceExist("foo")).thenThrow(exception);

        try {
            this.wagon.resourceExists("foo");
            fail();
View Full Code Here

TOP

Related Classes of org.apache.maven.wagon.authorization.AuthorizationException

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.