001 // Copyright 2004, 2005 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 package org.apache.tapestry.integration.i18n; 015 016 import org.apache.tapestry.integration.JettyRunner; 017 import org.openqa.selenium.server.SeleniumServer; 018 import org.testng.annotations.AfterClass; 019 import org.testng.annotations.BeforeClass; 020 import org.testng.annotations.Test; 021 022 import com.thoughtworks.selenium.DefaultSelenium; 023 import com.thoughtworks.selenium.Selenium; 024 025 026 /** 027 * Tests the i18n test application. 028 * 029 * Initially created to test TAPESTRY-881 feature enhancement. 030 * 031 */ 032 @Test(timeOut = 50000, groups = "integration", sequential=true) 033 public class TestI18nResources 034 { 035 private static final int JETTY_PORT = 9999; 036 private static final String BASE_URL = "http://localhost:9999/"; 037 038 /** 60 seconds */ 039 public static final String PAGE_LOAD_TIMEOUT = "600000"; 040 041 private Selenium _selenium; 042 043 private SeleniumServer _server; 044 045 private JettyRunner _jettyRunner; 046 047 @BeforeClass 048 public void startupBackground() throws Exception 049 { 050 _jettyRunner = new JettyRunner("/", JETTY_PORT, "src/test-data/i18n"); 051 052 _server = new SeleniumServer(); 053 054 _server.start(); 055 056 _selenium = new DefaultSelenium("localhost", SeleniumServer.DEFAULT_PORT, "*firefox", 057 BASE_URL); 058 059 _selenium.start(); 060 } 061 062 @AfterClass 063 public void shutdownBackground() throws Exception 064 { 065 _selenium.stop(); 066 _selenium = null; 067 068 _server.stop(); 069 _server = null; 070 071 _jettyRunner.stop(); 072 _jettyRunner = null; 073 } 074 075 public void test_Key_Exists() 076 throws Exception 077 { 078 _selenium.open(BASE_URL); 079 080 assert _selenium.isTextPresent("Random!"); 081 } 082 083 }