private void setupPersistenceBundle21() throws Exception {
persistenceBundle.getHeaders().put("Meta-Persistence", "OSGI-INF/found.xml, jarfile.jar!/jar.xml,persistence/another.xml, does-not-exist.xml");
Skeleton skel = Skeleton.getSkeleton(persistenceBundle);
skel.setReturnValue(new MethodCall(Bundle.class, "getState"), Bundle.ACTIVE);
URL xml = getClass().getClassLoader().getResource("file21/META-INF/persistence.xml");
skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "META-INF/persistence.xml"), xml);
xml = getClass().getClassLoader().getResource("file21/OSGI-INF/found.xml");
skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "OSGI-INF/found.xml"), xml);
URL root = getClass().getClassLoader().getResource("file21");
File f = new File(new File(root.toURI()), "jarfile.jar");
JarOutputStream jos = new JarOutputStream(new FileOutputStream(f));
jos.putNextEntry(new ZipEntry("jar.xml"));
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(jos));
writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
writer.newLine();
writer.write("<persistence xmlns=\"http://java.sun.com/xml/ns/persistence\"");
writer.newLine();
writer.write("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
writer.newLine();
writer.write("xsi:schemaLocation=\"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd\"");
writer.newLine();
writer.write("version=\"1.0\">");
writer.newLine();
writer.write("<persistence-unit name=\"jar\"/>");
writer.newLine();
writer.write("</persistence>");
writer.close();
xml = getClass().getClassLoader().getResource("file21/jarfile.jar");
skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "jarfile.jar"), xml);
xml = getClass().getClassLoader().getResource("file21/persistence/another.xml");
skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "persistence/another.xml"), xml);
xml = getClass().getClassLoader().getResource("file21/OSGI-INF/not-found.xml");
skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "OSGI-INF/not-found.xml"), xml);
skel.setReturnValue(new MethodCall(Bundle.class, "getEntry", "does-not-exist.xml"), null);
skel.setReturnValue(new MethodCall(Bundle.class, "getVersion"), new Version("0.0.0"));
}