Show correct display names for categories.
authorJan Lahoda <jlahoda@netbeans.org>
Mon, 24 Sep 2012 15:58:16 +0200
changeset 88008b0c35c1d4f
parent 879 c1848b20f6f3
child 881 a38ef7700c71
Show correct display names for categories.
cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneJar.java
cmdline/tool/test/unit/src/org/netbeans/modules/jackpot30/cmdline/CreateTool.java
     1.1 --- a/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneJar.java	Mon Sep 24 13:01:10 2012 +0200
     1.2 +++ b/cmdline/lib/test/unit/src/org/netbeans/modules/jackpot30/cmdline/lib/CreateStandaloneJar.java	Mon Sep 24 15:58:16 2012 +0200
     1.3 @@ -88,6 +88,7 @@
     1.4  import org.netbeans.spi.editor.mimelookup.MimeDataProvider;
     1.5  import org.netbeans.spi.java.hints.Hint;
     1.6  import org.openide.filesystems.MIMEResolver;
     1.7 +import org.openide.util.NbCollections;
     1.8  import org.openide.util.NbPreferences.Provider;
     1.9  import org.openide.xml.EntityCatalog;
    1.10  import org.openide.xml.XMLUtil;
    1.11 @@ -215,14 +216,25 @@
    1.12          }
    1.13  
    1.14          bundlesToCopy.addAll(RESOURCES);
    1.15 +        bundlesToCopy.addAll(info.additionalResources);
    1.16          copyResources(out, info, bundlesToCopy);
    1.17  
    1.18          //generated-layer.xml:
    1.19 -        Enumeration<URL> resources = this.getClass().getClassLoader().getResources("META-INF/generated-layer.xml");
    1.20 +        List<URL> layers2Merge = new ArrayList<URL>();
    1.21 +        List<String> layerNames = new ArrayList<String>();
    1.22 +
    1.23 +        layerNames.add("META-INF/generated-layer.xml");
    1.24 +        layerNames.addAll(info.additionalLayers);
    1.25 +
    1.26 +        for (String layerName : layerNames) {
    1.27 +            for (URL layerURL : NbCollections.iterable(this.getClass().getClassLoader().getResources(layerName))) {
    1.28 +                layers2Merge.add(layerURL);
    1.29 +            }
    1.30 +        }
    1.31 +
    1.32          Document main = null;
    1.33  
    1.34 -        while (resources.hasMoreElements()) {
    1.35 -            URL res = resources.nextElement();
    1.36 +        for (URL res : layers2Merge) {
    1.37              Document current = XMLUtil.parse(new InputSource(res.openStream()), false, false, null, new EntityCatalog() {
    1.38                  @Override
    1.39                  public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
    1.40 @@ -281,6 +293,8 @@
    1.41  
    1.42      public static final class Info {
    1.43          private final Set<String> additionalRoots = new HashSet<String>();
    1.44 +        private final Set<String> additionalResources = new HashSet<String>();
    1.45 +        private final Set<String> additionalLayers = new HashSet<String>();
    1.46          private final List<MetaInfRegistration> metaInf = new LinkedList<MetaInfRegistration>();
    1.47          private final Set<String> copyMetaInfRegistration = new HashSet<String>();
    1.48          private       boolean escapeJavaxLang;
    1.49 @@ -290,6 +304,14 @@
    1.50              additionalRoots.addAll(Arrays.asList(fqns));
    1.51              return this;
    1.52          }
    1.53 +        public Info addAdditionalResources(String... paths) {
    1.54 +            additionalResources.addAll(Arrays.asList(paths));
    1.55 +            return this;
    1.56 +        }
    1.57 +        public Info addAdditionalLayers(String... paths) {
    1.58 +            additionalLayers.addAll(Arrays.asList(paths));
    1.59 +            return this;
    1.60 +        }
    1.61          public Info addMetaInfRegistrations(MetaInfRegistration... registrations) {
    1.62              metaInf.addAll(Arrays.asList(registrations));
    1.63              return this;
     2.1 --- a/cmdline/tool/test/unit/src/org/netbeans/modules/jackpot30/cmdline/CreateTool.java	Mon Sep 24 13:01:10 2012 +0200
     2.2 +++ b/cmdline/tool/test/unit/src/org/netbeans/modules/jackpot30/cmdline/CreateTool.java	Mon Sep 24 15:58:16 2012 +0200
     2.3 @@ -59,6 +59,8 @@
     2.4      @Override
     2.5      protected Info computeInfo() {
     2.6          return new Info().addAdditionalRoots(Main.class.getName(), DeclarativeHintsTestBase.class.getName(), OpenProjectsTrampolineImpl.class.getName(), J2SEProject.class.getName(), DefaultJavaPlatformProvider.class.getName())
     2.7 +                         .addAdditionalResources("org/netbeans/modules/java/hints/resources/Bundle.properties")
     2.8 +                         .addAdditionalLayers("org/netbeans/modules/java/hints/resources/layer.xml")
     2.9                           .addMetaInfRegistrations(new MetaInfRegistration(org.netbeans.modules.project.uiapi.OpenProjectsTrampoline.class, OpenProjectsTrampolineImpl.class))
    2.10                           .addExcludePattern(Pattern.compile("junit\\.framework\\..*"))
    2.11                           .setEscapeJavaxLang();