public static CompressionPluginType getInstance() { if ( pluginType == null ) { pluginType = new CompressionPluginType(); } return pluginType; }
@Override protected String extractClassLoaderGroup( Annotation annotation ) { return ( (CompressionPlugin) annotation ).classLoaderGroup(); } }
@Override public CompressionInputStream createInputStream( InputStream in ) throws IOException { return new NoneCompressionInputStream( in, this ); }
@Before public void setUp() throws Exception { factory = CompressionProviderFactory.getInstance(); CompressionProvider provider = factory.getCompressionProviderByName( PROVIDER_NAME ); ByteArrayInputStream in = createTestInputStream(); inStream = new DummyCompressionIS( in, provider ); }
@Test public void testClose() throws IOException { CompressionProvider provider = inStream.getCompressionProvider(); ByteArrayInputStream in = createTestInputStream(); inStream = new DummyCompressionIS( in, provider ); inStream.close(); }
@Test public void testRead() throws IOException { CompressionProvider provider = inStream.getCompressionProvider(); ByteArrayInputStream in = createTestInputStream(); inStream = new DummyCompressionIS( in, provider ); assertEquals( inStream.available(), inStream.read( new byte[ 100 ], 0, inStream.available() ) ); }
@Test public void testClose() throws IOException { CompressionProvider provider = outStream.getCompressionProvider(); ByteArrayOutputStream out = new ByteArrayOutputStream(); outStream = new DummyCompressionOS( out, provider ); outStream.close(); }
@Test public void getCompressionProvider() { CompressionProvider provider = outStream.getCompressionProvider(); assertEquals( provider.getName(), PROVIDER_NAME ); }
@Test public void testGetName() { NoneCompressionProvider provider = (NoneCompressionProvider) factory.getCompressionProviderByName( PROVIDER_NAME ); assertNotNull( provider ); assertEquals( PROVIDER_NAME, provider.getName() ); }
@Override public CompressionOutputStream createOutputStream( OutputStream out ) throws IOException { return new NoneCompressionOutputStream( out, this ); }
@Override protected String extractI18nPackageName( Annotation annotation ) { return ( (CompressionPlugin) annotation ).i18nPackageName(); }
@Override protected boolean extractSeparateClassLoader( Annotation annotation ) { return ( (CompressionPlugin) annotation ).isSeparateClassLoaderNeeded(); }
@Override protected String extractName( Annotation annotation ) { return ( (CompressionPlugin) annotation ).name(); }
@Override protected String extractDocumentationUrl( Annotation annotation ) { return ( (CompressionPlugin) annotation ).documentationUrl(); }
@Override protected String extractCasesUrl( Annotation annotation ) { return ( (CompressionPlugin) annotation ).casesUrl(); }
@Override protected String extractForumUrl( Annotation annotation ) { return ( (CompressionPlugin) annotation ).forumUrl(); }
private CompressionPluginType() { super( CompressionPlugin.class, "COMPRESSION", "Compression" ); populateFolders( "compress" ); }
@Override protected String extractDesc( Annotation annotation ) { return ( (CompressionPlugin) annotation ).description(); }
@Override protected String extractID( Annotation annotation ) { return ( (CompressionPlugin) annotation ).id(); }
@CompressionPlugin( id = "Fake", name = "FakePlugin" ) private class FakePlugin { } }