-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SWITCHYARD-318: ClientProxyBean.createExchange does not set exchange …
- Loading branch information
Showing
14 changed files
with
409 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
.../src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors | ||
* as indicated by the @authors tag. All rights reserved. | ||
* See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This copyrighted material is made available to anyone wishing to use, | ||
* modify, copy, or redistribute it subject to the terms and conditions | ||
* of the GNU Lesser General Public License, v. 2.1. | ||
* This program is distributed in the hope that it will be useful, but WITHOUT A | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
* You should have received a copy of the GNU Lesser General Public License, | ||
* v.2.1 along with this distribution; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
* MA 02110-1301, USA. | ||
*/ | ||
|
||
package org.switchyard.component.bean.multiversionref; | ||
|
||
/** | ||
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a> | ||
*/ | ||
public interface InventoryClientService1 { | ||
|
||
String doStuff(String input); | ||
} |
43 changes: 43 additions & 0 deletions
43
.../test/java/org/switchyard/component/bean/multiversionref/InventoryClientService1Bean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors | ||
* as indicated by the @authors tag. All rights reserved. | ||
* See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This copyrighted material is made available to anyone wishing to use, | ||
* modify, copy, or redistribute it subject to the terms and conditions | ||
* of the GNU Lesser General Public License, v. 2.1. | ||
* This program is distributed in the hope that it will be useful, but WITHOUT A | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
* You should have received a copy of the GNU Lesser General Public License, | ||
* v.2.1 along with this distribution; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
* MA 02110-1301, USA. | ||
*/ | ||
|
||
package org.switchyard.component.bean.multiversionref; | ||
|
||
import org.switchyard.component.bean.Reference; | ||
import org.switchyard.component.bean.Service; | ||
import org.switchyard.component.bean.multiversionref.oldinvservice.A; | ||
import org.switchyard.component.bean.multiversionref.oldinvservice.OldInventoryService; | ||
|
||
import javax.inject.Inject; | ||
|
||
/** | ||
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a> | ||
*/ | ||
@Service(InventoryClientService1.class) | ||
public class InventoryClientService1Bean implements InventoryClientService1 { | ||
|
||
@Inject @Reference("InventoryService") | ||
private OldInventoryService oldInventoryService; | ||
|
||
@Override | ||
public String doStuff(String input) { | ||
A result = oldInventoryService.getInventory(new A()); | ||
return "old"; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
.../src/test/java/org/switchyard/component/bean/multiversionref/InventoryClientService2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors | ||
* as indicated by the @authors tag. All rights reserved. | ||
* See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This copyrighted material is made available to anyone wishing to use, | ||
* modify, copy, or redistribute it subject to the terms and conditions | ||
* of the GNU Lesser General Public License, v. 2.1. | ||
* This program is distributed in the hope that it will be useful, but WITHOUT A | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
* You should have received a copy of the GNU Lesser General Public License, | ||
* v.2.1 along with this distribution; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
* MA 02110-1301, USA. | ||
*/ | ||
|
||
package org.switchyard.component.bean.multiversionref; | ||
|
||
/** | ||
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a> | ||
*/ | ||
public interface InventoryClientService2 { | ||
|
||
String doStuff(String input); | ||
} |
43 changes: 43 additions & 0 deletions
43
.../test/java/org/switchyard/component/bean/multiversionref/InventoryClientService2Bean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors | ||
* as indicated by the @authors tag. All rights reserved. | ||
* See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This copyrighted material is made available to anyone wishing to use, | ||
* modify, copy, or redistribute it subject to the terms and conditions | ||
* of the GNU Lesser General Public License, v. 2.1. | ||
* This program is distributed in the hope that it will be useful, but WITHOUT A | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
* You should have received a copy of the GNU Lesser General Public License, | ||
* v.2.1 along with this distribution; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
* MA 02110-1301, USA. | ||
*/ | ||
|
||
package org.switchyard.component.bean.multiversionref; | ||
|
||
import org.switchyard.component.bean.Reference; | ||
import org.switchyard.component.bean.Service; | ||
import org.switchyard.component.bean.multiversionref.newinvservice.B; | ||
import org.switchyard.component.bean.multiversionref.newinvservice.InventoryService; | ||
|
||
import javax.inject.Inject; | ||
|
||
/** | ||
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a> | ||
*/ | ||
@Service(InventoryClientService2.class) | ||
public class InventoryClientService2Bean implements InventoryClientService2 { | ||
|
||
@Inject @Reference("InventoryService") | ||
private InventoryService newInventoryService; | ||
|
||
@Override | ||
public String doStuff(String input) { | ||
B result = newInventoryService.getInventory(new B()); | ||
return "new"; | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
.../src/test/java/org/switchyard/component/bean/multiversionref/MultiVersionServiceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors | ||
* as indicated by the @authors tag. All rights reserved. | ||
* See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This copyrighted material is made available to anyone wishing to use, | ||
* modify, copy, or redistribute it subject to the terms and conditions | ||
* of the GNU Lesser General Public License, v. 2.1. | ||
* This program is distributed in the hope that it will be useful, but WITHOUT A | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
* You should have received a copy of the GNU Lesser General Public License, | ||
* v.2.1 along with this distribution; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
* MA 02110-1301, USA. | ||
*/ | ||
|
||
package org.switchyard.component.bean.multiversionref; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.switchyard.test.SwitchYardTestCase; | ||
import org.switchyard.test.SwitchYardTestCaseConfig; | ||
import org.switchyard.test.mixins.CDIMixIn; | ||
|
||
/** | ||
* This test is testing checking that @Referenced services can be invoked | ||
* through old and new interfaces and that the appropriate input/output | ||
* parameter transformations are automatically applied based on the ExchangeContract | ||
* information specified in the ClientBeanProxyHandler. | ||
* <p/> | ||
* InventoryClientService1 uses the old inventory interface to invoke the inventory service, | ||
* while InventoryClientService2 uses the new inventory interface. In both cases, they are | ||
* invoking the same backend service (the new version). SwitchYard ensures that the appropriate | ||
* type transformation happen for InventoryClientService1. | ||
* | ||
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a> | ||
*/ | ||
@SwitchYardTestCaseConfig(mixins = CDIMixIn.class) | ||
public class MultiVersionServiceTest extends SwitchYardTestCase { | ||
|
||
@Test | ||
public void test_InventoryClientService1() { | ||
String response = newInvoker("InventoryClientService1.doStuff").sendInOut("hello").getContent(String.class); | ||
|
||
Assert.assertEquals("old", response); | ||
} | ||
|
||
@Test | ||
public void test_InventoryClientService2() { | ||
String response = newInvoker("InventoryClientService2.doStuff").sendInOut("hello").getContent(String.class); | ||
|
||
Assert.assertEquals("new", response); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
bean/src/test/java/org/switchyard/component/bean/multiversionref/newinvservice/B.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors | ||
* as indicated by the @authors tag. All rights reserved. | ||
* See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This copyrighted material is made available to anyone wishing to use, | ||
* modify, copy, or redistribute it subject to the terms and conditions | ||
* of the GNU Lesser General Public License, v. 2.1. | ||
* This program is distributed in the hope that it will be useful, but WITHOUT A | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
* You should have received a copy of the GNU Lesser General Public License, | ||
* v.2.1 along with this distribution; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
* MA 02110-1301, USA. | ||
*/ | ||
|
||
package org.switchyard.component.bean.multiversionref.newinvservice; | ||
|
||
/** | ||
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a> | ||
*/ | ||
public class B { | ||
} |
28 changes: 28 additions & 0 deletions
28
...st/java/org/switchyard/component/bean/multiversionref/newinvservice/InventoryService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors | ||
* as indicated by the @authors tag. All rights reserved. | ||
* See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This copyrighted material is made available to anyone wishing to use, | ||
* modify, copy, or redistribute it subject to the terms and conditions | ||
* of the GNU Lesser General Public License, v. 2.1. | ||
* This program is distributed in the hope that it will be useful, but WITHOUT A | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
* You should have received a copy of the GNU Lesser General Public License, | ||
* v.2.1 along with this distribution; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
* MA 02110-1301, USA. | ||
*/ | ||
|
||
package org.switchyard.component.bean.multiversionref.newinvservice; | ||
|
||
/** | ||
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a> | ||
*/ | ||
public interface InventoryService { | ||
|
||
B getInventory(B b); | ||
} |
34 changes: 34 additions & 0 deletions
34
.../org/switchyard/component/bean/multiversionref/newinvservice/NewInventoryServiceBean.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* JBoss, Home of Professional Open Source | ||
* Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors | ||
* as indicated by the @authors tag. All rights reserved. | ||
* See the copyright.txt in the distribution for a | ||
* full listing of individual contributors. | ||
* | ||
* This copyrighted material is made available to anyone wishing to use, | ||
* modify, copy, or redistribute it subject to the terms and conditions | ||
* of the GNU Lesser General Public License, v. 2.1. | ||
* This program is distributed in the hope that it will be useful, but WITHOUT A | ||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. | ||
* You should have received a copy of the GNU Lesser General Public License, | ||
* v.2.1 along with this distribution; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | ||
* MA 02110-1301, USA. | ||
*/ | ||
|
||
package org.switchyard.component.bean.multiversionref.newinvservice; | ||
|
||
import org.switchyard.component.bean.Service; | ||
|
||
/** | ||
* @author <a href="mailto:tom.fennelly@gmail.com">tom.fennelly@gmail.com</a> | ||
*/ | ||
@Service(InventoryService.class) | ||
public class NewInventoryServiceBean implements InventoryService { | ||
|
||
@Override | ||
public B getInventory(B b) { | ||
return b; | ||
} | ||
} |
Oops, something went wrong.