Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1084511

Summary: SwitchYard properties not available in JUnit test
Product: [JBoss] JBoss Fuse Service Works 6 Reporter: Anton Giertli <agiertli>
Component: SwitchYardAssignee: Tomohisa Igarashi <toigaras>
Status: CLOSED NOTABUG QA Contact: Jiri Sedlacek <jsedlace>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.0 GACC: ganandan, oskutka, soa-p-jira, tasato
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-30 12:49:44 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
maven reproducer none

Description Anton Giertli 2014-04-04 14:21:58 UTC
Description of problem:

Properties defined in SwitchYard.xml are not accessible when the service is tested using switchyard test suite.

Same property is accessible when the service is deployed onto container.

Version-Release number of selected component (if applicable):

FSW 6.0.0
How reproducible:

always

Steps to Reproduce:
1. Download attachment
2. Run FSW
3. execute  mvn clean package jboss-as:deploy
4. execute  mvn exec:java
5. property value is correctly retrieved
6. now execute GreetServiceTest
7. the same property has null value

I have also read in https://community.jboss.org/wiki/SwitchYardPropertiesSupport
that
"Unit test properties (this needs to be added)"

However, the document is ~15 months old so not sure how relevant it is.

Actual results:
Property defined in switchyard.xml is not accessible when testing the service using switchyard test suite.

Expected results:

Property defined in switchyard.xml is accessible when testing the service using switchyard test suite.
Additional info:

Comment 1 Anton Giertli 2014-04-04 14:22:36 UTC
Created attachment 882739 [details]
maven reproducer

Comment 2 Keith Babo 2015-01-28 13:15:24 UTC
Confirmed that this still exists with SY 2.0.0.Beta1.  There is a unit test for property injection in the bean component test suite, so not sure what's going wrong here.

Comment 3 Tomohisa Igarashi 2015-01-30 12:49:44 UTC
You need to trigger full deployment process to get implementation property injected. The unit test run by SY test kit triggers simplified version of deployment by default, and you need to specify the location of switchyard.xml to trigger full deployment.

--- src/test/java/com/example/switchyard/switchyard_example/GreetServiceTest.java.orig	2015-01-30 21:44:04.540136135 +0900
+++ src/test/java/com/example/switchyard/switchyard_example/GreetServiceTest.java	2015-01-30 21:42:57.553269218 +0900
@@ -25,7 +25,7 @@
 import org.switchyard.component.test.mixins.cdi.CDIMixIn;
 
 @RunWith(SwitchYardRunner.class)
-@SwitchYardTestCaseConfig(mixins = CDIMixIn.class)
+@SwitchYardTestCaseConfig(mixins = CDIMixIn.class, config = "META-INF/switchyard.xml")
 public class GreetServiceTest {
 
     @ServiceOperation("GreetingService.greet")