/******************************************************************************* * Copyright (c) 2010 Association for Decentralized Information Management in * Industry THTH ry. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.databoard.tests; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import junit.framework.TestCase; import org.simantics.databoard.util.binary.BinaryFile; public class testFileUtil extends TestCase { public void testInsertRemove() throws IOException { File tmp1 = File.createTempFile("tmp", "tmp"); tmp1.deleteOnExit(); RandomAccessFile file = new RandomAccessFile(tmp1, "rw"); // Write 4 MB file BinaryFile write = new BinaryFile(file); for (int i=0; i<1024*1024; i++) { write.writeInt(i ^0x53); } write.flush(); write.close(); int iterCount = 16; long totInsertTime = 0; long totRemoveTime = 0; for (int iter=0; iter