Coverage Report - org.mule.example.bookstore.transformers.AddBookResponse
 
Classes in this File Line Coverage Branch Coverage Complexity
AddBookResponse
0%
0/7
N/A
0
 
 1  
 /*
 2  
  * $Id: AddBookResponse.java 19423 2010-09-08 08:04:54Z dirk.olmes $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.example.bookstore.transformers;
 12  
 
 13  
 import org.mule.api.transformer.TransformerException;
 14  
 import org.mule.example.bookstore.web.HtmlTemplate;
 15  
 import org.mule.transformer.AbstractTransformer;
 16  
 import org.mule.transformer.types.DataTypeFactory;
 17  
 
 18  
 /**
 19  
  * A call to addBook() returns a Long representing the number of
 20  
  * books in the catalog.  This transformer wraps the Long into
 21  
  * a nice HTML page.
 22  
  */
 23  
 public class AddBookResponse extends AbstractTransformer
 24  
 {
 25  
     public AddBookResponse()
 26  
     {
 27  0
         super();
 28  0
         registerSourceType(DataTypeFactory.create(Long.class));
 29  0
         setReturnDataType(DataTypeFactory.STRING);
 30  0
     }
 31  
 
 32  
     @Override
 33  
     protected Object doTransform(Object src, String outputEncoding) throws TransformerException
 34  
     {
 35  0
         Long numBooks = (Long) src;
 36  0
         String response = "Catalog now contains: " + numBooks + " book(s)";
 37  0
         return HtmlTemplate.wrapHtmlBody(response);
 38  
     }
 39  
 }