Generates JUnit 4 RunListener instances for any user defined RunListeners
431905
private ArrayList<RunListener> instantiateRunListeners() throws Exception {
    ArrayList<RunListener> instances = new ArrayList<>();

    if (runListeners != null) {
      for (String className : Arrays.asList(runListeners.split(","))) {
        instances.add((RunListener) this.instantiate(className).newInstance());
      }
    }

    return instances;
  }
560016
public final L[] getListeners(String name) {
        if (name != null) {
            L[] listeners = get(name);
            if (listeners != null) {
                return listeners.clone();
            }
        }
        return newArray(0);
    }
578927
protected void generateEntityListener(EntityListenerDesc entityListenerDesc) {
    File javaFile =
        FileUtil.createJavaFile(entityConfig.getDestDir(), entityListenerDesc.getQualifiedName());
    GenerationContext context =
        new GenerationContext(
            entityListenerDesc,
            javaFile,
            entityListenerDesc.getTemplateName(),
            entityConfig.getEncoding(),
            entityConfig.isOverwriteListener());
    generator.generate(context);
  }
686793
protected void createAllRuntimes() {
    List<RuntimeInfo> runtimes = listRuntimes(true);
    runtimesList.clear();
    for (RuntimeInfo info : runtimes) {
      runtimesList.put(info.getRuntimeID(), info);
    }
  }
1355703
private void createMultipleListeners(final SibRaMessagingEngineConnection connection) throws ResourceException
    {
        final String methodName = "createMultipleListeners";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.entry(this, TRACE, methodName, connection);
        }

        try
        {
            final SICoreConnection coreConnection = connection.getConnection();

            /*
             * Create destination listener
             */

            final DestinationListener destinationListener = new SibRaDestinationListener(
                            connection, _messageEndpointFactory);

            /*
             * Determine destination type
             */

            final DestinationType destinationType = _endpointConfiguration
                            .getDestinationType();

            /*
             * Register destination listener
             */

            final SIDestinationAddress[] destinations = coreConnection
                            .addDestinationListener(_endpointConfiguration.getDestinationName(),
                                                    destinationListener,
                                                    destinationType,
                                                    DestinationAvailability.RECEIVE);

            if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
            {
                SibTr.debug(P2PTRACE, "Found " + destinations.length + " destinations that make the wildcard");
            }

            /*
             * Create a listener for each destination ...
             */

            for (int j = 0; j < destinations.length; j++)
            {
                try
                {
                    if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
                    {
                        SibTr.debug(P2PTRACE, "Creating a consumer for destination " + destinations[j]);
                    }
                    connection.createListener(destinations[j], _messageEndpointFactory);
                } catch (final ResourceException exception)
                {
                    FFDCFilter.processException(exception, CLASS_NAME + "."
                                                           + methodName, "1:877:1.45", this);
                    SibTr.error(TRACE, "CREATE_LISTENER_FAILED_CWSIV0803",
                                new Object[] { exception,
                                              destinations[j].getDestinationName(),
                                              connection.getConnection().getMeName(),
                                              connection.getBusName() });
                }
            }
        } catch (final SIException exception)
        {
            FFDCFilter.processException(exception, CLASS_NAME + "."
                                                   + methodName, "1:889:1.45", this);
            SibTr.error(TRACE, "ADD_DESTINATION_LISTENER_FAILED_CWSIV0804",
                        new Object[] { exception, connection.getConnection().getMeName(),
                                      connection.getBusName() });
            _connections.remove(connection.getConnection().getMeUuid());
            connection.close();
        }

        if (connection.getNumberListeners() == 0)
        {
            SibTr.warning(TRACE, "NO_LISTENERS_CREATED_CWSIV0809", new Object[] { _endpointConfiguration.getDestinationName(),
                                                                                 connection.getConnection().getMeName(),
                                                                                 connection.getBusName() });
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
        {
            SibTr.exit(this, TRACE, methodName);
        }
    }
