1 19 20 package org.netbeans.modules.j2ee.persistence.action; 21 22 import org.netbeans.modules.j2ee.persistence.spi.entitymanagergenerator.ApplicationManagedResourceTransactionNonInjectableInWeb; 23 import org.netbeans.modules.j2ee.persistence.spi.entitymanagergenerator.EntityManagerGenerationStrategy; 24 import java.io.File ; 25 import junit.framework.*; 26 import org.netbeans.jackpot.test.TestUtilities; 27 import org.openide.filesystems.FileObject; 28 import org.openide.filesystems.FileUtil; 29 30 34 public class ApplicationManagedResourceTransactionNonInjectableInWebTest extends EntityManagerGenerationTestSupport { 35 36 public ApplicationManagedResourceTransactionNonInjectableInWebTest(String testName) { 37 super(testName); 38 } 39 40 public void testGenerate() throws Exception { 41 42 File testFile = new File (getWorkDir(), "Test.java"); 43 TestUtilities.copyStringToFile(testFile, 44 "package org.netbeans.test;\n\n" + 45 "import java.util.*;\n\n" + 46 "public class Test {\n" + 47 "}" 48 ); 49 GenerationOptions options = new GenerationOptions(); 50 options.setMethodName("create"); 51 options.setOperation(GenerationOptions.Operation.PERSIST); 52 options.setParameterName("object"); 53 options.setParameterType("Object"); 54 options.setQueryAttribute(""); 55 options.setReturnType("Object"); 56 57 FileObject result = generate(FileUtil.toFileObject(testFile), options); 58 59 assertFile(result); 60 } 61 62 protected Class <? extends EntityManagerGenerationStrategy> getStrategyClass() { 63 return ApplicationManagedResourceTransactionNonInjectableInWeb.class; 64 } 65 } 66 67 | Popular Tags |