1 19 20 package org.netbeans.modules.j2ee.persistence.unit; 21 22 import java.io.File ; 23 import org.netbeans.api.project.FileOwnerQuery; 24 import org.netbeans.modules.j2ee.persistence.unit.PUDataObjectTestBase.Lkp; 25 import org.openide.filesystems.FileObject; 26 import org.openide.filesystems.FileUtil; 27 import org.openide.loaders.DataObject; 28 import org.openide.util.Lookup; 29 30 33 public class PUDataLoaderTest extends PUDataObjectTestBase { 34 35 static { 36 System.setProperty("org.openide.util.Lookup", Lkp.class.getName()); 38 ((Lkp) Lookup.getDefault()).setLookups(new Object [] { 39 new PUDataObjectTestBase.PUMimeResolver(), 40 new PUDataObjectTestBase.Pool(), 41 }); 42 } 43 44 public PUDataLoaderTest(String testName) { 45 super(testName); 46 } 47 48 public void setUp() throws Exception { 49 clearWorkDir(); 50 super.setUp(); 51 } 52 53 public void testPUWithoutProjectOwnerIsNotRecognized() throws Exception { 54 String persistenceFile = getDataDir().getAbsolutePath() + "/persistence.xml"; 55 FileObject puFO = FileUtil.toFileObject(new File (persistenceFile)); 56 assertFalse("persistence unit without project owner is not recongnized." + 57 " Project owner: " + FileOwnerQuery.getOwner(puFO), 58 DataObject.find(puFO) instanceof PUDataObject); 59 } 60 61 } 62 | Popular Tags |