Author: adietish
Date: 2010-09-10 12:26:43 -0400 (Fri, 10 Sep 2010)
New Revision: 24874
Added:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossComponents.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/CollectionFilterUtils.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/ICollectionEntryFilter.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/RepportingEclipseEnvironmentFakeSingleton.java
Removed:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossBundleGroups.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseEnvironmentFakeSingleton.java
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingEclipseEnvironment.java
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/BundleUtils.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseUserAgentFake.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseUserAgentTest.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageIntegrationTest.java
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/ReportingEclipseEnvironmentFake.java
Log:
[JBIDE-7035] Refactored bundle filter to generic collection filter
Deleted:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossBundleGroups.java
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossBundleGroups.java 2010-09-10
15:00:21 UTC (rev 24873)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossBundleGroups.java 2010-09-10
16:26:43 UTC (rev 24874)
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.usage.reporting;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.TreeSet;
-
-import org.jboss.tools.usage.util.BundleUtils.IBundleEntryFilter;
-import org.osgi.framework.Bundle;
-
-/**
- * @author Andre Dietisheim
- */
-public class JBossBundleGroups implements IBundleEntryFilter {
-
- public enum BundleGroup {
- ARCHIVES("org.jboss.ide.eclipse.archives.core",
- "org.jboss.ide.eclipse.archives.jdt.integration",
- "org.jboss.ide.eclipse.archives.ui"
- )
- , AS("org.jboss.ide.eclipse.archives.webtools",
- "org.jboss.ide.eclipse.as.classpath.core",
- "org.jboss.ide.eclipse.as.classpath.ui",
- "org.jboss.ide.eclipse.as.core",
- "org.jboss.ide.eclipse.as.doc.user",
- "org.jboss.ide.eclipse.as.ssh",
- "org.jboss.ide.eclipse.as.ui",
- "org.jboss.ide.eclipse.as.ui.mbeans",
- "org.jboss.ide.eclipse.as.wtp.core",
- "org.jboss.ide.eclipse.as.wtp.ui")
- , BIRT("org.jboss.tools.birt.core",
- "org.jboss.tools.birt.oda",
- "org.jboss.tools.birt.oda.ui")
- , BPEL("org.eclipse.bpel.apache.ode.deploy.model",
- "org.eclipse.bpel.apache.ode.deploy.ui",
- "org.eclipse.bpel.common.model",
- "org.eclipse.bpel.common.ui",
- "org.eclipse.bpel.model",
- "org.eclipse.bpel.ui",
- "org.eclipse.bpel.validator",
- "org.eclipse.bpel.wsil.model",
- "org.eclipse.bpel.xpath10",
- "org.jboss.tools.bpel.cheatsheet",
- "org.jboss.tools.bpel.runtimes")
- , CDI("org.jboss.tools.cdi.core",
- "org.jboss.tools.cdi.text.ext",
- "org.jboss.tools.cdi.ui",
- "org.jboss.tools.cdi.xml",
- "org.jboss.tools.cdi.xml.ui")
- , DELTACLOUD("org.jboss.tools.deltacloud.core",
- "org.jboss.tools.deltacloud.ui")
- , DROOLS("org.drools.eclipse",
- "org.drools.eclipse.task",
- "org.eclipse.webdav",
- "org.guvnor.tools",
- "org.jboss.tools.flow.ruleflow")
- , ESB("org.jboss.tools.esb.core",
- "org.jboss.tools.esb.project.core",
- "org.jboss.tools.esb.project.ui",
- "org.jboss.tools.esb.ui",
- "org.jboss.tools.esb.validator")
- , FLOW("org.jboss.tools.flow.common")
- , FREEMARKER("org.jboss.ide.eclipse.freemarker")
- , GWT("org.jboss.tools.gwt.core",
- "org.jboss.tools.gwt.ui")
- , HIBERNATETOOLS("org.hibernate.eclipse",
- "org.hibernate.eclipse.console",
- "org.hibernate.eclipse.help",
- "org.hibernate.eclipse.jdt.apt.ui",
- "org.hibernate.eclipse.jdt.ui",
- "org.hibernate.eclipse.mapper",
- "org.jboss.tools.hibernate.jpt.core",
- "org.jboss.tools.hibernate.jpt.ui",
- "org.jboss.tools.hibernate.ui",
- "org.jboss.tools.hibernate.xml",
- "org.jboss.tools.hibernate.xml.ui")
- , JBPM("org.jboss.tools.flow.jpdl4",
- "org.jboss.tools.flow.jpdl4.multipage",
- "org.jboss.tools.jbpm.common",
- "org.jboss.tools.jbpm.convert",
- "org.jbpm.gd.jpdl")
- , JMX("org.jboss.tools.jmx.core",
- "org.jboss.tools.jmx.ui")
- , JSF("org.jboss.tools.jsf",
- "org.jboss.tools.jsf.doc.user",
- "org.jboss.tools.jsf.text.ext",
- "org.jboss.tools.jsf.text.ext.facelets",
- "org.jboss.tools.jsf.text.ext.richfaces",
- "org.jboss.tools.jsf.ui",
- "org.jboss.tools.jsf.verification",
- "org.jboss.tools.jsf.vpe.ajax4jsf",
- "org.jboss.tools.jsf.vpe.facelets",
- "org.jboss.tools.jsf.vpe.jbpm",
- "org.jboss.tools.jsf.vpe.jsf",
- "org.jboss.tools.jsf.vpe.jstl",
- "org.jboss.tools.jsf.vpe.myfaces",
- "org.jboss.tools.jsf.vpe.richfaces",
- "org.jboss.tools.jsf.vpe.seam")
- , JST("org.jboss.tools.jst.css",
- "org.jboss.tools.jst.firstrun",
- "org.jboss.tools.jst.jsp",
- "org.jboss.tools.jst.text.ext",
- "org.jboss.tools.jst.web",
- "org.jboss.tools.jst.web.kb",
- "org.jboss.tools.jst.web.tiles",
- "org.jboss.tools.jst.web.tiles.ui",
- "org.jboss.tools.jst.web.ui",
- "org.jboss.tools.jst.web.verification")
- , LABS("org.jboss.tools.labs.pde.sourceprovider")
- , MAVEN("org.jboss.tools.maven.cdi",
- "org.jboss.tools.maven.core",
- "org.jboss.tools.maven.hibernate",
- "org.jboss.tools.maven.jsf",
- "org.jboss.tools.maven.portlet",
- "org.jboss.tools.maven.seam",
- "org.jboss.tools.maven.ui")
- , MODESHAPE("org.jboss.tools.modeshape.rest")
- , PORTLET("org.jboss.tools.portlet.core",
- "org.jboss.tools.portlet.ui")
- , PROFILER("org.jboss.tools.profiler.ui")
- , RUNTIME("org.jboss.tools.runtime")
- , SEAM("org.jboss.tools.seam.core",
- "org.jboss.tools.seam.doc.user",
- "org.jboss.tools.seam.pages.xml",
- "org.jboss.tools.seam.text.ext",
- "org.jboss.tools.seam.ui",
- "org.jboss.tools.seam.ui.pages",
- "org.jboss.tools.seam.xml",
- "org.jboss.tools.seam.xml.ui")
- , SMOOKS("org.jboss.tools.smooks.core",
- "org.jboss.tools.smooks.runtime",
- "org.jboss.tools.smooks.templating",
- "org.jboss.tools.smooks.ui")
- , STRUTS("org.jboss.tools.struts",
- "org.jboss.tools.struts.text.ext",
- "org.jboss.tools.struts.ui",
- "org.jboss.tools.struts.validator.ui",
- "org.jboss.tools.struts.verification",
- "org.jboss.tools.struts.vpe.struts")
- , TPTP("org.jboss.tools.eclipse.as.tptp")
- , VPE("org.jboss.tools.vpe",
- "org.jboss.tools.vpe.docbook",
- "org.jboss.tools.vpe.html",
- "org.jboss.tools.vpe.jsp",
- "org.jboss.tools.vpe.resref",
- "org.jboss.tools.vpe.spring",
- "org.jboss.tools.vpe.ui.palette",
- "org.jboss.tools.vpe.xulrunner",
- "org.jboss.tools.xulrunner",
- "org.jboss.tools.xulrunner.initializer")
- , WORKINGSET("org.jboss.tools.workingset.core",
- "org.jboss.tools.workingset.ui")
- , WS("rg.jboss.tools.ws.core",
- "org.jboss.tools.ws.creation.core",
- "org.jboss.tools.ws.creation.ui",
- "org.jboss.tools.ws.ui")
- , XULRUNNER("org.mozilla.xpcom",
- "org.mozilla.xulrunner.carbon.macosx",
- "org.mozilla.xulrunner.cocoa.macosx",
- "org.mozilla.xulrunner.gtk.linux.x86",
- "org.mozilla.xulrunner.gtk.linux.x86_64",
- "org.mozilla.xulrunner.win32.win32.x86");
-
- private String[] bundleNames;
-
- BundleGroup(String... bundleNames) {
- this.bundleNames = bundleNames;
- }
-
- /**
- * Returns <tt>true</tt> if the given bundle name is a member of this
- * bundle group.
- *
- * @param bundleName
- * the bundle name to check whether it's a member of this
- * group of bundles.
- * @return <tt>true</tt>, if the given bundle
- */
- public boolean isMember(String bundleName) {
- boolean isMember = false;
- for (String name : bundleNames) {
- if (name.equals(bundleName)) {
- return true;
- }
- }
- return isMember;
- }
-
- public void addGroupIdTo(Collection<String> bundleGroupIds) {
- bundleGroupIds.add(name());
- }
- }
-
- private Set<String> jbossBundleGroups = new TreeSet<String>();
-
- /**
- * Collects the bundle groups the bundles it gets belong
- * to. Always returns <tt>true</tt> (does match) while collecting
- */
- public boolean matches(Bundle bundle) {
- String bundleName = bundle.getSymbolicName();
- for (BundleGroup bundleGroup : BundleGroup.values()) {
- if (bundleGroup.isMember(bundleName)) {
- jbossBundleGroups.add(bundleGroup.name());
- break;
- }
- }
- return true;
- }
-
- public Collection<String> getBundleGroupIds() {
- return jbossBundleGroups;
- }
-}
\ No newline at end of file
Copied:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossComponents.java
(from rev 24574,
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossBundleGroups.java)
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossComponents.java
(rev 0)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/JBossComponents.java 2010-09-10
16:26:43 UTC (rev 24874)
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.reporting;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.jboss.tools.usage.util.ICollectionEntryFilter;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class JBossComponents implements ICollectionEntryFilter<Bundle> {
+
+ public enum BundleGroup {
+ ARCHIVES("org.jboss.ide.eclipse.archives.core",
+ "org.jboss.ide.eclipse.archives.jdt.integration",
+ "org.jboss.ide.eclipse.archives.ui"
+ )
+ , AS("org.jboss.ide.eclipse.archives.webtools",
+ "org.jboss.ide.eclipse.as.classpath.core",
+ "org.jboss.ide.eclipse.as.classpath.ui",
+ "org.jboss.ide.eclipse.as.core",
+ "org.jboss.ide.eclipse.as.doc.user",
+ "org.jboss.ide.eclipse.as.ssh",
+ "org.jboss.ide.eclipse.as.ui",
+ "org.jboss.ide.eclipse.as.ui.mbeans",
+ "org.jboss.ide.eclipse.as.wtp.core",
+ "org.jboss.ide.eclipse.as.wtp.ui")
+ , BIRT("org.jboss.tools.birt.core",
+ "org.jboss.tools.birt.oda",
+ "org.jboss.tools.birt.oda.ui")
+ , BPEL("org.eclipse.bpel.apache.ode.deploy.model",
+ "org.eclipse.bpel.apache.ode.deploy.ui",
+ "org.eclipse.bpel.common.model",
+ "org.eclipse.bpel.common.ui",
+ "org.eclipse.bpel.model",
+ "org.eclipse.bpel.ui",
+ "org.eclipse.bpel.validator",
+ "org.eclipse.bpel.wsil.model",
+ "org.eclipse.bpel.xpath10",
+ "org.jboss.tools.bpel.cheatsheet",
+ "org.jboss.tools.bpel.runtimes")
+ , CDI("org.jboss.tools.cdi.core",
+ "org.jboss.tools.cdi.text.ext",
+ "org.jboss.tools.cdi.ui",
+ "org.jboss.tools.cdi.xml",
+ "org.jboss.tools.cdi.xml.ui")
+ , DELTACLOUD("org.jboss.tools.deltacloud.core",
+ "org.jboss.tools.deltacloud.ui")
+ , DROOLS("org.drools.eclipse",
+ "org.drools.eclipse.task",
+ "org.eclipse.webdav",
+ "org.guvnor.tools",
+ "org.jboss.tools.flow.ruleflow")
+ , ESB("org.jboss.tools.esb.core",
+ "org.jboss.tools.esb.project.core",
+ "org.jboss.tools.esb.project.ui",
+ "org.jboss.tools.esb.ui",
+ "org.jboss.tools.esb.validator")
+ , FLOW("org.jboss.tools.flow.common")
+ , FREEMARKER("org.jboss.ide.eclipse.freemarker")
+ , GWT("org.jboss.tools.gwt.core",
+ "org.jboss.tools.gwt.ui")
+ , HIBERNATETOOLS("org.hibernate.eclipse",
+ "org.hibernate.eclipse.console",
+ "org.hibernate.eclipse.help",
+ "org.hibernate.eclipse.jdt.apt.ui",
+ "org.hibernate.eclipse.jdt.ui",
+ "org.hibernate.eclipse.mapper",
+ "org.jboss.tools.hibernate.jpt.core",
+ "org.jboss.tools.hibernate.jpt.ui",
+ "org.jboss.tools.hibernate.ui",
+ "org.jboss.tools.hibernate.xml",
+ "org.jboss.tools.hibernate.xml.ui")
+ , JBPM("org.jboss.tools.flow.jpdl4",
+ "org.jboss.tools.flow.jpdl4.multipage",
+ "org.jboss.tools.jbpm.common",
+ "org.jboss.tools.jbpm.convert",
+ "org.jbpm.gd.jpdl")
+ , JMX("org.jboss.tools.jmx.core",
+ "org.jboss.tools.jmx.ui")
+ , JSF("org.jboss.tools.jsf",
+ "org.jboss.tools.jsf.doc.user",
+ "org.jboss.tools.jsf.text.ext",
+ "org.jboss.tools.jsf.text.ext.facelets",
+ "org.jboss.tools.jsf.text.ext.richfaces",
+ "org.jboss.tools.jsf.ui",
+ "org.jboss.tools.jsf.verification",
+ "org.jboss.tools.jsf.vpe.ajax4jsf",
+ "org.jboss.tools.jsf.vpe.facelets",
+ "org.jboss.tools.jsf.vpe.jbpm",
+ "org.jboss.tools.jsf.vpe.jsf",
+ "org.jboss.tools.jsf.vpe.jstl",
+ "org.jboss.tools.jsf.vpe.myfaces",
+ "org.jboss.tools.jsf.vpe.richfaces",
+ "org.jboss.tools.jsf.vpe.seam")
+ , JST("org.jboss.tools.jst.css",
+ "org.jboss.tools.jst.firstrun",
+ "org.jboss.tools.jst.jsp",
+ "org.jboss.tools.jst.text.ext",
+ "org.jboss.tools.jst.web",
+ "org.jboss.tools.jst.web.kb",
+ "org.jboss.tools.jst.web.tiles",
+ "org.jboss.tools.jst.web.tiles.ui",
+ "org.jboss.tools.jst.web.ui",
+ "org.jboss.tools.jst.web.verification")
+ , LABS("org.jboss.tools.labs.pde.sourceprovider")
+ , MAVEN("org.jboss.tools.maven.cdi",
+ "org.jboss.tools.maven.core",
+ "org.jboss.tools.maven.hibernate",
+ "org.jboss.tools.maven.jsf",
+ "org.jboss.tools.maven.portlet",
+ "org.jboss.tools.maven.seam",
+ "org.jboss.tools.maven.ui")
+ , MODESHAPE("org.jboss.tools.modeshape.rest")
+ , PORTLET("org.jboss.tools.portlet.core",
+ "org.jboss.tools.portlet.ui")
+ , PROFILER("org.jboss.tools.profiler.ui")
+ , RUNTIME("org.jboss.tools.runtime")
+ , SEAM("org.jboss.tools.seam.core",
+ "org.jboss.tools.seam.doc.user",
+ "org.jboss.tools.seam.pages.xml",
+ "org.jboss.tools.seam.text.ext",
+ "org.jboss.tools.seam.ui",
+ "org.jboss.tools.seam.ui.pages",
+ "org.jboss.tools.seam.xml",
+ "org.jboss.tools.seam.xml.ui")
+ , SMOOKS("org.jboss.tools.smooks.core",
+ "org.jboss.tools.smooks.runtime",
+ "org.jboss.tools.smooks.templating",
+ "org.jboss.tools.smooks.ui")
+ , STRUTS("org.jboss.tools.struts",
+ "org.jboss.tools.struts.text.ext",
+ "org.jboss.tools.struts.ui",
+ "org.jboss.tools.struts.validator.ui",
+ "org.jboss.tools.struts.verification",
+ "org.jboss.tools.struts.vpe.struts")
+ , TPTP("org.jboss.tools.eclipse.as.tptp")
+ , VPE("org.jboss.tools.vpe",
+ "org.jboss.tools.vpe.docbook",
+ "org.jboss.tools.vpe.html",
+ "org.jboss.tools.vpe.jsp",
+ "org.jboss.tools.vpe.resref",
+ "org.jboss.tools.vpe.spring",
+ "org.jboss.tools.vpe.ui.palette",
+ "org.jboss.tools.vpe.xulrunner",
+ "org.jboss.tools.xulrunner",
+ "org.jboss.tools.xulrunner.initializer")
+ , WORKINGSET("org.jboss.tools.workingset.core",
+ "org.jboss.tools.workingset.ui")
+ , WS("rg.jboss.tools.ws.core",
+ "org.jboss.tools.ws.creation.core",
+ "org.jboss.tools.ws.creation.ui",
+ "org.jboss.tools.ws.ui")
+ , XULRUNNER("org.mozilla.xpcom",
+ "org.mozilla.xulrunner.carbon.macosx",
+ "org.mozilla.xulrunner.cocoa.macosx",
+ "org.mozilla.xulrunner.gtk.linux.x86",
+ "org.mozilla.xulrunner.gtk.linux.x86_64",
+ "org.mozilla.xulrunner.win32.win32.x86");
+
+ private String[] bundleNames;
+
+ BundleGroup(String... bundleNames) {
+ this.bundleNames = bundleNames;
+ }
+
+ /**
+ * Returns <tt>true</tt> if the given bundle name is a member of this
+ * bundle group.
+ *
+ * @param bundleName
+ * the bundle name to check whether it's a member of this
+ * group of bundles.
+ * @return <tt>true</tt>, if the given bundle
+ */
+ public boolean isMember(String bundleName) {
+ boolean isMember = false;
+ for (String name : bundleNames) {
+ if (name.equals(bundleName)) {
+ return true;
+ }
+ }
+ return isMember;
+ }
+
+ public void addGroupIdTo(Collection<String> bundleGroupIds) {
+ bundleGroupIds.add(name());
+ }
+ }
+
+ private Set<String> jbossBundleGroups = new TreeSet<String>();
+
+ /**
+ * Collects the bundle groups the bundles it gets belong
+ * to. Always returns <tt>true</tt> (does match) while collecting
+ */
+ public boolean matches(Bundle bundle) {
+ String bundleName = bundle.getSymbolicName();
+ for (BundleGroup bundleGroup : BundleGroup.values()) {
+ if (bundleGroup.isMember(bundleName)) {
+ jbossBundleGroups.add(bundleGroup.name());
+ break;
+ }
+ }
+ return true;
+ }
+
+ public Collection<String> getBundleGroupIds() {
+ return jbossBundleGroups;
+ }
+}
\ No newline at end of file
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingEclipseEnvironment.java
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingEclipseEnvironment.java 2010-09-10
15:00:21 UTC (rev 24873)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/reporting/ReportingEclipseEnvironment.java 2010-09-10
16:26:43 UTC (rev 24874)
@@ -14,7 +14,8 @@
import org.jboss.tools.usage.googleanalytics.eclipse.AbstractEclipseEnvironment;
import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
import org.jboss.tools.usage.util.BundleUtils;
-import org.jboss.tools.usage.util.BundleUtils.IBundleEntryFilter;
+import org.jboss.tools.usage.util.CollectionFilterUtils;
+import org.jboss.tools.usage.util.ICollectionEntryFilter;
import org.osgi.framework.Bundle;
/**
@@ -31,9 +32,9 @@
@Override
public String getKeyword() {
- JBossBundleGroups jbossBundleGroups = new JBossBundleGroups();
- IBundleEntryFilter jbossToolsFilter = new
BundleUtils.BundleSymbolicNameFilter(JBOSS_TOOLS_BUNDLES_PREFIX);
- IBundleEntryFilter compositeFilter = new BundleUtils.CompositeFilter(
+ JBossComponents jbossBundleGroups = new JBossComponents();
+ ICollectionEntryFilter<Bundle> jbossToolsFilter = new
BundleUtils.BundleSymbolicNameFilter(JBOSS_TOOLS_BUNDLES_PREFIX);
+ ICollectionEntryFilter<Bundle> compositeFilter = new
CollectionFilterUtils.CompositeCollectionFilter<Bundle>(
jbossToolsFilter
, jbossBundleGroups);
BundleUtils.getBundles(compositeFilter, getBundles());
@@ -45,7 +46,7 @@
return
JBossToolsUsageActivator.getDefault().getBundle().getBundleContext().getBundles();
}
- private String bundleGroupsToKeywordString(JBossBundleGroups jbossBundleGroups) {
+ private String bundleGroupsToKeywordString(JBossComponents jbossBundleGroups) {
char delimiter = BUNDLE_GROUP_DELIMITER;
StringBuilder builder = new StringBuilder();
for (String bundleGroupId : jbossBundleGroups.getBundleGroupIds()) {
Modified:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/BundleUtils.java
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/BundleUtils.java 2010-09-10
15:00:21 UTC (rev 24873)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/BundleUtils.java 2010-09-10
16:26:43 UTC (rev 24874)
@@ -29,7 +29,7 @@
* @param bundles the bundles
* @return the bundles that match the given filter
*/
- public static List<Bundle> getBundles(IBundleEntryFilter filter, Bundle[] bundles)
{
+ public static List<Bundle> getBundles(ICollectionEntryFilter<Bundle> filter,
Bundle[] bundles) {
List<Bundle> bundleList = new ArrayList<Bundle>();
for (Bundle bundle : bundles) {
if (filter.matches(bundle)) {
@@ -53,7 +53,7 @@
/**
* A filter that matches bundles against a given symbolic name regex.
*/
- public static class BundleSymbolicNameFilter implements IBundleEntryFilter {
+ public static class BundleSymbolicNameFilter implements
ICollectionEntryFilter<Bundle> {
private Pattern pattern;
@@ -68,51 +68,4 @@
}
}
-
- /**
- * A filter that applies several given filters
- */
- public static class CompositeFilter implements IBundleEntryFilter {
-
- private IBundleEntryFilter filters[];
-
- /**
- * Instantiates a new composite filter that applies several given
- * filters.
- *
- * @param filters
- * the filters
- */
- public CompositeFilter(IBundleEntryFilter... filters) {
- this.filters = filters;
- }
-
- /**
- * Applies the filters this composite filter has. All filters have to
- * match so that the filter says the given bundle matches.
- */
- public boolean matches(Bundle bundle) {
- for (IBundleEntryFilter filter : filters) {
- if (!filter.matches(bundle)) {
- return false;
- }
- }
- return true;
- }
- }
-
- /**
- * The Interface IBundleEntryFilter.
- */
- public static interface IBundleEntryFilter {
-
- /**
- * Matches.
- *
- * @param bundle
- * the bundle
- * @return true, if successful
- */
- public boolean matches(Bundle bundle);
- }
}
Copied:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/CollectionFilterUtils.java
(from rev 24574,
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/BundleUtils.java)
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/CollectionFilterUtils.java
(rev 0)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/CollectionFilterUtils.java 2010-09-10
16:26:43 UTC (rev 24874)
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.util;
+
+
+/**
+ * @author Andre Dietisheim
+ */
+public class CollectionFilterUtils {
+
+ /**
+ * A filter that applies several given filters
+ */
+ public static class CompositeCollectionFilter<E> implements
ICollectionEntryFilter<E> {
+
+ private ICollectionEntryFilter<E> filters[];
+
+ /**
+ * Instantiates a new composite filter that applies several given
+ * filters.
+ *
+ * @param filters
+ * the filters
+ */
+ public CompositeCollectionFilter(ICollectionEntryFilter<E>... filters) {
+ this.filters = filters;
+ }
+
+ /**
+ * Applies the filters this composite filter has. All filters have to
+ * match so that the filter says the given bundle matches.
+ */
+ public boolean matches(E entry) {
+ for (ICollectionEntryFilter<E> filter : filters) {
+ if (!filter.matches(entry)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+}
Property changes on:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/CollectionFilterUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/ICollectionEntryFilter.java
===================================================================
---
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/ICollectionEntryFilter.java
(rev 0)
+++
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/ICollectionEntryFilter.java 2010-09-10
16:26:43 UTC (rev 24874)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.util;
+/**
+ * @authro Andre Dietisheim
+ */
+public interface ICollectionEntryFilter<E> {
+
+ /**
+ * Matches.
+ *
+ * @param bundle
+ * the bundle
+ * @return true, if successful
+ */
+ public boolean matches(E entry);
+}
\ No newline at end of file
Property changes on:
trunk/usage/plugins/org.jboss.tools.usage/src/org/jboss/tools/usage/util/ICollectionEntryFilter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted:
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseEnvironmentFakeSingleton.java
===================================================================
---
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseEnvironmentFakeSingleton.java 2010-09-10
15:00:21 UTC (rev 24873)
+++
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseEnvironmentFakeSingleton.java 2010-09-10
16:26:43 UTC (rev 24874)
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.usage.test;
-
-/**
- * @author Andre Dietisheim
- */
-public class EclipseEnvironmentFakeSingleton {
-
- public static ReportingEclipseEnvironmentFake INSTANCE = new
ReportingEclipseEnvironmentFake();
-
-}
Modified:
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseUserAgentFake.java
===================================================================
---
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseUserAgentFake.java 2010-09-10
15:00:21 UTC (rev 24873)
+++
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseUserAgentFake.java 2010-09-10
16:26:43 UTC (rev 24874)
@@ -8,6 +8,7 @@
private static final String APPLICATION_NAME = "com.jboss.jbds.product";
private static final String APPLICATION_VERSION = "3.0.1";
+
public static final String LOCALE_US = "en_US";
static final String WIN2000_VERSION = "5.0";
Modified:
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseUserAgentTest.java
===================================================================
---
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseUserAgentTest.java 2010-09-10
15:00:21 UTC (rev 24873)
+++
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseUserAgentTest.java 2010-09-10
16:26:43 UTC (rev 24874)
@@ -24,7 +24,7 @@
import org.eclipse.core.runtime.Platform;
import org.jboss.tools.usage.googleanalytics.eclipse.AbstractEclipseEnvironment;
-import org.jboss.tools.usage.reporting.JBossBundleGroups;
+import org.jboss.tools.usage.reporting.JBossComponents;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -88,9 +88,9 @@
Matcher matcher = Pattern.compile("(([A-Z]+)-){3}").matcher(keyword);
assertTrue(matcher.matches());
- assertTrue(keyword.indexOf(JBossBundleGroups.BundleGroup.GWT.name()) >= 0);
- assertTrue(keyword.indexOf(JBossBundleGroups.BundleGroup.SEAM.name()) >= 0);
- assertTrue(keyword.indexOf(JBossBundleGroups.BundleGroup.SMOOKS.name()) >= 0);
+ assertTrue(keyword.indexOf(JBossComponents.BundleGroup.GWT.name()) >= 0);
+ assertTrue(keyword.indexOf(JBossComponents.BundleGroup.SEAM.name()) >= 0);
+ assertTrue(keyword.indexOf(JBossComponents.BundleGroup.SMOOKS.name()) >= 0);
}
private void assertApplicationNameAndVersion(String applicationName, String
applicationVersion, String userAgent) {
Modified:
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageIntegrationTest.java
===================================================================
---
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageIntegrationTest.java 2010-09-10
15:00:21 UTC (rev 24873)
+++
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/JBossToolsUsageIntegrationTest.java 2010-09-10
16:26:43 UTC (rev 24874)
@@ -33,13 +33,13 @@
@Test
public void sameUserIdOnSametEclipseInstance() throws Exception {
- UrlRevealingTracker tracker = getTracker(EclipseEnvironmentFakeSingleton.INSTANCE);
+ UrlRevealingTracker tracker =
getTracker(RepportingEclipseEnvironmentFakeSingleton.INSTANCE);
FocusPoint focusPoint =
createFocusPoint("testSameUserIdOnSametEclipseInstance" +
System.currentTimeMillis());
tracker.trackSynchronously(focusPoint);
String userId = getUserId(tracker.getTrackingUrl());
assertTrue(userId != null);
- tracker = getTracker(EclipseEnvironmentFakeSingleton.INSTANCE);
+ tracker = getTracker(RepportingEclipseEnvironmentFakeSingleton.INSTANCE);
tracker.trackSynchronously(focusPoint);
String newUserId = getUserId(tracker.getTrackingUrl());
Modified:
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/ReportingEclipseEnvironmentFake.java
===================================================================
---
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/ReportingEclipseEnvironmentFake.java 2010-09-10
15:00:21 UTC (rev 24873)
+++
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/ReportingEclipseEnvironmentFake.java 2010-09-10
16:26:43 UTC (rev 24874)
@@ -18,7 +18,7 @@
* @author Andre Dietisheim
*/
public class ReportingEclipseEnvironmentFake extends ReportingEclipseEnvironment {
-
+
public static final String GANALYTICS_ACCOUNTNAME = "UA-17645367-1";
public static final String HOSTNAME = "jboss.org";
public static final String JAVA_VERSION = "1.6.0_20";
Copied:
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/RepportingEclipseEnvironmentFakeSingleton.java
(from rev 24851,
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/EclipseEnvironmentFakeSingleton.java)
===================================================================
---
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/RepportingEclipseEnvironmentFakeSingleton.java
(rev 0)
+++
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/RepportingEclipseEnvironmentFakeSingleton.java 2010-09-10
16:26:43 UTC (rev 24874)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.test;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class RepportingEclipseEnvironmentFakeSingleton {
+
+ public static ReportingEclipseEnvironmentFake INSTANCE = new
ReportingEclipseEnvironmentFake();
+
+}
Property changes on:
trunk/usage/tests/org.jboss.tools.usage.test/src/org/jboss/tools/usage/test/RepportingEclipseEnvironmentFakeSingleton.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain