Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 41CBA200C84 for ; Mon, 29 May 2017 13:39:11 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3D909160BCE; Mon, 29 May 2017 11:39:11 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 3672A160BC2 for ; Mon, 29 May 2017 13:39:10 +0200 (CEST) Received: (qmail 57297 invoked by uid 500); 29 May 2017 11:39:09 -0000 Mailing-List: contact users-help@deltaspike.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@deltaspike.apache.org Delivered-To: mailing list users@deltaspike.apache.org Received: (qmail 57284 invoked by uid 99); 29 May 2017 11:39:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 May 2017 11:39:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 8058AC0708 for ; Mon, 29 May 2017 11:39:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.379 X-Spam-Level: ** X-Spam-Status: No, score=2.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id xlFIb6auVcOH for ; Mon, 29 May 2017 11:39:04 +0000 (UTC) Received: from mail-oi0-f53.google.com (mail-oi0-f53.google.com [209.85.218.53]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id C17D25F3F5 for ; Mon, 29 May 2017 11:39:03 +0000 (UTC) Received: by mail-oi0-f53.google.com with SMTP id w10so76062633oif.0 for ; Mon, 29 May 2017 04:39:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=vl+kVeL5xqAcH/ZQUTiR9Kjv4/jRWC9Os2kvmbxRomg=; b=lHMg+k4I8O/tJqte9qyBD+C/f714H4c5xcQp69wmGcas9Mob2F4leRr2iiOTD5rhld oZoHB6hCItb5hAzL6tW544rgQz52oiAXSMq4pkoSggJiHYMY/MJ/4dId3fSU0PuoA4fS Mc4XbnDddwU7fspzZ6lpSmHKrenk+cyRPkX5SaB/3W2sQzZxaUUGSCt5cmdaQIZ1xwDM Lrob4RGmX4BEWFIgOj3astmNSPYn74Pn8qEpnRQgR0W4VTfoWuRnjvbYcV5/eD2W6yMR +CK0eljm3gCKytWjCirBApH7VGmhPM98m5tDHCmDLLV1XiADPVOWtJiBnUMLGFVVLwXL ut3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=vl+kVeL5xqAcH/ZQUTiR9Kjv4/jRWC9Os2kvmbxRomg=; b=ZwF2Jw8FLOu5qiRfdFHeqoU1DtleGEGu9X46m0iVYgNQHQIbIRCY8Xp1ipJjFexoUY cDu8QzgaDinkCWkRwGFZ6X2puPmMHoeQluIaZPZhHjK1PFCa5TDSbXUesqe1ZNkuXptc OZwYMWRmY+3Mh9D4RfJXJ2HO8wNn6E9W5vNm1n+xRBBP+SF3AyOqzOM6/I2q1Lt+7utO 8qG+APTq1FrF/0mPKCVA8chn1xgpni+RHpT3U2S0XlYqTE0nvI1a4DGyjCAx2mtRe0Zj hsFPGT1COHRSGx9g0tdEuoYTjA/l0dVrJFcjx6HoM2ZkSD1IkcMOMNDaOlUb8eudbrnQ 8sJQ== X-Gm-Message-State: AODbwcCfCjkFQ3pMxgYaQTydxu0ND4swcMTnRJquH1DPBoakN/4YvD8e MBpiup6wTwIEo5ZdJvdZbyyf7jqQdQ== X-Received: by 10.157.28.135 with SMTP id l7mr6459396ota.87.1496057942893; Mon, 29 May 2017 04:39:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.42.29 with HTTP; Mon, 29 May 2017 04:38:41 -0700 (PDT) In-Reply-To: References: From: Lars-Fredrik Smedberg Date: Mon, 29 May 2017 13:38:41 +0200 Message-ID: Subject: Re: Question on test-control and producers To: users Content-Type: multipart/alternative; boundary="f40304378ef43fea580550a82291" archived-at: Mon, 29 May 2017 11:39:11 -0000 --f40304378ef43fea580550a82291 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Gerhard Was that mail for me? If so which testcase did you not find work that I posted about? Regards LF On Sat, May 27, 2017 at 10:31 AM, Gerhard Petracek wrote: > short addition: > > it looks like you found a portability issue in case of more complex cases > -> can you please file a jira-ticket. > > fyi: > i've pushed a demo of the approach mentioned earlier (see [1]), which > doesn't use tricks and > therefore it's more predictable in view of (existing and) upcoming versio= ns > of owb and weld. > > regards, > gerhard > > [1] > https://github.com/os890/javase-cdi-ds-project-template/tree/mock- > registration-event > > > > 2017-05-23 14:15 GMT+02:00 Lars-Fredrik Smedberg : > > > Hi > > > > interesting aproach... will play around with it and see how it works... > > > > regards > > lf > > > > On Tue, May 23, 2017 at 2:05 PM, Gerhard Petracek > > wrote: > > > > > hi lars-fredrik, > > > > > > you can inject diff. "sub-producers" (in your test-producer) -> you > > > delegate to one of them (just enable one at a time e.g. based on an > event > > > you fire in your test). > > > (you could even provide the sub-producer as payload of the event). > > > > > > regards, > > > gerhard > > > > > > > > > > > > 2017-05-23 13:56 GMT+02:00 Lars-Fredrik Smedberg = : > > > > > > > Hi Gerhard > > > > > > > > Thanks for the hints... I did play around some with the @Specializ= es > > > > annotation and extending the existing producers and it works nice..= . > > the > > > > limitation though is that different test cases within the same test > > > module > > > > (having the same classpath when run) can not have different > specialized > > > > implementations... is there a way around that except for using > > > > @Exclude(...) as discussed earlier? > > > > > > > > Regards > > > > LF > > > > > > > > On Tue, May 23, 2017 at 1:15 AM, Gerhard Petracek < > > gpetracek@apache.org> > > > > wrote: > > > > > > > > > hi lars-fredrik, > > > > > > > > > > in such a case it's usually enough to extend the original bean (b= ut > > > keep > > > > > the extended bean in the test-classpath) + annotate it with > > > @Specializes > > > > + > > > > > override the producer-methods (+ don't forget to use the same > > > annotations > > > > > like @Produces). > > > > > if you don't like to "couple" both beans that way, you just need > the > > > > first > > > > > @Exclude. the test-producer only needs one if you don't like to > move > > it > > > > to > > > > > the test-classpath. > > > > > > > > > > regards, > > > > > gerhard > > > > > > > > > > > > > > > > > > > > 2017-05-22 17:19 GMT+02:00 Lars-Fredrik Smedberg < > itsmeden@gmail.com > > >: > > > > > > > > > > > Hi Gerhard > > > > > > > > > > > > I have been playing around some with the ProjectStage to see ho= w > it > > > > > > works.... if the archive with code being tested have a producer > > class > > > > > that > > > > > > produces beans of type A and I want to use another producer cla= ss > > to > > > > > > produce beans of type A when running my unit tests does that > imply > > > > that: > > > > > > > > > > > > - I have to annotate the production code producer class > > > > > > with @Exclude(ifProjectStage =3D ProjectStage.UnitTest.class) A= ND > > > > > > - The unit test producer class with > @Exclude(exceptIfProjectStage =3D > > > > > > ProjectStage.UnitTest.class) > > > > > > > > > > > > ...or is that a bad use-case for using ProjectStage (if so plea= se > > > push > > > > me > > > > > > in the right direction).... if its a good use case for it does = it > > > then > > > > > mean > > > > > > I need to annotate all my production producer classes with > > > > > > @Exclude(ifProjectStage =3D ProjectStage.UnitTest.class) to be = able > > to > > > > > allow > > > > > > them to be replaced by tests? > > > > > > > > > > > > Regards > > > > > > LF > > > > > > > > > > > > > > > > > > > > > > > > On Tue, May 16, 2017 at 1:33 PM, Gerhard Petracek < > > > > > > gerhard.petracek@gmail.com> wrote: > > > > > > > > > > > > > hi lars-fredrik, > > > > > > > > > > > > > > please use simple java-mechanisms or cdi-mechanisms like even= ts > > or > > > > > > > ds-mechanisms like the project-stage to enable/disable logic = in > > > your > > > > > > > (test-)classes. > > > > > > > you can find simple examples e.g. at [1] + [2] or [3] + [4]. > > > > > > > > > > > > > > ds is about keeping it simple and close to java- and > > cdi-mechanisms > > > > > > (since > > > > > > > they are enough for most cases). > > > > > > > > > > > > > > regards, > > > > > > > gerhard > > > > > > > > > > > > > > [1] > > > > > > > https://github.com/CDIatWork/IdeaFork/blob/master/ideafork_ > > > > > > > core/src/test/java/at/irian/cdiatwork/ideafork/test/core/ > > > > > > > InterceptorTest.java > > > > > > > [2] > > > > > > > https://github.com/CDIatWork/IdeaFork/blob/master/ideafork_ > > > > > > > core/src/test/java/at/irian/cdiatwork/ideafork/test/core/ > > > > > > > TestMonitoredInterceptorStrategy.java > > > > > > > [3] > > > > > > > https://github.com/CDIatWork/IdeaFork/blob/master/ideafork_ > > > > > > > core/src/test/java/at/irian/cdiatwork/ideafork/test/core/ > > > > > EventTest.java > > > > > > > [4] > > > > > > > https://github.com/CDIatWork/IdeaFork/blob/master/ideafork_ > > > > > > > core/src/test/java/at/irian/cdiatwork/ideafork/test/core/ > > > > > > > TestIdeaSavedObserver.java > > > > > > > > > > > > > > > > > > > > > > > > > > > > 2017-05-16 9:39 GMT+02:00 Lars-Fredrik Smedberg < > > > itsmeden@gmail.com > > > > >: > > > > > > > > > > > > > > > Hi > > > > > > > > > > > > > > > > Is it possible with test-control to tell it to use a > different > > > > > producer > > > > > > > for > > > > > > > > a test-case (as I've seen in Weld JUnit Extensions and > CDI-Unit > > > > where > > > > > > you > > > > > > > > either cherry pick the classes with the producer you want o= r > > with > > > > > > > CDI-Unit > > > > > > > > where you can specify a producer to be an alternative > > producer). > > > > The > > > > > > > > samples I've seen mocks the bean being produced rather than > > > > > > > > changing/replacing the producer itself... I also see this > > config > > > in > > > > > the > > > > > > > > tutorial but I'm not sure what its for: > > > > > > > > > > > > > > > > allow_mocked_producers > > > > > > > > > > > > > > > > Regards > > > > > > > > LF > > > > > > > > > > > > > > > > -- > > > > > > > > Med v=C3=A4nlig h=C3=A4lsning / Best regards > > > > > > > > > > > > > > > > Lars-Fredrik Smedberg > > > > > > > > > > > > > > > > STATEMENT OF CONFIDENTIALITY: > > > > > > > > The information contained in this electronic message and an= y > > > > > > > > attachments to this message are intended for the exclusive > use > > of > > > > the > > > > > > > > address(es) and may contain confidential or privileged > > > information. > > > > > If > > > > > > > > you are not the intended recipient, please notify > Lars-Fredrik > > > > > Smedberg > > > > > > > > immediately at itsmeden@gmail.com, and destroy all copies o= f > > > this > > > > > > > > message and any attachments. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Med v=C3=A4nlig h=C3=A4lsning / Best regards > > > > > > > > > > > > Lars-Fredrik Smedberg > > > > > > > > > > > > STATEMENT OF CONFIDENTIALITY: > > > > > > The information contained in this electronic message and any > > > > > > attachments to this message are intended for the exclusive use = of > > the > > > > > > address(es) and may contain confidential or privileged > information. > > > If > > > > > > you are not the intended recipient, please notify Lars-Fredrik > > > Smedberg > > > > > > immediately at itsmeden@gmail.com, and destroy all copies of > this > > > > > > message and any attachments. > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > Med v=C3=A4nlig h=C3=A4lsning / Best regards > > > > > > > > Lars-Fredrik Smedberg > > > > > > > > STATEMENT OF CONFIDENTIALITY: > > > > The information contained in this electronic message and any > > > > attachments to this message are intended for the exclusive use of t= he > > > > address(es) and may contain confidential or privileged information. > If > > > > you are not the intended recipient, please notify Lars-Fredrik > Smedberg > > > > immediately at itsmeden@gmail.com, and destroy all copies of this > > > > message and any attachments. > > > > > > > > > > > > > > > -- > > Med v=C3=A4nlig h=C3=A4lsning / Best regards > > > > Lars-Fredrik Smedberg > > > > STATEMENT OF CONFIDENTIALITY: > > The information contained in this electronic message and any > > attachments to this message are intended for the exclusive use of the > > address(es) and may contain confidential or privileged information. If > > you are not the intended recipient, please notify Lars-Fredrik Smedberg > > immediately at itsmeden@gmail.com, and destroy all copies of this > > message and any attachments. > > > --=20 Med v=C3=A4nlig h=C3=A4lsning / Best regards Lars-Fredrik Smedberg STATEMENT OF CONFIDENTIALITY: The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the address(es) and may contain confidential or privileged information. If you are not the intended recipient, please notify Lars-Fredrik Smedberg immediately at itsmeden@gmail.com, and destroy all copies of this message and any attachments. --f40304378ef43fea580550a82291--