diff options
Diffstat (limited to 'branches/sca-java-0.99/samples/quote-xquery/src/main/java')
14 files changed, 0 insertions, 577 deletions
diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java deleted file mode 100644 index 146939c190..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 xquery.quote; - -import org.example.avail.AvailQuote; -import org.osoa.sca.annotations.Service; - -@Service(AvailQuoteProviderService.class) -public class AvailQuoteProviderImpl implements AvailQuoteProviderService { - - public AvailQuote provideAvailQuote(String dummyString) { - return TestHelper.buildAvailQuoteData(); - } -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java deleted file mode 100644 index ac55c02efa..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderNodeInfo.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 xquery.quote; - -import net.sf.saxon.om.NodeInfo; - -import org.osoa.sca.annotations.Remotable; -import org.osoa.sca.annotations.Service; - -@Remotable -@Service -public interface AvailQuoteProviderNodeInfo { - NodeInfo provideAvailQuote(String dummyString); -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java deleted file mode 100644 index 2715be19a9..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/AvailQuoteProviderService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 xquery.quote; - -import org.example.avail.AvailQuote; -import org.osoa.sca.annotations.Remotable; -import org.osoa.sca.annotations.Service; - -@Remotable -@Service -public interface AvailQuoteProviderService { - AvailQuote provideAvailQuote(String dummyString); -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java deleted file mode 100644 index 84abb5c520..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/ExternalReferencesQuoteJoin.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 xquery.quote; - -import org.example.quote.Quote; -import org.osoa.sca.annotations.Remotable; -import org.osoa.sca.annotations.Service; - -@Remotable -@Service -public interface ExternalReferencesQuoteJoin { - public Quote joinPriceAndAvailQuotes(float taxRate); -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java deleted file mode 100644 index a8bfc6ca1f..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 xquery.quote; - -import org.example.price.PriceQuote; -import org.osoa.sca.annotations.Remotable; -import org.osoa.sca.annotations.Service; - -@Remotable -@Service -public interface PriceQuoteProvider { - - public PriceQuote providePriceQuote(); -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java deleted file mode 100644 index cbd71f6279..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderImpl.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 xquery.quote; - -import org.example.price.PriceQuote; - -public class PriceQuoteProviderImpl implements PriceQuoteProvider { - public PriceQuote providePriceQuote() { - return TestHelper.buildPriceQuoteData(); - } -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java deleted file mode 100644 index c95c979c64..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PriceQuoteProviderNodeInfo.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 xquery.quote; - -import net.sf.saxon.om.NodeInfo; - -import org.osoa.sca.annotations.Remotable; -import org.osoa.sca.annotations.Service; - -@Remotable -@Service -public interface PriceQuoteProviderNodeInfo { - public NodeInfo providePriceQuote(); -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java deleted file mode 100644 index 3a70f619a0..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/PropertiesQuoteJoin.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 xquery.quote; - -import org.example.quote.Quote; -import org.osoa.sca.annotations.Remotable; -import org.osoa.sca.annotations.Service; - -@Remotable -@Service -public interface PropertiesQuoteJoin { - public Quote joinPriceAndAvailQuotes(); -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java deleted file mode 100644 index 0b90c9fb0f..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculator.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 xquery.quote; - -import org.osoa.sca.annotations.Remotable; -import org.osoa.sca.annotations.Service; - -@Remotable -@Service -public interface QuoteCalculator { - public float calculateTotalPrice(float taxRate, int quantity, float price, boolean fillOrder); -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java deleted file mode 100644 index 34fd24fbe5..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteCalculatorImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 xquery.quote; - -public class QuoteCalculatorImpl implements QuoteCalculator { - - public float calculateTotalPrice(float taxRate, int quantity, float price, - boolean fillOrder) { - float totalTax, costNoTax, totalCost; - if (fillOrder) - { - // Calculate the total tax - totalTax = taxRate * quantity * price; - // Calculate the total cost without tax - costNoTax = quantity * price; - // Add the tax and the cost to get the total cost - totalCost = totalTax + costNoTax; - } - else - { - totalCost = 0; - } - return totalCost; - } - -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java deleted file mode 100644 index fd16c4b4c5..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoin.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 xquery.quote; - -import org.example.avail.AvailQuote; -import org.example.price.PriceQuote; -import org.example.quote.Quote; -import org.osoa.sca.annotations.Remotable; -import org.osoa.sca.annotations.Service; - -@Remotable -@Service -public interface QuoteJoin { - public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate); -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java deleted file mode 100644 index 5d1c7066fe..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocal.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 xquery.quote; - -import org.example.avail.AvailQuote; -import org.example.price.PriceQuote; -import org.example.quote.Quote; - -public interface QuoteJoinLocal { - public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate); - public Quote joinPriceAndAvailQuotesWs(PriceQuote priceQuote, AvailQuote availQuote, float taxRate); - public Quote joinPriceAndAvailQuotes(); - public Quote joinPriceAndAvailQuotes(float taxRate); - -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java deleted file mode 100644 index 2eff74fbc1..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/QuoteJoinLocalImpl.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 xquery.quote; - -import org.example.avail.AvailQuote; -import org.example.price.PriceQuote; -import org.example.quote.Quote; -import org.osoa.sca.annotations.Reference; - -public class QuoteJoinLocalImpl implements QuoteJoinLocal { - private QuoteJoin quoteJoin; - private QuoteJoin quoteJoinWs; - private PropertiesQuoteJoin propertiesQuoteJoin; - private ExternalReferencesQuoteJoin externalServicesQuoteJoin; - - @Reference - public void setQuoteJoin(QuoteJoin quoteJoin) { - this.quoteJoin = quoteJoin; - } - - @Reference - public void setQuoteJoinWs(QuoteJoin quoteJoinWs) { - this.quoteJoinWs = quoteJoinWs; - } - - @Reference - public void setPropertiesQuoteJoin(PropertiesQuoteJoin propertiesQuoteJoin) { - this.propertiesQuoteJoin = propertiesQuoteJoin; - } - - @Reference - public void setExternalServicesQuoteJoin(ExternalReferencesQuoteJoin externalServicesQuoteJoin) { - this.externalServicesQuoteJoin = externalServicesQuoteJoin; - } - - public Quote joinPriceAndAvailQuotes(PriceQuote priceQuote, AvailQuote availQuote, float taxRate) { - return quoteJoin.joinPriceAndAvailQuotes(priceQuote, availQuote, taxRate); - } - - public Quote joinPriceAndAvailQuotesWs(PriceQuote priceQuote, AvailQuote availQuote, float taxRate) { - return quoteJoinWs.joinPriceAndAvailQuotes(priceQuote, availQuote, taxRate); - } - - public Quote joinPriceAndAvailQuotes(float taxRate) { - return externalServicesQuoteJoin.joinPriceAndAvailQuotes(taxRate); - } - - public Quote joinPriceAndAvailQuotes() { - return propertiesQuoteJoin.joinPriceAndAvailQuotes(); - } -} diff --git a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/TestHelper.java b/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/TestHelper.java deleted file mode 100644 index 65b4df0468..0000000000 --- a/branches/sca-java-0.99/samples/quote-xquery/src/main/java/xquery/quote/TestHelper.java +++ /dev/null @@ -1,144 +0,0 @@ -/* - * 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 xquery.quote; - - -import java.io.IOException; -import java.math.BigInteger; -import java.util.List; - -import junit.framework.TestCase; - -import org.example.avail.AvailFactory; -import org.example.avail.AvailQuote; -import org.example.avail.AvailRequest; -import org.example.price.PriceFactory; -import org.example.price.PriceQuote; -import org.example.price.PriceRequest; -import org.example.price.PriceRequests; -import org.example.price.ShipAddress; -import org.example.quote.Quote; -import org.example.quote.QuoteResponse; - -import commonj.sdo.DataObject; -import commonj.sdo.helper.XMLHelper; -import commonj.sdo.impl.HelperProvider; - -public class TestHelper { - - public static AvailQuote buildAvailQuoteData() { - AvailQuote availQuote = AvailFactory.INSTANCE.createAvailQuote(); - AvailRequest availRequest = AvailFactory.INSTANCE.createAvailRequest(); - availRequest.setWidgetId(BigInteger.valueOf(12)); - availRequest.setRequestedQuantity(10); - availRequest.setQuantityAvail(true); - availRequest.setShipDate("2003-03-22"); - availQuote.getAvailRequest().add(availRequest); - - availRequest = AvailFactory.INSTANCE.createAvailRequest(); - availRequest.setWidgetId(BigInteger.valueOf(134)); - availRequest.setRequestedQuantity(345); - availRequest.setQuantityAvail(false); - availRequest.setShipDate("BackOrder"); - availQuote.getAvailRequest().add(availRequest); - - availRequest = AvailFactory.INSTANCE.createAvailRequest(); - availRequest.setWidgetId(BigInteger.valueOf(211)); - availRequest.setRequestedQuantity(100); - availRequest.setQuantityAvail(true); - availRequest.setShipDate("2003-04-21"); - availQuote.getAvailRequest().add(availRequest); - - return availQuote; - } - - public static PriceQuote buildPriceQuoteData() { - PriceQuote priceQuote = PriceFactory.INSTANCE.createPriceQuote(); - priceQuote.setCustomerName("Acme Inc"); - - ShipAddress shipAddress = PriceFactory.INSTANCE.createShipAddress(); - shipAddress.setStreet("12 Springs Rd"); - shipAddress.setCity("Morris Plains"); - shipAddress.setState("nj"); - shipAddress.setZip("07960"); - priceQuote.setShipAddress(shipAddress); - - PriceRequests priceRequests = PriceFactory.INSTANCE.createPriceRequests(); - PriceRequest priceRequest = PriceFactory.INSTANCE.createPriceRequest(); - priceRequest.setWidgetId(BigInteger.valueOf(12)); - priceRequest.setPrice(1.00f); - priceRequests.getPriceRequest().add(priceRequest); - - priceRequest = PriceFactory.INSTANCE.createPriceRequest(); - priceRequest.setWidgetId(BigInteger.valueOf(134)); - priceRequest.setPrice(34.10f); - priceRequests.getPriceRequest().add(priceRequest); - - priceRequest = PriceFactory.INSTANCE.createPriceRequest(); - priceRequest.setWidgetId(BigInteger.valueOf(211)); - priceRequest.setPrice(10.00f); - priceRequests.getPriceRequest().add(priceRequest); - - priceQuote.setPriceRequests(priceRequests); - - return priceQuote; - } - - public static void assertQuote(AvailQuote availQuote, PriceQuote priceQuote, Quote quote, float taxRate) { - QuoteCalculatorImpl quoteCalculatorImpl = new QuoteCalculatorImpl(); - - TestCase.assertEquals(priceQuote.getCustomerName(), quote.getName()); - ShipAddress shipAddress = priceQuote.getShipAddress(); - TestCase.assertEquals(shipAddress.getStreet()+","+shipAddress.getCity()+","+shipAddress.getState().toUpperCase()+","+shipAddress.getZip(), quote.getAddress()); - List availRequests = availQuote.getAvailRequest(); - List priceRequests = priceQuote.getPriceRequests().getPriceRequest(); - List quoteResponses = quote.getQuoteResponse(); - TestCase.assertEquals(availRequests.size(), priceRequests.size()); - TestCase.assertEquals(availRequests.size(), quoteResponses.size()); - - for(int i=0; i<availRequests.size(); i++) { - AvailRequest availRequest = (AvailRequest)availRequests.get(i); - PriceRequest priceRequest = (PriceRequest)priceRequests.get(i); - QuoteResponse quoteResponse = (QuoteResponse)quoteResponses.get(i); - TestCase.assertEquals(availRequest.getWidgetId(), quoteResponse.getWidgetId()); - TestCase.assertEquals(priceRequest.getPrice(), quoteResponse.getUnitPrice()); - TestCase.assertEquals(availRequest.getRequestedQuantity(), quoteResponse.getRequestedQuantity()); - TestCase.assertEquals(availRequest.isQuantityAvail(), quoteResponse.isFillOrder()); - if(availRequest.getShipDate()==null) { - TestCase.assertNull(quoteResponse.getShipDate()); - } else { - TestCase.assertEquals(availRequest.getShipDate(), quoteResponse.getShipDate()); - } - TestCase.assertEquals(taxRate, quoteResponse.getTaxRate()); - TestCase.assertEquals(quoteCalculatorImpl.calculateTotalPrice(taxRate, availRequest.getRequestedQuantity(), priceRequest.getPrice(), availRequest.isQuantityAvail()), quoteResponse.getTotalCost()); - } - } - - public static void serializeToSystemOut(DataObject object, String name) { - XMLHelper helper = HelperProvider.INSTANCE.xmlHelper(); - - try { - helper.save(object, null, name, System.out); - System.out.println(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } -} |