|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun * Microsystems, Inc. All Rights Reserved. */ package org.apache.tools.ant.module.xml; import java.io.File; import java.io.OutputStream; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.apache.tools.ant.module.api.AntProjectCookie; import org.apache.tools.ant.module.loader.AntProjectDataLoader; import org.apache.tools.ant.module.loader.AntProjectDataObject; import org.netbeans.junit.NbTestCase; import org.openide.filesystems.FileLock; import org.openide.filesystems.FileObject; import org.openide.filesystems.FileUtil; import org.openide.loaders.DataObject; import org.openide.util.Lookup; import org.openide.util.SharedClassObject; import org.openide.util.lookup.Lookups; import org.openide.util.lookup.ProxyLookup; import org.w3c.dom.Document; // XXX testBasicParsing // XXX testMinimumChangesFired /** * Test {@link AntProjectSupport} parsing functionality. * @author Jesse Glick */ public class AntProjectSupportTest extends NbTestCase { static { System.setProperty("org.openide.util.Lookup", Lkp.class.getName()); ((Lkp) Lookup.getDefault()).init(); } public static final class Lkp extends ProxyLookup { public Lkp() { super(new Lookup[0]); } public void init() { setLookups(new Lookup[] { Lookups.singleton(SharedClassObject.findObject(AntProjectDataLoader.class, true)), Lookups.metaInfServices(Lkp.class.getClassLoader()), }); } } public AntProjectSupportTest(String name) { super(name); } private FileObject scratch; protected void setUp() throws Exception { super.setUp(); clearWorkDir(); File scratchF = getWorkDir(); scratch = FileUtil.toFileObject(scratchF); assertNotNull("FO for " + scratchF, scratch); } public void testInitiallyInvalidScript() throws Exception { FileObject fo = scratch.createData("build.xml"); assertEquals("it is an APDO", AntProjectDataObject.class, DataObject.find(fo).getClass()); AntProjectCookie apc = new AntProjectSupport(fo); TestCL l = new TestCL(); apc.addChangeListener(l); assertNull("invalid", apc.getDocument()); assertNotNull("invalid", apc.getParseException()); FileLock lock = fo.lock(); try { OutputStream os = fo.getOutputStream(lock); try { os.write(" |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.