001/* 002 * jDTAUS Core Utilities 003 * Copyright (C) 2005 Christian Schulte 004 * <cs@schulte.it> 005 * 006 * This library is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 2.1 of the License, or any later version. 010 * 011 * This library is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with this library; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 019 * 020 */ 021package org.jdtaus.core.io.util.test; 022 023import java.io.IOException; 024import org.jdtaus.core.io.StructuredFile; 025import org.jdtaus.core.io.it.StructuredFileTest; 026import org.jdtaus.core.io.util.MemoryFileOperations; 027import org.jdtaus.core.io.util.StructuredFileOperations; 028 029/** 030 * Testcase for {@code StructuredFileOperations} implementations. 031 * 032 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 033 * @version $JDTAUS: StructuredFileOperationsTest.java 8641 2012-09-27 06:45:17Z schulte $ 034 */ 035public class StructuredFileOperationsTest extends StructuredFileTest 036{ 037 //--StructuredFileTest------------------------------------------------------ 038 039 /** {@code FileOperations} backing the {@code StructuredFile}. */ 040 private final MemoryFileOperations memOps = new MemoryFileOperations(); 041 042 /** {@code StructuredFile} implementation being tested. */ 043 private StructuredFileOperations structuredFile; 044 045 protected byte[] getStructuredData() 046 { 047 try 048 { 049 this.structuredFile.flush(); 050 return this.memOps.getData(); 051 052 } 053 catch ( IOException e ) 054 { 055 throw new AssertionError( e ); 056 } 057 } 058 059 protected StructuredFile getStructuredFile() 060 { 061 try 062 { 063 if ( this.structuredFile == null ) 064 { 065 this.structuredFile = new StructuredFileOperations( 066 StructuredFileTest.BLOCK_SIZE, this.memOps ); 067 068 } 069 070 return this.structuredFile; 071 } 072 catch ( IOException e ) 073 { 074 throw new AssertionError( e ); 075 } 076 } 077 078 //------------------------------------------------------StructuredFileTest-- 079}