211566
private MethodSpec.Builder generateExecuteListener(String packageName, SQLiteEntity entity) {		
		String interfaceName="On" + entity.getSimpleName() + "Listener";
		
		//@formatter:off
		Builder listenerInterface = TypeSpec.interfaceBuilder(interfaceName)
				.addModifiers(Modifier.PUBLIC)
				.addMethod(MethodSpec.methodBuilder("onRow")
						.addJavadoc("Method executed for each row extracted from database\n\n")
						.addJavadoc("@param bean loaded from database. Only selected columns/fields are valorized\n")
						.addJavadoc("@param rowPosition position of row\n")
						.addJavadoc("@param rowCount total number of rows\n")
						.addParameter(ParameterSpec.builder(typeName(entity.getElement()), "bean").build())
						.addParameter(ParameterSpec.builder(Integer.TYPE, "rowPosition").build())
						.addParameter(ParameterSpec.builder(Integer.TYPE, "rowCount").build())
				.returns(Void.TYPE).addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT).build());
		//@formatter:on
		
		ClassName interfaceType=TypeUtility.className(interfaceName);
		
		
		// javadoc for interface
		listenerInterface.addJavadoc("<p>Listener for row read from database.</p>\n");			
		TypeSpec listenerClass = listenerInterface.build();
		
		classBuilder.addType(listenerClass);
		
		//@formatter:off
		MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder("executeListener")
				.addJavadoc("Method executed for each row extracted from database. For each row specified listener will be invoked.\n\n")
				.addJavadoc("@param listener listener to invoke for each row\n")				
				.addModifiers(Modifier.PUBLIC)
				.addParameter(ParameterSpec.builder(interfaceType, "listener").build())
				.returns(TypeName.VOID);
		//@formatter:on

		TypeName entityClass= typeName(entity.getElement());
		
		methodBuilder.addCode("$T resultBean=new $T();\n",entityClass, entityClass);
		methodBuilder.addCode("\n");
		methodBuilder.beginControlFlow("if (cursor.moveToFirst())");

		methodBuilder.beginControlFlow("do\n");					
		
		// reset mapping
		{
			int i=0;
			for (ModelProperty item : entity.getCollection()) {			
				methodBuilder.addCode("if (index$L>=0) { ",i);
				SQLTransformer.resetBean(methodBuilder, entityClass, "resultBean", item,  "cursor","index"+i+"");
				methodBuilder.addCode(";");
				methodBuilder.addCode("}\n");
				
				i++;
			}
		}
		methodBuilder.addCode("\n");
		
		// generate mapping
		{
			int i=0;
			for (ModelProperty item : entity.getCollection()) {			
				methodBuilder.addCode("if (index$L>=0 && !cursor.isNull(index$L)) { ",i,i);
				SQLTransformer.cursor2Java(methodBuilder, entityClass, item, "resultBean", "cursor","index"+i+"");
				methodBuilder.addCode(";");
				methodBuilder.addCode("}\n");
				
				i++;
			}
		}

		// send to listener
		methodBuilder.addCode("\n");
		methodBuilder.addCode("listener.onRow(resultBean, cursor.getPosition(),cursor.getCount());\n");
				
		methodBuilder.endControlFlow("while (cursor.moveToNext())");						
		
		methodBuilder.endControlFlow();
		methodBuilder.addCode("cursor.close();\n");
		
		return methodBuilder;
	}
147187
public static void main(String[] args) throws RunnerException {
        new Runner(new OptionsBuilder()
                .include(WILDCARD + SuperClassInvocationBenchmark.class.getSimpleName() + WILDCARD)
                .include(WILDCARD + StubInvocationBenchmark.class.getSimpleName() + WILDCARD)
                .include(WILDCARD + ClassByImplementationBenchmark.class.getSimpleName() + WILDCARD)
                .include(WILDCARD + ClassByExtensionBenchmark.class.getSimpleName() + WILDCARD)
                .include(WILDCARD + TrivialClassCreationBenchmark.class.getSimpleName() + WILDCARD)
                .forks(0) // Should rather be 1 but there seems to be a bug in JMH.
                .build()).run();
    }
393962
public Map<String, List<VariableListener<?>>> getVariableListeners(String eventName, boolean includeCustomListeners) {
    Map<String, Map<String, List<VariableListener<?>>>> listenerCache;
    if (includeCustomListeners) {
      if (resolvedVariableListeners == null) {
        resolvedVariableListeners = new HashMap<String, Map<String,List<VariableListener<?>>>>();
      }

      listenerCache = resolvedVariableListeners;
    } else {
      if (resolvedBuiltInVariableListeners == null) {
        resolvedBuiltInVariableListeners = new HashMap<String, Map<String,List<VariableListener<?>>>>();
      }
      listenerCache = resolvedBuiltInVariableListeners;
    }

    Map<String, List<VariableListener<?>>> resolvedListenersForEvent = listenerCache.get(eventName);

    if (resolvedListenersForEvent == null) {
      resolvedListenersForEvent = new HashMap<String, List<VariableListener<?>>>();
      listenerCache.put(eventName, resolvedListenersForEvent);

      CmmnActivity currentActivity = this;

      while (currentActivity != null) {
        List<VariableListener<?>> localListeners = null;
        if (includeCustomListeners) {
          localListeners = currentActivity.getVariableListenersLocal(eventName);
        } else {
          localListeners = currentActivity.getBuiltInVariableListenersLocal(eventName);
        }

        if (localListeners != null && !localListeners.isEmpty()) {
          resolvedListenersForEvent.put(currentActivity.getId(), localListeners);
        }

        currentActivity = currentActivity.getParent();
      }
    }

    return resolvedListenersForEvent;
  }
