Index: lucene/src/test-framework/org/apache/lucene/store/MockDirectoryWrapper.java
===================================================================
--- lucene/src/test-framework/org/apache/lucene/store/MockDirectoryWrapper.java	(revision 1138381)
+++ lucene/src/test-framework/org/apache/lucene/store/MockDirectoryWrapper.java	(working copy)
@@ -420,9 +420,15 @@
   @Override
   public synchronized CompoundFileDirectory openCompoundInput(String name, int bufferSize) throws IOException {
     maybeYield();
-    return new MockCompoundFileDirectoryWrapper(name, this, delegate.openCompoundInput(name, bufferSize));
+    return new MockCompoundFileDirectoryWrapper(name, this, delegate.openCompoundInput(name, bufferSize), false);
   }
-  
+   
+  @Override
+  public CompoundFileDirectory createCompoundOutput(String name) throws IOException {
+    maybeYield();
+    return new MockCompoundFileDirectoryWrapper(name, this, delegate.createCompoundOutput(name), true);
+  }
+
   /** Provided for testing purposes.  Use sizeInBytes() instead. */
   public synchronized final long getRecomputedSizeInBytes() throws IOException {
     if (!(delegate instanceof RAMDirectory))
Index: lucene/src/test-framework/org/apache/lucene/store/MockCompoundFileDirectoryWrapper.java
===================================================================
--- lucene/src/test-framework/org/apache/lucene/store/MockCompoundFileDirectoryWrapper.java	(revision 1138381)
+++ lucene/src/test-framework/org/apache/lucene/store/MockCompoundFileDirectoryWrapper.java	(working copy)
@@ -26,13 +26,17 @@
   private final CompoundFileDirectory delegate;
   private final String name;
   
-  public MockCompoundFileDirectoryWrapper(String name, MockDirectoryWrapper parent, CompoundFileDirectory delegate) throws IOException {
+  public MockCompoundFileDirectoryWrapper(String name, MockDirectoryWrapper parent, CompoundFileDirectory delegate, boolean forWrite) throws IOException {
     super(parent, name, 1024);
     this.name = name;
     this.parent = parent;
     this.delegate = delegate;
-    super.initForRead(Collections.<String,FileEntry>emptyMap());
-    parent.addFileHandle(this, name, true);
+    if (forWrite) {
+      super.initForWrite();
+    } else {
+      super.initForRead(Collections.<String,FileEntry>emptyMap());
+    }
+    parent.addFileHandle(this, name, !forWrite);
   }
   
   @Override
@@ -140,4 +144,8 @@
     return delegate.openInputSlice(id, offset, length, readBufferSize);
   }
 
+  @Override
+  public CompoundFileDirectory createCompoundOutput(String name) throws IOException {
+    return delegate.createCompoundOutput(name);
+  }
 }
