felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pde...@apache.org
Subject svn commit: r1690238 - in /felix/sandbox/pderop/dependencymanager.ds: cnf/localrepo/ cnf/releaserepo/ org.apache.felix.dependencymanager.benchmark/ org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/ org.apac...
Date Fri, 10 Jul 2015 10:48:14 GMT
Author: pderop
Date: Fri Jul 10 10:48:13 2015
New Revision: 1690238

URL: http://svn.apache.org/r1690238
Log:
FELIX-4955: Added support for original scr and new scr in the dm loadtest suite.
noindex.bndrun is now testing the new org.apache.felix.dependencymanager.ds.
noindex.originalscr.bndrun is the same, but is testing the original scr.

If the constants from Artist.java are modified, then the org.apache.felix.dm.benchmark.scr.XMLGenerator
tool has to be run under eclipse. It will regenerate the scr xml in /tmp/scr.xml, which will
then have to
be copied to org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scr/scr.xml.


Added:
    felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/noindex.originalscr.bndrun
    felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/scr.bnd
    felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/packageinfo
    felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scr/
    felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scr/XMLGenerator.java
    felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scr/scr.xml
  (with props)
Modified:
    felix/sandbox/pderop/dependencymanager.ds/cnf/localrepo/index.xml
    felix/sandbox/pderop/dependencymanager.ds/cnf/localrepo/index.xml.sha
    felix/sandbox/pderop/dependencymanager.ds/cnf/releaserepo/index.xml
    felix/sandbox/pderop/dependencymanager.ds/cnf/releaserepo/index.xml.sha
    felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/controller.bnd
    felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/noindex.bndrun
    felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/ScenarioControllerImpl.java
    felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/AlbumImpl.java
    felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/ArtistImpl.java
    felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/TrackImpl.java

Modified: felix/sandbox/pderop/dependencymanager.ds/cnf/localrepo/index.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/cnf/localrepo/index.xml?rev=1690238&r1=1690237&r2=1690238&view=diff
==============================================================================
Binary files - no diff available.

Modified: felix/sandbox/pderop/dependencymanager.ds/cnf/localrepo/index.xml.sha
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/cnf/localrepo/index.xml.sha?rev=1690238&r1=1690237&r2=1690238&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager.ds/cnf/localrepo/index.xml.sha (original)
+++ felix/sandbox/pderop/dependencymanager.ds/cnf/localrepo/index.xml.sha Fri Jul 10 10:48:13
2015
@@ -1 +1 @@
-a040e41bb0a34596823cc4597398344d2ed51697ea0321a02bee3d6a654712db
\ No newline at end of file
+7de3151d4939965bdb3eff4c49a62c15b72227544fad65f1f8e2b5a99aaa2c39
\ No newline at end of file

Modified: felix/sandbox/pderop/dependencymanager.ds/cnf/releaserepo/index.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/cnf/releaserepo/index.xml?rev=1690238&r1=1690237&r2=1690238&view=diff
==============================================================================
Binary files - no diff available.

Modified: felix/sandbox/pderop/dependencymanager.ds/cnf/releaserepo/index.xml.sha
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/cnf/releaserepo/index.xml.sha?rev=1690238&r1=1690237&r2=1690238&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager.ds/cnf/releaserepo/index.xml.sha (original)
+++ felix/sandbox/pderop/dependencymanager.ds/cnf/releaserepo/index.xml.sha Fri Jul 10 10:48:13
2015
@@ -1 +1 @@
-399710a17a8457313066633164b9cf755f51ba20d0dd616084472c77ff9488bb
\ No newline at end of file
+027c32ec9fcc0c9b152259c1460c5aa6d98b9d24c5346a45a2e9549a7b12b701
\ No newline at end of file

Modified: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/controller.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/controller.bnd?rev=1690238&r1=1690237&r2=1690238&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/controller.bnd
(original)
+++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/controller.bnd
Fri Jul 10 10:48:13 2015
@@ -18,4 +18,5 @@ Private-Package:  \
 	org.apache.felix.dm.benchmark.controller.impl
 Bundle-Activator: org.apache.felix.dm.benchmark.controller.impl.Activator
 Export-Package:  \
-	org.apache.felix.dm.benchmark.controller
\ No newline at end of file
+	org.apache.felix.dm.benchmark.controller,\
+	org.apache.felix.dm.benchmark.controller.impl
\ No newline at end of file

Modified: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/noindex.bndrun
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/noindex.bndrun?rev=1690238&r1=1690237&r2=1690238&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/noindex.bndrun
(original)
+++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/noindex.bndrun
Fri Jul 10 10:48:13 2015
@@ -17,16 +17,18 @@
 -runbundles:  \
 	org.apache.felix.dependencymanager;version=latest,\
 	org.apache.felix.dependencymanager.shell;version=latest,\
