1 /*
2 * $Id: GZipTransformerRawBytesTestCase.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3 * --------------------------------------------------------------------------------------
4 * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.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.transformers.compression;
12
13 import org.mule.umo.lifecycle.InitialisationException;
14 import org.mule.umo.transformer.UMOTransformer;
15
16 import java.io.UnsupportedEncodingException;
17
18 public class GZipTransformerRawBytesTestCase extends GZipTransformerTestCase
19 {
20
21 // @Override
22 public Object getResultData()
23 {
24 try
25 {
26 return strat.compressByteArray((byte[]) this.getTestData());
27 }
28 catch (Exception e)
29 {
30 fail(e.getMessage());
31 return null;
32 }
33 }
34
35 // @Override
36 public Object getTestData()
37 {
38 try
39 {
40 return ((String) super.getTestData()).getBytes("UTF8");
41 }
42 catch (UnsupportedEncodingException uex)
43 {
44 fail(uex.getMessage());
45 return null;
46 }
47 }
48
49 // @Override
50 public UMOTransformer getRoundTripTransformer()
51 {
52 GZipUncompressTransformer transformer = new GZipUncompressTransformer();
53
54 try
55 {
56 transformer.initialise();
57 }
58 catch (InitialisationException e)
59 {
60 fail(e.getMessage());
61 }
62
63 return transformer;
64 }
65
66 // @Override
67 public void doTestBadReturnType(UMOTransformer tran, Object src) throws Exception
68 {
69 /*
70 * Disabled, otherwise the test for invalid return types would fail. The
71 * "invalid" class that is configured as returnType by the test harness would
72 * actually be a valid return type for our roundTripTransformer.
73 */
74 }
75
76 }