View Javadoc

1   /*
2    * $Id: TestCompressionTransformer.java 19191 2010-08-25 21:05:23Z tcarlson $
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.tck.testmodels.mule;
12  
13  import org.mule.api.transformer.TransformerException;
14  import org.mule.transformer.compression.AbstractCompressionTransformer;
15  import org.mule.util.compression.GZipCompression;
16  
17  public class TestCompressionTransformer extends AbstractCompressionTransformer
18  {
19  
20      private String beanProperty1;
21      private String containerProperty;
22  
23      private int beanProperty2;
24  
25      public TestCompressionTransformer()
26      {
27          super();
28          this.setStrategy(new GZipCompression());
29      }
30  
31      @Override
32      public Object doTransform(Object src, String encoding) throws TransformerException
33      {
34          return null;
35      }
36  
37      public String getBeanProperty1()
38      {
39          return beanProperty1;
40      }
41  
42      public void setBeanProperty1(String beanProperty1)
43      {
44          this.beanProperty1 = beanProperty1;
45      }
46  
47      public int getBeanProperty2()
48      {
49          return beanProperty2;
50      }
51  
52      public void setBeanProperty2(int beanProperty2)
53      {
54          this.beanProperty2 = beanProperty2;
55      }
56  
57      public String getContainerProperty()
58      {
59          return containerProperty;
60      }
61  
62      public void setContainerProperty(String containerProperty)
63      {
64          this.containerProperty = containerProperty;
65      }
66  
67      @Override
68      public Object clone() throws CloneNotSupportedException
69      {
70          if (containerProperty == null)
71          {
72              throw new IllegalStateException(
73                  "Transformer cannot be cloned until all properties have been set on it");
74          }
75  
76          return super.clone();
77      }
78  
79  }