+	org.apache.felix.dependencymanager.ds;version=latest,\
 	org.apache.felix.metatype;version=1.0.10,\
 	org.apache.felix.log;version=1.0.1,\
 	org.apache.felix.gogo.command;version=0.12.0,\
 	org.apache.felix.gogo.shell;version=0.10.0,\
 	org.apache.felix.gogo.runtime;version=0.10.0,\
 	org.apache.felix.configadmin;version=1.8.0,\
-	org.apache.felix.dependencymanager.benchmark.scenario,\
-	org.apache.felix.dependencymanager.benchmark.dependencymanager,\
-    org.apache.felix.dependencymanager.benchmark.dependencymanager.parallel,\
-    org.apache.felix.dependencymanager.benchmark.controller
+	org.apache.felix.dependencymanager.benchmark.scenario;version=latest,\
+	org.apache.felix.dependencymanager.benchmark.scr;version=latest,\
+	org.apache.felix.dependencymanager.benchmark.dependencymanager;version=latest,\
+    org.apache.felix.dependencymanager.benchmark.dependencymanager.parallel;version=latest,\
+    org.apache.felix.dependencymanager.benchmark.controller;version=latest
 	
 -runfw: org.apache.felix.framework;version=5.0.1
 

Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/noindex.originalscr.bndrun
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/noindex.originalscr.bndrun?rev=1690238&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/noindex.originalscr.bndrun
(added)
+++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/noindex.originalscr.bndrun
Fri Jul 10 10:48:13 2015
@@ -0,0 +1,41 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-runbundles:  \
+	org.apache.felix.dependencymanager;version=latest,\
+	org.apache.felix.dependencymanager.shell;version=latest,\
+	org.apache.felix:org.apache.felix.scr;version=1.8.2,\
+	org.apache.felix.metatype;version=1.0.10,\
+	org.apache.felix.log;version=1.0.1,\
+	org.apache.felix.gogo.command;version=0.12.0,\
+	org.apache.felix.gogo.shell;version=0.10.0,\
+	org.apache.felix.gogo.runtime;version=0.10.0,\
+	org.apache.felix.configadmin;version=1.8.0,\
+	org.apache.felix.dependencymanager.benchmark.scenario;version=latest,\
+	org.apache.felix.dependencymanager.benchmark.scr;version=latest,\
+	org.apache.felix.dependencymanager.benchmark.dependencymanager;version=latest,\
+    org.apache.felix.dependencymanager.benchmark.dependencymanager.parallel;version=latest,\
+    org.apache.felix.dependencymanager.benchmark.controller;version=latest
+	
+-runfw: org.apache.felix.framework;version=5.0.1
+
+-runproperties:  \
+	ds.loglevel=warn,\
+	org.osgi.framework.bootdelegation='sun.*,com.sun.*,org.netbeans.*'
+-runvm: -server -Xmx1024m -Xms1024m
+-runee: JavaSE-1.8
+javac.source:          1.8
+javac.target:          1.8

Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/scr.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/scr.bnd?rev=1690238&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/scr.bnd
(added)
+++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/scr.bnd
Fri Jul 10 10:48:13 2015
@@ -0,0 +1,4 @@
+Import-Package: org.apache.felix.dm.benchmark.scenario,\
+ org.apache.felix.dm.benchmark.scenario.impl, *
+Include-Resource: OSGI-INF/components.xml=src/org/apache/felix/dm/benchmark/scr/scr.xml
+Service-Component: OSGI-INF/components.xml
\ No newline at end of file

Modified: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/ScenarioControllerImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/ScenarioControllerImpl.java?rev=1690238&r1=1690237&r2=1690238&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/ScenarioControllerImpl.java
(original)
+++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/ScenarioControllerImpl.java
Fri Jul 10 10:48:13 2015
@@ -59,6 +59,7 @@ public class ScenarioControllerImpl impl
      * List of bundles to be executed by the benchmark.
      */
     final List<String> TESTS = Arrays.asList(
+        "org.apache.felix.dependencymanager.benchmark.scr",
         "org.apache.felix.dependencymanager.benchmark.dependencymanager",
         "org.apache.felix.dependencymanager.benchmark.dependencymanager.parallel"
     );

Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/packageinfo
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/packageinfo?rev=1690238&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/packageinfo
(added)
+++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/controller/impl/packageinfo
Fri Jul 10 10:48:13 2015
@@ -0,0 +1 @@
+version 1.0.0
\ No newline at end of file

