http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/resources/org/apache/zest/sample/dcicargo/sample_a/infrastructure/wicket/tabs/TabsPanel.html ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/resources/org/apache/zest/sample/dcicargo/sample_a/infrastructure/wicket/tabs/TabsPanel.html b/samples/dci-cargo/dcisample_a/src/main/resources/org/apache/zest/sample/dcicargo/sample_a/infrastructure/wicket/tabs/TabsPanel.html deleted file mode 100644 index fa97eb1..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/resources/org/apache/zest/sample/dcicargo/sample_a/infrastructure/wicket/tabs/TabsPanel.html +++ /dev/null @@ -1,51 +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. - ~ - ~ - --> - -<html xmlns:wicket> -<!-- - 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. ---> -<wicket:head> - <link href="css/tabs.css" rel="stylesheet" type="text/css"/> -</wicket:head> -<wicket:panel> - <div id="tabs"> - <ul> - <li wicket:id="tabsView"><a href="#" wicket:id="link"><span wicket:id="label"></span></a></li> - </ul> - </div> - - <!-- Clear floating to force subsequent containers to draw beneath the tabs --> - <div style="clear:both"></div> -</wicket:panel> -</html> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/WEB-INF/web.xml b/samples/dci-cargo/dcisample_a/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index 4967163..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,42 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - ~ - ~ - --> -<web-app xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" - version="2.5"> - - <display-name>DCI Sample (version A)</display-name> - - <filter> - <filter-name>DCISample_basic_redirect</filter-name> - <filter-class>org.apache.wicket.protocol.http.WicketFilter</filter-class> - <init-param> - <param-name>applicationClassName</param-name> - <param-value>org.apache.zest.sample.dcicargo.sample_a.bootstrap.DCISampleApplication_a</param-value> - </init-param> - </filter> - - <filter-mapping> - <filter-name>DCISample_basic_redirect</filter-name> - <url-pattern>/*</url-pattern> - </filter-mapping> - -</web-app> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/css/prev-next.css ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/css/prev-next.css b/samples/dci-cargo/dcisample_a/src/main/webapp/css/prev-next.css deleted file mode 100644 index 62e2fa6..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/webapp/css/prev-next.css +++ /dev/null @@ -1,51 +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. - * - * - */ - -.prevNextIcons { - /* Modify custom positioning here */ - float:left; - margin-top: 17px; - margin-right: 10px; -} - -.prevNextIcons a { - padding:8px; - background-repeat:no-repeat; -} - -.prevNextIcons .prev { - background-image: url("../../graphics/icon/prev.png"); -} -.prevNextIcons .prevDisabled { - background-image: url("../../graphics/icon/prev_disabled.png"); - pointer-events: none; - cursor: default; -} - -.prevNextIcons .next { - margin-left:8px; - background-image: url("../../graphics/icon/next.png"); -} -.prevNextIcons .nextDisabled { - margin-left:8px; - background-image: url("../../graphics/icon/next_disabled.png"); - pointer-events: none; - cursor: default; -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/css/style.css ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/css/style.css b/samples/dci-cargo/dcisample_a/src/main/webapp/css/style.css deleted file mode 100644 index b9b2ede..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/webapp/css/style.css +++ /dev/null @@ -1,179 +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. - * - * - */ - -body { - margin: 2em; - font-family: 'Lucida Sans', 'Helvetica', 'Sans-serif', 'sans', sans-serif; - font-size: 9pt; - line-height: 1.2em; - background-color: #f5f5f5; -} - -h1, h2, h3, h4, h6 { - color: #E9601A; -} -h4 { - margin-bottom: 5px; -} -a{ - text-decoration:none; -} -a:hover{ - text-decoration:underline; -} -a:visited{ - color:blue; -} - -.left { - float: left; - width: 75%; -} -.right { - font-family: 'Verdana', Arial, Helvetica, serif; - text-align:right; - color: #666; - font-size: 8pt; - font-style: italic; - font-weight: normal; - line-height: 1.5em; - margin-bottom: -50px; -} -.headline { - margin-bottom:17px; -} -.headline a { - text-decoration:none; - color: #E9601A; - font-size: 2em; - font-weight: bold; -} - -#box { - border-width: 0px 1px 1px; - border-style: solid; - border-color: 484a4a; - padding: 1em; - overflow: hidden; - background-color: white; -} - -.headerMenu { - margin-top:10px; - margin-bottom:20px; - color: #E9601A; - font-size: 1.5em; - font-weight: bold; -} -.headerMenu a { - margin-left:15px; - font-size: 9pt; - font-weight: normal; -} - -pre, table, td { - font-family: 'Verdana', Arial, Helvetica, serif; - font-size: 9pt; - line-height: 1.1em; -} - -table td, th { - padding: 4 18 4 0; - align: left; - vertical-align: top; -} - -table thead { - font-weight: bold; -} - -.styleLeftColumn td:first-child { - font-weight: bold; -} - -.errorColor { - color: red; - font-weight: bold; -} -.correctColor { - color: green; - font-weight: bold; -} - -.notifyError { - border: 2px solid red; - padding: 5px; - font-weight: bold; -} -.notifySuccess { - border: 2px solid green; - padding: 5px; - font-weight: bold; -} -.notifySuccess { - border: 2px solid green; - padding: 5px; - font-weight: bold; -} - - - -#toggle a { - padding-left: 17px; - text-decoration:none; - color:black; -} - -#toggle a:hover { - color:blue; -} - -#toggle .closed { - background: url(/graphics/icon/triangle-closed.png) no-repeat; - background-position: 4 2px; -} -#toggle .open { - background: url(/graphics/icon/triangle-open.png) no-repeat; - background-position: 2 4px; -} - - - - - - - - - - - - - - - - - - - - - - - - http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/css/tabs.css ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/css/tabs.css b/samples/dci-cargo/dcisample_a/src/main/webapp/css/tabs.css deleted file mode 100644 index 6d375aa..0000000 --- a/samples/dci-cargo/dcisample_a/src/main/webapp/css/tabs.css +++ /dev/null @@ -1,77 +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. - * - * - */ - -#tabs { - margin-top:12px; - float:left; - width:100%; - background: #f5f5f5 url("../graphics/tabs/bg.png") repeat-x bottom; - font-size:0.9em; - line-height:1.6; - } -#tabs ul { - margin:0; - padding:10px 0; - list-style:none; - } -#tabs li { - float:left; - background: #f5f5f5 url("../graphics/tabs/left.png") no-repeat left top; - margin:0; - padding:0 0 0 11px; - } -#tabs a { - float:left; - display:block; - background: #f5f5f5 url("../graphics/tabs/right.png") no-repeat right top; - padding:6px 15px 4px 4px; - text-decoration:none; - font-weight:bold; - color:#444; - } - -#tabs a:hover { - color:blue; - } - -#tabs a:visited { - color:#444; -} - -#tabs a:visited:hover { - color:blue; - /*color:#E9601A;*/ -} - -/* Commented Backslash Hack - hides rule from IE5-Mac \*/ -#tabs a {float:none;} -/* End IE5-Mac hack */ - - - -#tabs #current { - background-image: url("../graphics/tabs/left_on.png"); - } -#tabs #current a { - background-image:url("../graphics/tabs/right_on.png"); - color:#333; - padding-bottom:5px; - } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/cross.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/cross.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/cross.png deleted file mode 100644 index 1514d51..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/cross.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/error.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/error.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/error.png deleted file mode 100644 index 628cf2d..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/error.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/next.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/next.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/next.png deleted file mode 100644 index 823db76..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/next.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/next_disabled.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/next_disabled.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/next_disabled.png deleted file mode 100644 index 61b8738..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/next_disabled.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/prev-next.psd ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/prev-next.psd b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/prev-next.psd deleted file mode 100644 index 14869ef..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/prev-next.psd and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/prev.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/prev.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/prev.png deleted file mode 100644 index f1ccf7a..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/prev.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/prev_disabled.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/prev_disabled.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/prev_disabled.png deleted file mode 100644 index bc0a07b..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/prev_disabled.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/tick.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/tick.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/tick.png deleted file mode 100644 index a9925a0..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/tick.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/triangle-closed.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/triangle-closed.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/triangle-closed.png deleted file mode 100644 index dac3b3e..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/triangle-closed.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/triangle-open.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/triangle-open.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/triangle-open.png deleted file mode 100644 index d9ff340..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/icon/triangle-open.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/bg.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/bg.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/bg.png deleted file mode 100644 index a682768..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/bg.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/left.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/left.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/left.png deleted file mode 100644 index 92b5eeb..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/left.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/left_on.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/left_on.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/left_on.png deleted file mode 100644 index b0fcc59..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/left_on.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/original.psd ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/original.psd b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/original.psd deleted file mode 100644 index fc71fea..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/original.psd and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/right.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/right.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/right.png deleted file mode 100644 index 97efb03..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/right.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/right_on.png ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/right_on.png b/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/right_on.png deleted file mode 100644 index 6d9783b..0000000 Binary files a/samples/dci-cargo/dcisample_a/src/main/webapp/graphics/tabs/right_on.png and /dev/null differ http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/Start8081.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/Start8081.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/Start8081.java deleted file mode 100644 index 9dc71f8..0000000 --- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/Start8081.java +++ /dev/null @@ -1,70 +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 org.apache.zest.sample.dcicargo.sample_a.bootstrap; - -import org.eclipse.jetty.server.Connector; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.webapp.WebAppContext; - -/** - * Javadoc - */ -public class Start8081 -{ - private Server jetty; - - public static void main( String[] args ) throws Exception - { - new Start8081().start(); - } - - public void start() throws Exception - { - jetty = new Server(); - ServerConnector connector = new ServerConnector(jetty ); - connector.setIdleTimeout( 1000 * 60 * 60 ); - connector.setSoLingerTime( -1 ); - connector.setPort( 8081 ); - jetty.setConnectors( new Connector[]{connector} ); - - WebAppContext webAppContext = new WebAppContext(); - webAppContext.setContextPath( "/" ); - webAppContext.setWar( "src/main/webapp" ); - jetty.setHandler( webAppContext ); - - try - { - jetty.start(); - jetty.join(); - } - catch (Exception e) - { - e.printStackTrace(); - System.exit( 100 ); - } - } - - public void stop() throws Exception - { - jetty.stop(); - jetty.join(); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestApplication.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestApplication.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestApplication.java deleted file mode 100644 index 3279c8d..0000000 --- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestApplication.java +++ /dev/null @@ -1,120 +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 org.apache.zest.sample.dcicargo.sample_a.bootstrap.test; - -import org.apache.zest.api.unitofwork.UnitOfWorkFactory; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.rules.TestName; -import org.apache.zest.api.activation.PassivationException; -import org.apache.zest.api.structure.Application; -import org.apache.zest.api.unitofwork.UnitOfWork; -import org.apache.zest.api.usecase.Usecase; -import org.apache.zest.api.usecase.UsecaseBuilder; -import org.apache.zest.bootstrap.Energy4Java; -import org.apache.zest.sample.dcicargo.sample_a.bootstrap.sampledata.BaseData; -import org.apache.zest.sample.dcicargo.sample_a.infrastructure.dci.Context; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Base class for testing Context Interactions - */ -public class TestApplication extends BaseData -{ - // Logger for sub classes - protected Logger logger = LoggerFactory.getLogger( getClass() ); - - protected static Application app; - - @BeforeClass - public static void setup() throws Exception - { - System.out.println( "\n@@@@@@@@@@@@@@@ TEST @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" ); - app = new Energy4Java().newApplication( new TestAssembler() ); - app.activate(); - - // Separate test suites in console output - System.out.println(); - } - - public TestApplication() - { - super(app.findModule( "BOOTSTRAP", "BOOTSTRAP-Bootstrap" )); - Context.prepareContextBaseClass( module.unitOfWorkFactory() ); - } - - // Printing current test method name to console - @Rule - public TestName name = new TestName(); - - @Before - public void prepareTest() - throws Exception - { - logger.info( name.getMethodName() ); - Usecase usecase = UsecaseBuilder.newUsecase( "Usecase: " + name ); - module.unitOfWorkFactory().newUnitOfWork(usecase); - } - - @After - public void concludeTest() - { - if( module == null ) - { - return; - } - UnitOfWorkFactory uowf = module.unitOfWorkFactory(); - UnitOfWork uow = uowf.currentUnitOfWork(); - if( uow != null && uow.isOpen() ) - uow.discard(); - if( uowf.isUnitOfWorkActive() ) - { - while( uowf.isUnitOfWorkActive() ) - { - uow = uowf.currentUnitOfWork(); - if( uow.isOpen() ) - { - System.err.println( "UnitOfWork not cleaned up:" + uow.usecase().name() ); - uow.discard(); - } - else - { - throw new InternalError( "I have seen a case where a UoW is on the stack, but not opened. First is: " + uow.usecase().name() ); - } - } - new Exception( "UnitOfWork not properly cleaned up" ).printStackTrace(); - } - - } - - @AfterClass - public static void terminateApplication() - throws PassivationException - { - if( app != null ) - { - app.passivate(); - } - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java deleted file mode 100644 index 214fcc4..0000000 --- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/bootstrap/test/TestAssembler.java +++ /dev/null @@ -1,226 +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 org.apache.zest.sample.dcicargo.sample_a.bootstrap.test; - -import java.util.function.Function; -import org.apache.zest.api.structure.Application; -import org.apache.zest.api.structure.Module; -import org.apache.zest.api.value.ValueSerialization; -import org.apache.zest.bootstrap.ApplicationAssembler; -import org.apache.zest.bootstrap.ApplicationAssembly; -import org.apache.zest.bootstrap.ApplicationAssemblyFactory; -import org.apache.zest.bootstrap.AssemblyException; -import org.apache.zest.bootstrap.LayerAssembly; -import org.apache.zest.bootstrap.ModuleAssembly; -import org.apache.zest.entitystore.memory.MemoryEntityStoreService; -import org.apache.zest.index.rdf.RdfIndexingEngineService; -import org.apache.zest.library.rdf.entity.EntityStateSerializer; -import org.apache.zest.library.rdf.entity.EntityTypeSerializer; -import org.apache.zest.library.rdf.repository.MemoryRepositoryService; -import org.apache.zest.sample.dcicargo.pathfinder_a.api.GraphTraversalService; -import org.apache.zest.sample.dcicargo.pathfinder_a.internal.GraphDAO; -import org.apache.zest.sample.dcicargo.pathfinder_a.internal.GraphTraversalServiceImpl; -import org.apache.zest.sample.dcicargo.sample_a.bootstrap.sampledata.BaseDataService; -import org.apache.zest.sample.dcicargo.sample_a.context.rolemap.CargoRoleMap; -import org.apache.zest.sample.dcicargo.sample_a.context.rolemap.CargosRoleMap; -import org.apache.zest.sample.dcicargo.sample_a.context.rolemap.HandlingEventRoleMap; -import org.apache.zest.sample.dcicargo.sample_a.context.rolemap.HandlingEventsRoleMap; -import org.apache.zest.sample.dcicargo.sample_a.context.rolemap.ItineraryRoleMap; -import org.apache.zest.sample.dcicargo.sample_a.context.rolemap.RouteSpecificationRoleMap; -import org.apache.zest.sample.dcicargo.sample_a.context.support.ApplicationEvents; -import org.apache.zest.sample.dcicargo.sample_a.context.support.RegisterHandlingEventAttemptDTO; -import org.apache.zest.sample.dcicargo.sample_a.context.support.RoutingService; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.Delivery; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.ExpectedHandlingEvent; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.itinerary.Leg; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.UnLocode; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.CarrierMovement; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Schedule; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.Voyage; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.voyage.VoyageNumber; -import org.apache.zest.spi.uuid.UuidIdentityGeneratorService; -import org.apache.zest.valueserialization.orgjson.OrgJsonValueSerializationService; - -import static org.apache.zest.api.common.Visibility.application; -import static org.apache.zest.api.structure.Application.Mode.test; - -/** - * Test application assembler - */ -@SuppressWarnings( "unchecked" ) -public class TestAssembler - implements ApplicationAssembler -{ - public ApplicationAssembly assemble( ApplicationAssemblyFactory applicationFactory ) - throws AssemblyException - { - // Application assembly - ApplicationAssembly assembly = applicationFactory.newApplicationAssembly(); - assembly.setName( "DCI Sample (version A) - TEST" ); - assembly.setVersion( "A.1.0" ); - assembly.setMode( test ); - - // Layers - LayerAssembly infrastructureLayer = assembly.layer( "INFRASTRUCTURE" ); - LayerAssembly domainLayer = assembly.layer( "DOMAIN" ); - LayerAssembly contextLayer = assembly.layer( "CONTEXT" ); - LayerAssembly bootstrapLayer = assembly.layer( "BOOTSTRAP" ); - - // Layer dependencies - bootstrapLayer.uses( - contextLayer, - domainLayer, - infrastructureLayer ); - - contextLayer.uses( - domainLayer, - infrastructureLayer ); - - domainLayer.uses( - contextLayer, - infrastructureLayer - ); - - // Assemble - assembleDomainLayer( domainLayer ); - assembleContextLayer( contextLayer ); - assembleBootstrapLayer( bootstrapLayer ); - assembleInfrastructureLayer( infrastructureLayer ); - - return assembly; - } - - private void assembleBootstrapLayer( LayerAssembly bootstrapLayer ) - throws AssemblyException - { - ModuleAssembly bootstrapModule = bootstrapLayer.module( "BOOTSTRAP-Bootstrap" ).withDefaultUnitOfWorkFactory(); - - // Load base data on startup - bootstrapModule - .addServices( - BaseDataService.class ) - .visibleIn( application ) - .instantiateOnStartup(); - } - - private void assembleContextLayer( LayerAssembly contextLayer ) - throws AssemblyException - { - // Role-playing entities - ModuleAssembly entityRoleModule = contextLayer.module( "CONTEXT-EntityRole" ).withDefaultUnitOfWorkFactory(); - entityRoleModule - .entities( - CargoRoleMap.class, - CargosRoleMap.class, - HandlingEventRoleMap.class, - HandlingEventsRoleMap.class ) - .visibleIn( application ); - - // Role-playing values - ModuleAssembly valueRoleModule = contextLayer.module( "CONTEXT-ValueRole" ).withDefaultUnitOfWorkFactory(); - valueRoleModule - .values( - ItineraryRoleMap.class, - RouteSpecificationRoleMap.class ) - .visibleIn( application ); - - ModuleAssembly contextSupportModule = contextLayer.module( "CONTEXT-ContextSupport" ) - .withDefaultUnitOfWorkFactory(); - contextSupportModule - .addServices( - RoutingService.class, - ApplicationEvents.class ) - .visibleIn( application ); - - contextSupportModule - .values( - RegisterHandlingEventAttemptDTO.class ) - .visibleIn( application ); - } - - private void assembleDomainLayer( LayerAssembly domainLayer ) - throws AssemblyException - { - // Non-role-playing entities - ModuleAssembly entityModule = domainLayer.module( "DOMAIN-Entity" ).withDefaultUnitOfWorkFactory(); - entityModule - .entities( - Location.class, - Voyage.class ) - .visibleIn( application ); - - // Non-role-playing values - ModuleAssembly dataModule = domainLayer.module( "DOMAIN-Data" ).withDefaultUnitOfWorkFactory(); - dataModule - .values( - TrackingId.class, - Delivery.class, - ExpectedHandlingEvent.class, - UnLocode.class, - Leg.class, - CarrierMovement.class, - Schedule.class, - VoyageNumber.class ) - .visibleIn( application ); - } - - private void assembleInfrastructureLayer( LayerAssembly infrastructureLayer ) - throws AssemblyException - { - ModuleAssembly serializationModule = infrastructureLayer.module( "INFRASTRUCTURE-Serialization" ) - .withDefaultUnitOfWorkFactory(); - serializationModule - .services( OrgJsonValueSerializationService.class ) - .taggedWith( ValueSerialization.Formats.JSON ) - .setMetaInfo( (Function<Application, Module>) application1 -> application1.findModule( "CONTEXT", "CONTEXT-ContextSupport" ) ) - .visibleIn( application ); - - ModuleAssembly indexingModule = infrastructureLayer.module( "INFRASTRUCTURE-Indexing" ) - .withDefaultUnitOfWorkFactory(); - indexingModule - .objects( - EntityStateSerializer.class, - EntityTypeSerializer.class ); - - indexingModule - .addServices( - MemoryRepositoryService.class, - RdfIndexingEngineService.class ) - .visibleIn( application ); - - ModuleAssembly entityStoreModule = infrastructureLayer.module( "INFRASTRUCTURE-EntityStore" ) - .withDefaultUnitOfWorkFactory(); - entityStoreModule - .addServices( - MemoryEntityStoreService.class, - UuidIdentityGeneratorService.class ) - .visibleIn( application ); - - ModuleAssembly externalServiceModule = infrastructureLayer.module( "INFRASTRUCTURE-ExternalService" ) - .withDefaultUnitOfWorkFactory(); - externalServiceModule - .importedServices( - GraphTraversalService.class ) - .setMetaInfo( new GraphTraversalServiceImpl( new GraphDAO() ) ) - .visibleIn( application ); - } -} http://git-wip-us.apache.org/repos/asf/zest-java/blob/103c59cb/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java ---------------------------------------------------------------------- diff --git a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java b/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java deleted file mode 100644 index 70f4056..0000000 --- a/samples/dci-cargo/dcisample_a/src/test/java/org/apache/zest/sample/dcicargo/sample_a/context/shipping/booking/BookNewCargoTest.java +++ /dev/null @@ -1,240 +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 org.apache.zest.sample.dcicargo.sample_a.context.shipping.booking; - -import java.time.LocalDate; -import java.time.ZoneOffset; -import java.util.List; -import org.apache.zest.api.unitofwork.UnitOfWork; -import org.apache.zest.api.unitofwork.UnitOfWorkFactory; -import org.apache.zest.sample.dcicargo.sample_a.bootstrap.test.TestApplication; -import org.apache.zest.sample.dcicargo.sample_a.context.support.FoundNoRoutesException; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargo; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.Cargos; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.cargo.TrackingId; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.Delivery; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.RoutingStatus; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.delivery.TransportStatus; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.handling.HandlingEventType; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.itinerary.Itinerary; -import org.apache.zest.sample.dcicargo.sample_a.data.shipping.location.Location; -import org.junit.Before; -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - -/** - * Test of Book New Cargo use case. - * - * This is a test suite where all steps and deviations in the use case are tested. - * Some data will carry over from one test to another (all tests run within the same UnitOfWork). - * - * Test method names describe the test purpose. The prefix refers to the step in the use case. - */ -public class BookNewCargoTest - extends TestApplication -{ - - private static final LocalDate TODAY = LocalDate.now(); - private UnitOfWorkFactory uowf; - - @Before - public void prepareTest() - throws Exception - { - super.prepareTest(); - uowf = module.unitOfWorkFactory(); - } - - @Test( expected = RouteException.class ) - public void deviation2a_OriginAndDestinationSame() - throws Exception - { - UnitOfWork uow = uowf.currentUnitOfWork(); - Location HONGKONG = uow.get( Location.class, CNHKG.code().get() ); - Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID ); - new BookNewCargo( CARGOS, HONGKONG, HONGKONG, day( 17 ) ).book(); - } - - @Test( expected = RouteException.class ) - public void deviation_2b_1_DeadlineInThePastNotAccepted() - throws Exception - { - UnitOfWork uow = uowf.currentUnitOfWork(); - Location HONGKONG = uow.get( Location.class, CNHKG.code().get() ); - Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() ); - Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID ); - new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( -1 ) ).book(); - } - - @Test( expected = RouteException.class ) - public void deviation_2b_2_DeadlineTodayIsTooEarly() - throws Exception - { - UnitOfWork uow = uowf.currentUnitOfWork(); - Location HONGKONG = uow.get( Location.class, CNHKG.code().get() ); - Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() ); - Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID ); - new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 0 ) ).book(); - } - - @Test - public void deviation_2b_3_DeadlineTomorrowIsOkay() - throws Exception - { - UnitOfWork uow = uowf.currentUnitOfWork(); - Location HONGKONG = uow.get( Location.class, CNHKG.code().get() ); - Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() ); - Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID ); - new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 1 ) ).book(); - } - - @Test - public void step_2_CreateNewCargo() - throws Exception - { - UnitOfWork uow = uowf.currentUnitOfWork(); - Location HONGKONG = uow.get( Location.class, CNHKG.code().get() ); - Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() ); - Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID ); - // Create cargo with valid input from customer - TrackingId trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 17 ) ).book(); - - // Retrieve created cargo from store - Cargo cargo = uow.get( Cargo.class, trackingId.id().get() ); - - // Test cargo data - assertThat( cargo.trackingId().get(), is( equalTo( trackingId ) ) ); - assertThat( cargo.origin().get(), is( equalTo( HONGKONG ) ) ); - - // Test route specification - assertThat( cargo.routeSpecification().get().destination().get(), is( equalTo( STOCKHOLM ) ) ); - // day(17) here is calculated a few milliseconds after initial day(17), so it will be later... - assertThat( cargo.routeSpecification().get().arrivalDeadline().get(), equalTo( day( 17 ) ) ); - - // (Itinerary is not assigned yet) - - // Test derived delivery snapshot - Delivery delivery = cargo.delivery().get(); - assertThat( delivery.timestamp() - .get() - .isAfter( TODAY.atStartOfDay() - .toInstant( ZoneOffset.UTC ) ), is( equalTo( true ) ) ); // TODAY is set first - assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.NOT_ROUTED ) ) ); - assertThat( delivery.transportStatus().get(), is( equalTo( TransportStatus.NOT_RECEIVED ) ) ); - assertThat( delivery.nextExpectedHandlingEvent() - .get() - .handlingEventType() - .get(), is( equalTo( HandlingEventType.RECEIVE ) ) ); - assertThat( delivery.nextExpectedHandlingEvent().get().location().get(), is( equalTo( HONGKONG ) ) ); - assertThat( delivery.nextExpectedHandlingEvent().get().voyage().get(), is( equalTo( null ) ) ); - assertThat( delivery.lastHandlingEvent().get(), is( equalTo( null ) ) ); - assertThat( delivery.lastKnownLocation().get(), is( equalTo( null ) ) ); - assertThat( delivery.currentVoyage().get(), is( equalTo( null ) ) ); - assertThat( delivery.eta().get(), is( equalTo( null ) ) ); // Is set when itinerary is assigned - assertThat( delivery.isMisdirected().get(), is( equalTo( false ) ) ); - assertThat( delivery.isUnloadedAtDestination().get(), is( equalTo( false ) ) ); - } - - @Test( expected = FoundNoRoutesException.class ) - public void deviation_3a_NoRoutesCanBeThatFast() - throws Exception - { - UnitOfWork uow = uowf.currentUnitOfWork(); - Location HONGKONG = uow.get( Location.class, CNHKG.code().get() ); - Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() ); - Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID ); - TrackingId trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 1 ) ).book(); - Cargo cargo = uow.get( Cargo.class, trackingId.id().get() ); - - // No routes will be found - new BookNewCargo( cargo ).routeCandidates(); - } - - @Test - public void step_3_CalculatePossibleRoutes() - throws Exception - { - UnitOfWork uow = uowf.currentUnitOfWork(); - Location HONGKONG = uow.get( Location.class, CNHKG.code().get() ); - Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() ); - Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID ); - - // Create valid cargo - TrackingId trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, day( 30 ) ).book(); - Cargo cargo = uow.get( Cargo.class, trackingId.id().get() ); - - // Step 3 - Find possible routes - List<Itinerary> routeCandidates = new BookNewCargo( cargo ).routeCandidates(); - - // Check possible routes - for( Itinerary itinerary : routeCandidates ) - { - assertThat( "First load location equals origin location.", - itinerary.firstLeg().loadLocation().get(), - is( equalTo( cargo.routeSpecification().get().origin().get() ) ) ); - assertThat( "Last unload location equals destination location.", - itinerary.lastLeg().unloadLocation().get(), - is( equalTo( cargo.routeSpecification().get().destination().get() ) ) ); - assertThat( "Cargo will be delivered in time.", - itinerary.finalArrivalDate() - .isBefore( cargo.routeSpecification().get().arrivalDeadline().get() ), - is( equalTo( true ) ) ); - } - } - - @Test - public void step_5_AssignCargoToRoute() - throws Exception - { - UnitOfWork uow = uowf.currentUnitOfWork(); - Location HONGKONG = uow.get( Location.class, CNHKG.code().get() ); - Location STOCKHOLM = uow.get( Location.class, SESTO.code().get() ); - Cargos CARGOS = uow.get( Cargos.class, Cargos.CARGOS_ID ); - - // Create valid cargo - LocalDate deadline = day( 30 ); - TrackingId trackingId = new BookNewCargo( CARGOS, HONGKONG, STOCKHOLM, deadline ).book(); - Cargo cargo = uow.get( Cargo.class, trackingId.id().get() ); - - List<Itinerary> routeCandidates = new BookNewCargo( cargo ).routeCandidates(); - - // Get first route found - // Would normally be found with an Itinerary id from customer selection - Itinerary itinerary = routeCandidates.get( 0 ); - - // Use case step 5 - System assigns cargo to route - new BookNewCargo( cargo, itinerary ).assignCargoToRoute(); - - assertThat( "Itinerary has been assigned to cargo.", itinerary, is( equalTo( cargo.itinerary().get() ) ) ); - - // BuildDeliverySnapshot will check if itinerary is valid. No need to check it here. - - // Check values set in new delivery snapshot - Delivery delivery = cargo.delivery().get(); - assertThat( delivery.routingStatus().get(), is( equalTo( RoutingStatus.ROUTED ) ) ); - - // ETA (= Unload time of last Leg) is before Deadline (set in previous test) - assertTrue( delivery.eta().get().isBefore( deadline ) ); - } -}
