@Override
    public void process(Exchange exchange) throws Exception {
        String operation = getOperation(exchange);

        switch (operation) {
            case GlanceConstants.RESERVE:
                doReserve(exchange);
                break;
            case OpenstackConstants.CREATE:
                doCreate(exchange);
                break;
            case OpenstackConstants.UPDATE:
                doUpdate(exchange);
                break;
            case GlanceConstants.UPLOAD:
                doUpload(exchange);
                break;
            case OpenstackConstants.GET:
                doGet(exchange);
                break;
            case OpenstackConstants.GET_ALL:
                doGetAll(exchange);
                break;
            case OpenstackConstants.DELETE:
                doDelete(exchange);
                break;
            default:
                throw new IllegalArgumentException("Unsupported operation " + operation);
        }
    }
@Test
    public void createTest() throws Exception {
        msg.setHeader(OpenstackConstants.OPERATION, OpenstackConstants.CREATE);
        msg.setHeader(OpenstackConstants.NAME, dummyImage.getName());
        msg.setHeader(GlanceConstants.OWNER, dummyImage.getOwner());
        msg.setHeader(GlanceConstants.MIN_DISK, dummyImage.getMinDisk());
        msg.setHeader(GlanceConstants.MIN_RAM, dummyImage.getMinRam());
        msg.setHeader(GlanceConstants.CHECKSUM, dummyImage.getChecksum());
        msg.setHeader(GlanceConstants.DISK_FORMAT, dummyImage.getDiskFormat());
        msg.setHeader(GlanceConstants.CONTAINER_FORMAT, dummyImage.getContainerFormat());

        final InputStream is = new FileInputStream(File.createTempFile("image", ".iso"));
        msg.setBody(is);
        producer.process(exchange);

        verify(imageService).create(imageCaptor.capture(), payloadCaptor.capture());
        assertEquals(is, payloadCaptor.getValue().open());

        final Image result = msg.getBody(Image.class);
        assertNotNull(result.getId());
        assertEqualsImages(dummyImage, result);
    }