Modified: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/AlbumImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/AlbumImpl.java?rev=1690238&r1=1690237&r2=1690238&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/AlbumImpl.java
(original)
+++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/AlbumImpl.java
Fri Jul 10 10:48:13 2015
@@ -32,12 +32,19 @@ import org.apache.felix.dm.benchmark.sce
  */
 public class AlbumImpl implements Album {
     final List<Track> m_musicTracks = new ArrayList<>();
-    final ScenarioController m_controller;
+    ScenarioController m_controller;
+    
+    public AlbumImpl() {        
+    }
     
     public AlbumImpl(ScenarioController controller) {
         m_controller = controller;
     }
     
+    public void bindController(ScenarioController controller) {
+        m_controller = controller;
+    }
+    
     void addTrack(Track dep) {
         m_musicTracks.add(dep);
     }

Modified: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/ArtistImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/ArtistImpl.java?rev=1690238&r1=1690237&r2=1690238&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/ArtistImpl.java
(original)
+++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/ArtistImpl.java
Fri Jul 10 10:48:13 2015
@@ -32,12 +32,19 @@ import org.apache.felix.dm.benchmark.sce
  */
 public class ArtistImpl implements Artist {
     final List<Album> m_albums = new ArrayList<>();
-    final ScenarioController m_controller;
+    ScenarioController m_controller;
+    
+    public ArtistImpl() {
+    }
     
     public ArtistImpl(ScenarioController controller) {
         m_controller = controller;
     }
     
+    public void bindController(ScenarioController controller) {
+        m_controller = controller;
+    }
+    
     void addAlbum(Album dep) {
         m_albums.add(dep);
     }

Modified: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/TrackImpl.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/TrackImpl.java?rev=1690238&r1=1690237&r2=1690238&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/TrackImpl.java
(original)
+++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scenario/impl/TrackImpl.java
Fri Jul 10 10:48:13 2015
@@ -27,12 +27,19 @@ import org.apache.felix.dm.benchmark.sce
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class TrackImpl implements Track {
-    final ScenarioController m_controller;
+    ScenarioController m_controller;
+    
+    public TrackImpl() {       
+    }
 
     public TrackImpl(ScenarioController controller) {
         m_controller = controller;
     }
 
+    public void bindController(ScenarioController controller) {
+        m_controller = controller;
+    }
+
     void start() {
         m_controller.trackAdded(this);
     }

Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scr/XMLGenerator.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scr/XMLGenerator.java?rev=1690238&view=auto
==============================================================================
--- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scr/XMLGenerator.java
(added)
+++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scr/XMLGenerator.java
Fri Jul 10 10:48:13 2015
@@ -0,0 +1,169 @@
+package org.apache.felix.dm.benchmark.scr;
+
+import static java.util.stream.Collectors.toList;
+import static org.apache.felix.dm.benchmark.scenario.Artist.ALBUMS;
+import static org.apache.felix.dm.benchmark.scenario.Artist.ARTISTS;
+import static org.apache.felix.dm.benchmark.scenario.Artist.TRACKS;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
+
+import org.apache.felix.dm.benchmark.controller.ScenarioController;
+import org.apache.felix.dm.benchmark.scenario.Album;
+import org.apache.felix.dm.benchmark.scenario.Artist;
+import org.apache.felix.dm.benchmark.scenario.Helper;
+import org.apache.felix.dm.benchmark.scenario.Track;
+import org.apache.felix.dm.benchmark.scenario.impl.AlbumImpl;
+import org.apache.felix.dm.benchmark.scenario.impl.ArtistImpl;
+import org.apache.felix.dm.benchmark.scenario.impl.TrackImpl;
+
+/**
+ * Class used to generate SCR xml descritors. When you run this class, a file will be generated
in /tmp/scr.xml.
+ * You then have to copy this file in org/apache/felix/dm/benchmark/scr/scr.xml
+ */
+public class XMLGenerator {    
+    static class Reference {
+        final String m_name, m_service, m_bind;
+        final Optional<String> m_target;
+        Reference(String name, String service, String bind, String target) {
+            m_name = name; m_service = service; m_bind = bind; 
+            m_target = target == null ? Optional.empty() : Optional.of(target);
+        }
+        
+        String name() { return m_name; }
+        String service() { return m_service; }
+        String bind() { return m_bind; }
+        Optional<String> target() { return m_target; }
+    }
+    
+    static class Component {
+        final String m_name;
+        final String m_impl;
+        final Optional<String> m_service;
+        final Optional<String[]> m_serviceProps; // array[0] = propname, array[1] =
propvalue
+        final List<Reference> m_refs = new ArrayList<>();
+        final boolean m_immediate;
+        
+        Component(String name, String impl, String service, String[] serviceProps, boolean
immediate) {
+            m_name = name; m_impl = impl;
+            m_service = service == null ? Optional.empty() : Optional.of(service);
+            m_serviceProps = serviceProps == null ? Optional.empty() : Optional.of(serviceProps);
+            m_immediate = immediate;
+        }
+        
+        void add(Reference ref) {
+            m_refs.add(ref);
+        }
+
+        public String getName() {
+            return m_name;
+        }
+        
+        public String getImpl() {
+            return m_impl;
+        }
+        
+        List<Reference> getReferences() {
+            return m_refs;
+        }
+        
+        Optional<String> getService() {
+            return m_service;
+        }
+        
+        Optional<String[]> getServiceProps() {
+            return m_serviceProps;
+        }
+        
+        boolean isImmediate() {
+            return m_immediate;
+        }
+    }
+    
+    public static void main(String ... args) throws Exception {
+        File xml = new File(System.getProperty("java.io.tmpdir")
+            + File.separator + "scr.xml");
+    
+        try(PrintWriter out = new PrintWriter(new FileWriter(xml, false))) {
+            List<Component> artists = Stream.iterate(0, i -> i + 1).limit(ARTISTS).map(
+                i -> createArtist(i + 1)).collect(toList());
+
+            List<Component> albums = artists.stream().flatMap(artist -> createAlbums(artist)).collect(
+                toList());
+
+            List<Component> tracks = albums.stream().flatMap(album -> createTracks(album)).collect(
+                toList());
+
+            out.println("<?xml version='1.0' encoding='utf-8'?>");
+            out.println("<components>");
+            artists.stream().forEach(artist -> toXml(out, artist));
+            albums.stream().forEach(album -> toXml(out, album));
+            tracks.stream().forEach(track -> toXml(out, track));
+            out.println("</components>");
+        }
+    }
+    
+    static void toXml(PrintWriter out, Component comp) {
+        out.println("  <scr:component xmlns:scr=\"http://www.osgi.org/xmlns/scr/v1.1.0\"
name='" + 
+            comp.getName() + "' activate='start' deactivate='stop'" + (comp.isImmediate()
? " immediate='true'" : "") + ">");
+        out.println("    <implementation class='" + comp.getImpl() + "'/>");
+        comp.getService().ifPresent(service -> {
+            out.println("    <service>");
+            out.println("      <provide interface='" + service + "'/>");
+            out.println("    </service>");
+            comp.getServiceProps().ifPresent(props -> {
+                out.println("    <property name='" + props[0] + "' value='" + props[1]
+ "'/>");
+            });
+        });
+        comp.getReferences().stream().forEach(ref -> {
+            out.print("    <reference name='" + ref.name() + "' interface='" + ref.service()
+ 
+                "' bind='" + ref.bind() + "'");
+            ref.target().ifPresent(t -> out.print(" target='" + ref.target().get() + "'"));
+            out.println("/>");
+        });
+        out.println("  </scr:component>");
+        out.println("");
+    }
+    
+    private static Component createArtist(int id) {
+        String idstr = String.valueOf(id);
+        Component app = new Component(ArtistImpl.class.getName() + idstr, ArtistImpl.class.getName(),
Artist.class.getName(), null, true);
+        app.add(new Reference("Controller", ScenarioController.class.getName(), "bindController",
null));
+        return app;
+    }
+    
+    private static Stream<Component> createAlbums(Component artist) {
+        return IntStream.iterate(0, n -> n+1).limit(ALBUMS).mapToObj(i -> {
+            long id = Helper.generateId();
+            String idstr = String.valueOf(id);
+            String filter = "(id=" + idstr + ")";
+            artist.add(new Reference("album" + String.valueOf(i+1), Album.class.getName(),

+                "addAlbum", filter));
+                
+            Component album = new Component(AlbumImpl.class.getName() + idstr, AlbumImpl.class.getName(),
+                Album.class.getName(), new String[] { "id", idstr }, false);
+            album.add(new Reference("Controller", ScenarioController.class.getName(), "bindController",
null));
+            return album;
+        });
+    }
+
+    private static Stream<Component> createTracks(Component album) {
+        return IntStream.iterate(0, n -> n+1).limit(TRACKS).mapToObj(i -> {
+            long id = Helper.generateId();
+            String idstr = String.valueOf(id);
+            String filter = "(id=" + idstr + ")";
+            album.add(new Reference("track" + idstr, Track.class.getName(), "addTrack", filter));
+                
+            Component track = new Component(TrackImpl.class.getName() + idstr, TrackImpl.class.getName(),
+                Track.class.getName(), new String[] { "id", idstr }, false);
+            track.add(new Reference("Controller", ScenarioController.class.getName(), "bindController",
null));
+            return track;
+        });
+    }
+}

Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scr/scr.xml
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scr/scr.xml?rev=1690238&view=auto
==============================================================================
Binary file - no diff available.

Propchange: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.benchmark/src/org/apache/felix/dm/benchmark/scr/scr.xml
------------------------------------------------------------------------------
    svn:mime-type = application/xml



Mime
View raw message