package de.jeha.s3srv.operations.service;

import com.codahale.metrics.annotation.Timed;
import de.jeha.s3srv.operations.AbstractOperation;
import de.jeha.s3srv.storage.StorageBackend;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

/**
 * @author jenshadlich@googlemail.com
 */
@Path("/")
public class ListBuckets extends AbstractOperation {

    private static final Logger LOG = LoggerFactory.getLogger(ListBuckets.class);

    public ListBuckets(StorageBackend storageBackend) {
        super(storageBackend);
    }

    @GET
    @Path("/")
    @Produces(MediaType.APPLICATION_XML)
    @Timed
    public Response listBuckets() {
        LOG.info("listBuckets {}");
        throw new UnsupportedOperationException("Not implemented yet!");
    }

}

@@ -289,37 +289,8 @@
 th;%0A
-import javax.ws.rs.Produces;%0A
 impo
@@ -671,49 +671,8 @@
 /%22)%0A
-    @Produces(MediaType.APPLICATION_XML)%0A
     
@@ -714,24 +714,25 @@
 ets() %7B%0A
+%0A
         
 LOG.info
@@ -727,106 +727,768 @@
     
-LOG.info(%22listBuckets %7B%7D%22);%0A        throw new UnsupportedOperationException(%22Not implemented yet!%22
+String responseBody = %22%3C?xml version=%5C%221.0%5C%22 encoding=%5C%22UTF-8%5C%22?%3E%5Cn%22 +%0A                %22%3CListAllMyBucketsResult xmlns=%5C%22http://s3.amazonaws.com/doc/2006-03-01%5C%22%3E%5Cn%22 +%0A                %22  %3COwner%3E%5Cn%22 +%0A                %22    %3CID%3Efoo%3C/ID%3E%5Cn%22 +%0A                %22    %3CDisplayName%3Ebar%3C/DisplayName%3E%5Cn%22 +%0A                %22  %3C/Owner%3E%5Cn%22 +%0A                %22  %3CBuckets%3E%5Cn%22 +%0A                %22    %3CBucket%3E%5Cn%22 +%0A                %22      %3CName%3Equotes%3C/Name%3E%5Cn%22 +%0A                %22      %3CCreationDate%3E2006-02-03T16:45:09.000Z%3C/CreationDate%3E%5Cn%22 +%0A                %22    %3C/Bucket%3E%5Cn%22 +%0A                %22  %3C/Buckets%3E%5Cn%22 +%0A                %22%3C/ListAllMyBucketsResult%3E%22;%0A%0A        LOG.info(%22listBuckets %7B%7D%22);%0A%0A        return Response.ok(responseBody, MediaType.APPLICATION_XML_TYPE).build(
 );%0A 

add bogus listBuckets response