222379
public Result run(Runner runner) {
        Result result = new Result();
        RunListener listener = result.createListener();
        notifier.addFirstListener(listener);
        try {
            notifier.fireTestRunStarted(runner.getDescription());
            runner.run(notifier);
            notifier.fireTestRunFinished(result);
        } finally {
            removeListener(listener);
        }
        return result;
    }
1111448
def _run_listeners(self, line):
        
        for regex, callbacks in self.listeners.iteritems():
            match = regex.match(line)

            if not match:
                continue

            for callback in callbacks:
                callback(*match.groups())
688942
public Runner getSuite(final RunnerBuilder builder,
            Class<?>[] classes) throws InitializationError {
        return new Suite(new RunnerBuilder() {
            @Override
            public Runner runnerForClass(Class<?> testClass) throws Throwable {
                return getRunner(builder, testClass);
            }
        }, classes) {
            @Override
            protected String getName() {
                /*
                 * #1320 The generated suite is not based on a real class so
                 * only a 'null' description can be generated from it. This name
                 * will be overridden here.
                 */
                return "classes";
            }
        };
    }
40605
private void createClassLoader() {
        if (!Utils.isNullOrEmpty(settings.getJarFiles())) {
            try {
                String[] files = settings.getJarFiles().split(";");
                List<URL> urls = newArrayList();
                for (String path : files) {
                    File file = new File(path);
                    if (file.isFile()) {
                        urls.add(file.toURI().toURL());
                    }
                }
                classLoader = new Java4CppClassLoader(urls.toArray(new URL[files.length]), classLoader);
            } catch (Exception e) {
                throw new RuntimeException("Failed to load jar " + e.getMessage());
            }
        }
    }
1326086
@Override
    protected final Iterator<DeployListener> findDeployListeners(
            ClassLoader pluginClassLoader) {
        final Iterator<DeployListener> listeners = this.serviceLoader.loadService(
                DeployListener.class, pluginClassLoader);

        return new Iterator<DeployListener>() {

            @Override
            public boolean hasNext() {
                return listeners.hasNext();
            }

            @Override
            public DeployListener next() {
                final DeployListener listener = listeners.next();
                TinyPlugzGuice.this.injector.injectMembers(listener);
                return listener;
            }
        };
    }
24870
public static void main(String[] args) {
        /*
         * Developers Notes:
         *
         * -No corresponding Junit test class currently
         * provided.  Test by eyeball of the output.
         *
         * -Add a menu with Help(About)
         * --> TBD.
         *
         * -Figure out some sane way to set initial default
         * column sizes.
         *
         * -Lots of inner classes here, done in order to keep
         * all the .class files easily identifiable.  Some of
         * this code is pretty ugly, very procedural in nature.
         * Lots of very tight coupling between all the classes,
         * thinly disguised switch statements, etc ..... This
         * code written on the fly, with almost no thought given
         * to OO design.
         *
         * -Also, I'm not really a GUI guy, so forgive any
         * transgressions.
         *
         */
            if ( args.length < 1 ) {
                System.err.println("File name is required!");
                usage();
                System.exit(1);
            }
        /*
         * Instantiate a DateTimeBrowser and invoke it's go method,
         * passing the input argument list.
         */
        new DateTimeBrowser().go( args );
    }
731299
@Override
    public void run(final RunNotifier junitNotifier) {

        log.debug("rootNode.toDebugString:\n" + rootNode.toDebugString());

        // for maven
        if (thisDescription == null) {
            thisDescription = getDescription();
        }

        log.debug("Description tree:\n" + printDescription(thisDescription, 0));

        // ExecutionContext.put(Scope.SUITE,
        // INotificationDistributor.NOTIFIER_DISTRIBUTOR_KEY,
        // notifier);

        notifier.setJunitRunNotifier(junitNotifier);
        // runner.setNotifier(notifier);

        Assert.assertNotNull("execution config has not been initialised", executionConfig);

        runner.run();
    }
838166
public Listener<Listeners<T>> getOrCreateListener()
   {
      List<Node> nodeList = childNode.get("listener");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new ListenerImpl<Listeners<T>>(this, "listener", childNode, nodeList.get(0));
      }
      return createListener();
   }
636787
public InternalRunner create(Class<?> klass) throws InvocationTargetException {
        return create(klass, new Supplier<MockitoTestListener>() {
            public MockitoTestListener get() {
                return new NoOpTestListener();
            }
        });
    }