Package com.s3auth.hosts

Examples of com.s3auth.hosts.Host


                    HttpHeaders.HOST
                )
            );
        }
        final String domain = headers.get(HttpHeaders.HOST).iterator().next();
        final Host host;
        if (LocalHost.isIt(domain)) {
            host = new LocalHost();
        } else {
            try {
                host = new SecuredHost(this.hosts.find(domain), request);
View Full Code Here


    @Test
    public void reportsToStringWhenAuthorizationFails() throws Exception {
        try {
            new SecuredHost(
                // @checkstyle AnonInnerLength (50 lines)
                new Host() {
                    @Override
                    public String toString() {
                        return "hello, world!";
                    }
                    @Override
View Full Code Here

     */
    @Test
    public void recognizesCredentialsWithSpecialCharacters() throws Exception {
        final String user = "user";
        final String password = "password%oD\u20ac";
        final Host host = Mockito.mock(Host.class);
        final Resource res = Mockito.mock(Resource.class);
        Mockito.doReturn(res).when(host).fetch(
            Mockito.any(URI.class),
            Mockito.any(Range.class),
            Mockito.any(Version.class)
View Full Code Here

     * SecuredHost can accept Base64 header.
     * @throws Exception If something wrong occurs
     */
    @Test
    public void acceptsBaseEncoding() throws Exception {
        final Host host = Mockito.mock(Host.class);
        Mockito.doReturn(true).when(host).authorized(
            Mockito.anyString(), Mockito.anyString()
        );
        Mockito.doReturn(true).when(host).isHidden(Mockito.any(URI.class));
        MatcherAssert.assertThat(
View Full Code Here

     * LocalHost can render a simple home page.
     * @throws Exception If there is some problem inside
     */
    @Test
    public void rendersHomePage() throws Exception {
        final Host host = new LocalHost();
        MatcherAssert.assertThat(
            host.isHidden(new URI("/some-uri")),
            Matchers.is(false)
        );
        MatcherAssert.assertThat(
            host.authorized("user-name", "user-password"),
            Matchers.is(true)
        );
        MatcherAssert.assertThat(
            host,
            Matchers.hasToString(Matchers.equalTo("localhost"))
        );
        MatcherAssert.assertThat(
            ResourceMocker.toString(
                host.fetch(URI.create("/"), Range.ENTIRE, Version.LATEST)
            ),
            Matchers.notNullValue()
        );
    }
View Full Code Here

     * LocalHost can report current version.
     * @throws Exception If there is some problem inside
     */
    @Test
    public void reportsCurrentVersion() throws Exception {
        final Host host = new LocalHost();
        MatcherAssert.assertThat(
            ResourceMocker.toString(
                host.fetch(URI.create("/version"), Range.ENTIRE, Version.LATEST)
            ),
            Matchers.equalTo(Manifests.read("S3Auth-Revision"))
        );
    }
View Full Code Here

     * HttpFacade can process parallel requests.
     * @throws Exception If there is some problem inside
     */
    @Test
    public void handlesParallelHttpRequests() throws Exception {
        final Host host = Mockito.mock(Host.class);
        Mockito.doAnswer(
            new Answer<Resource>() {
                @Override
                public Resource answer(final InvocationOnMock inv)
                    throws InterruptedException {
View Full Code Here

     * HttpFacade can process the If-Modified-Since header.
     * @throws Exception If there is some problem inside
     */
    @Test
    public void handlesIfModifiedSinceHeader() throws Exception {
        final Host host = Mockito.mock(Host.class);
        Mockito.doAnswer(
            new Answer<Resource>() {
                @Override
                public Resource answer(final InvocationOnMock inv)
                    throws InterruptedException {
View Full Code Here

     * @throws Exception If there is some problem inside
     */
    @Test
    public void respondsWithLastModifiedHeader() throws Exception {
        final Date date = new Date();
        final Host host = Mockito.mock(Host.class);
        Mockito.doAnswer(
            new Answer<Resource>() {
                @Override
                public Resource answer(final InvocationOnMock inv)
                    throws InterruptedException {
View Full Code Here

     * HttpFacade returns the Age header with the response.
     * @throws Exception If there is some problem inside
     */
    @Test
    public void respondsWithAgeHeader() throws Exception {
        final Host host = Mockito.mock(Host.class);
        Mockito.doAnswer(
            new Answer<Resource>() {
                @Override
                public Resource answer(final InvocationOnMock inv)
                    throws InterruptedException {
View Full Code Here

TOP

Related Classes of com.s3auth.hosts.Host

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.