Return-Path: X-Original-To: apmail-deltaspike-commits-archive@www.apache.org Delivered-To: apmail-deltaspike-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1AEE111543 for ; Sat, 17 May 2014 14:08:52 +0000 (UTC) Received: (qmail 61346 invoked by uid 500); 17 May 2014 13:35:04 -0000 Delivered-To: apmail-deltaspike-commits-archive@deltaspike.apache.org Received: (qmail 59459 invoked by uid 500); 17 May 2014 13:35:02 -0000 Mailing-List: contact commits-help@deltaspike.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltaspike.apache.org Delivered-To: mailing list commits@deltaspike.apache.org Received: (qmail 55778 invoked by uid 99); 17 May 2014 13:22:41 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 17 May 2014 13:22:41 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id D7A6792E0E9; Sat, 17 May 2014 13:22:40 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: gpetracek@apache.org To: commits@deltaspike.apache.org Message-Id: <875debda7f644ff1bcc414d7118777c8@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: git commit: DELTASPIKE-593 improved handling of internal packages Date: Sat, 17 May 2014 13:22:40 +0000 (UTC) Repository: deltaspike Updated Branches: refs/heads/master 043f33ebc -> 2c9a79d8b DELTASPIKE-593 improved handling of internal packages Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/2c9a79d8 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/2c9a79d8 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/2c9a79d8 Branch: refs/heads/master Commit: 2c9a79d8b1bc6d5018032fd7fa95cb76f32c3803 Parents: 043f33e Author: gpetracek Authored: Sat May 17 15:16:05 2014 +0200 Committer: gpetracek Committed: Sat May 17 15:16:05 2014 +0200 ---------------------------------------------------------------------- deltaspike/modules/test-control/impl/pom.xml | 6 ++++ .../impl/mock/DefaultMockFilter.java | 9 +++++- .../InternalTestClassDeactivator.java | 33 ++++++++++++++++++++ .../testcontrol/InternalTestMockFilter.java | 3 +- .../META-INF/apache-deltaspike.properties | 18 +++++++++++ 5 files changed, 66 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2c9a79d8/deltaspike/modules/test-control/impl/pom.xml ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/pom.xml b/deltaspike/modules/test-control/impl/pom.xml index 8edb707..46514b2 100644 --- a/deltaspike/modules/test-control/impl/pom.xml +++ b/deltaspike/modules/test-control/impl/pom.xml @@ -106,6 +106,12 @@ org.mockito mockito-all + + + org.apache.deltaspike.core + deltaspike-core-impl + test + http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2c9a79d8/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/DefaultMockFilter.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/DefaultMockFilter.java b/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/DefaultMockFilter.java index 68c9f1e..71b215a 100644 --- a/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/DefaultMockFilter.java +++ b/deltaspike/modules/test-control/impl/src/main/java/org/apache/deltaspike/testcontrol/impl/mock/DefaultMockFilter.java @@ -26,6 +26,7 @@ import javax.enterprise.inject.spi.AnnotatedType; public class DefaultMockFilter implements MockFilter { + private static final String DS_BASE_PACKAGE = "org.apache.deltaspike."; private static final String OWB_BASE_PACKAGE = "org.apache.webbeans."; private static final String WELD_BASE_PACKAGE = "org.jboss.weld."; @@ -48,6 +49,12 @@ public class DefaultMockFilter implements MockFilter protected boolean isInternalPackage(String packageName) { - return packageName.startsWith(OWB_BASE_PACKAGE) || packageName.startsWith(WELD_BASE_PACKAGE); + return packageName.startsWith(OWB_BASE_PACKAGE) || packageName.startsWith(WELD_BASE_PACKAGE) || + isDeltaSpikePackage(packageName); + } + + protected boolean isDeltaSpikePackage(String packageName) + { + return packageName.startsWith(DS_BASE_PACKAGE); } } http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2c9a79d8/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/InternalTestClassDeactivator.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/InternalTestClassDeactivator.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/InternalTestClassDeactivator.java new file mode 100644 index 0000000..4474be5 --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/InternalTestClassDeactivator.java @@ -0,0 +1,33 @@ +/* + * 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. + */ +package org.apache.deltaspike.test.testcontrol; + +import org.apache.deltaspike.core.spi.activation.ClassDeactivator; +import org.apache.deltaspike.core.spi.activation.Deactivatable; +import org.apache.deltaspike.testcontrol.impl.mock.DefaultMockFilter; + +//just needed because the internal test-packages need to be handled differently +public class InternalTestClassDeactivator implements ClassDeactivator +{ + @Override + public Boolean isActivated(Class targetClass) + { + return !DefaultMockFilter.class.equals(targetClass); + } +} http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2c9a79d8/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/InternalTestMockFilter.java ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/InternalTestMockFilter.java b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/InternalTestMockFilter.java index 1478293..242fbcf 100644 --- a/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/InternalTestMockFilter.java +++ b/deltaspike/modules/test-control/impl/src/test/java/org/apache/deltaspike/test/testcontrol/InternalTestMockFilter.java @@ -22,11 +22,10 @@ import org.apache.deltaspike.testcontrol.impl.mock.DefaultMockFilter; public class InternalTestMockFilter extends DefaultMockFilter { - private static final String DS_BASE_PACKAGE = "org.apache.deltaspike."; private static final String DS_TEST_BASE_PACKAGE = "org.apache.deltaspike.test.testcontrol.mock."; protected boolean isInternalPackage(String packageName) { - return (packageName.startsWith(DS_BASE_PACKAGE) && !packageName.startsWith(DS_TEST_BASE_PACKAGE)); + return super.isInternalPackage(packageName) && !packageName.startsWith(DS_TEST_BASE_PACKAGE); } } http://git-wip-us.apache.org/repos/asf/deltaspike/blob/2c9a79d8/deltaspike/modules/test-control/impl/src/test/resources/META-INF/apache-deltaspike.properties ---------------------------------------------------------------------- diff --git a/deltaspike/modules/test-control/impl/src/test/resources/META-INF/apache-deltaspike.properties b/deltaspike/modules/test-control/impl/src/test/resources/META-INF/apache-deltaspike.properties new file mode 100644 index 0000000..d299861 --- /dev/null +++ b/deltaspike/modules/test-control/impl/src/test/resources/META-INF/apache-deltaspike.properties @@ -0,0 +1,18 @@ +# 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. + +org.apache.deltaspike.core.spi.activation.ClassDeactivator=org.apache.deltaspike.test.testcontrol.InternalTestClassDeactivator