You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2006/06/27 20:21:40 UTC
svn commit: r417545 [1/12] - in /tapestry/tapestry4/trunk: ./
examples/TimeTracker/src/context/ framework/
framework/src/java/org/apache/tapestry/form/validator/
framework/src/java/org/apache/tapestry/json/
framework/src/java/org/apache/tapestry/valid/...
Author: jkuhnert
Date: Tue Jun 27 11:21:31 2006
New Revision: 417545
URL: http://svn.apache.org/viewvc?rev=417545&view=rev
Log:
Little bit of work done to convert unit tests to testng
Added:
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/json/JSONLiteral.java
Modified:
tapestry/tapestry4/trunk/ (props changed)
tapestry/tapestry4/trunk/examples/TimeTracker/src/context/Home.html
tapestry/tapestry4/trunk/framework/pom.xml
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/validator/Email.java
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/json/JSONObject.java
tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstants.java
tapestry/tapestry4/trunk/framework/src/js/tapestry/form.js
tapestry/tapestry4/trunk/framework/src/js/tapestry/form/validation.js
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/BaseComponentTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TapestryUtilsTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestAbstractComponent.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestBaseSessionStoreOptimized.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestComponentMessageAccess.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/ContextAssetFactoryTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestAssetSource.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestDefaultAssetFactory.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestExternalResource.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestResourceDigestSource.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestUnprotectedAsset.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/bean/TestBeanProvider.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/bean/TestLightweightBeanInitializer.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/binding/BindingTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/binding/StateBindingTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/binding/TestAssetBinding.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/binding/TestBeanBinding.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/binding/TestComponentBinding.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/binding/TestExpressionBinding.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/binding/TestHiveMindBinding.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/binding/TestListenerMethodBinding.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/binding/TestLiteralBinding.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/binding/TestMessageBinding.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/callback/TestDirectCallback.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/callback/TestExternalCallback.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/callback/TestPageCallback.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/coerce/TestTypeConverterWrapper.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/coerce/TestValueConverter.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/components/TestAny.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/components/TestBlock.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/components/TestConditional.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/components/TestIfElse.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/components/TestInsert.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/components/TestInvokeListener.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/components/TestRenderBlock.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/describe/BaseDescribeTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/describe/CookieStrategyTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/describe/HTMLDescriptionReceiverTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/describe/ObjectArrayRenderStrategyTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/describe/PreformattedRenderableStrategyTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/describe/ReportStatusHubTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/describe/TestLocationRenderStrategy.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/describe/TestRenderStrategy.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/dojo/form/TestAutocompleter.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/ActionServiceTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/DirectEventServiceTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/DirectServiceTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/EngineServiceLinkTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/EngineUtilsTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/ExternalServiceTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/PageServiceTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/RequestCycleTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/ResetServiceTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/RestartServiceTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/ServiceTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/encoders/AssetEncoderTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/encoders/TestDirectServiceEncoder.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/encoders/TestPageServiceEncoder.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/encoders/TestServiceExtensionEncoder.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/state/TestApplicationStateManager.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/state/TestSOMRegistry.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/engine/state/TestSessionScopeManager.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/BaseEnhancementTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/EnhancedClassValidatorTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/InjectAssetWorkerTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/InjectStateFlagWorkerTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestAbstractPropertyWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestAutowireWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestDeferredScript.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestDispatchToInjectWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestEnhanceUtils.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestEnhancementOperation.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestInjectBeanWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestInjectComponentWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestInjectEventInvokerWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestInjectListenerRegistrationWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestInjectMessagesWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestInjectMetaWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestInjectObjectWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestInjectPageWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestInjectScriptWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestInjectSpecificationWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestInjectStateWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestParameterPropertyWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/enhance/TestSpecifiedPropertyWorker.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/error/BaseErrorTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/error/StaleSessionExceptionPresenterTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/error/TestExceptionPresenter.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/event/ReportStatusEventTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/AbstractFormComponentTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/BaseFormComponentTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/FormComponentContributorTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/FormSupportTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/FormTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/LinkSubmitTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/TestButton.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/TestCheckbox.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/TestFormComponentContributorContext.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/TestImageSubmit.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/TestListEditMap.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/TestSubmit.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/TestTextArea.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/TestTextField.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/TestTranslatedFieldSupportImpl.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/TestValidatableFieldSupportImpl.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/TestValidationMessages.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/translator/TestDateTranslator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/translator/TestNumberTranslator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/translator/TestStringTranslator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/translator/TestTranslatorBinding.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/translator/TranslatorTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/BaseValidatorTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/TestEmail.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/TestMax.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/TestMaxDate.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/TestMaxLength.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/TestMin.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/TestMinDate.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/TestMinLength.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/TestPattern.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/TestRequired.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/TestValidatorFactory.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/TestValidatorWrapper.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/form/validator/TestValidatorsBinding.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/html/BodyTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/html/DescribeTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/html/FrameTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/html/ScriptTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/html/TestImage.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/html/TestInsertText.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/html/TestPageEvents.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/html/TestShell.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/ContentTypeTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/TapestryTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/TestComponent.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/TestComponentMessages.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/TestLocalizedProperties.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/TestMultipart.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/TestStaticLink.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/TestTapestryCheckMethodInvocation.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/TestTapestryGetClassName.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/mock/TestMocks.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/parse/TestSpecificationParser.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/script/TestScript.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/spec/TestApplicationSpecification.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/spec/TestComponentSpecification.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/utils/TestIdAllocator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/junit/utils/TestRegexpMatcher.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/l10n/DefaultResourceLocalizerTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/link/DefaultLinkRendererTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/listener/TestListenerMap.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/listener/TestListenerMapSource.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/markup/TestMarkupWriter.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/multipart/TestMultipartDecoderFilter.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/multipart/TestUploadFormParametersWrapper.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/pageload/PageLoaderTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/pageload/TestNamespaceClassSearchComponentClassProvider.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/pageload/TestVerifyRequiredParametersVisitor.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/record/ClientPropertyPersistenceStrategyTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/record/PageClientPropertyPersistenceScopeTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/record/PropertyPersistenceStrategySourceTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/record/SessionPropertyPersistenceStrategyTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/record/TestPageRecorder.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/record/TestPersistentPropertyData.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/request/TestDecodedRequestInjector.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/request/TestDecodedRequestWrapper.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/AbstractSpecificationResolverTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/PageSpecificationResolverTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/resolver/TestComponentSpecificationResolver.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/script/TestForeachToken.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/script/TestIfToken.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/AbstractEngineServiceProxyTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/ComponentEventConnectionWorkerTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/ComponentEventInvokerTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/CookieSourceTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/DefaultResponseBuilderTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/DojoAjaxResponseBuilderTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/EngineFactoryTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/EngineServiceInnerProxyTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/EngineServiceOuterProxyTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/LinkFactoryTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestAbsoluteURLBuilder.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestApplicationSpecificationInitializer.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestBaseTagWriter.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestBasicInfrastructure.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestBindingSource.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestDeferredObjectTranslator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestDisableCachingFilter.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestEngineManager.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestEngineServiceObjectProvider.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestExpressionEvaluator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestExtensionLookupFactory.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestInfrastructure.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestLocalizedPropertySource.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestNamespaceResources.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestRequestLocaleManager.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestServiceMap.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/TestSetupRequestEncoding.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/services/impl/WebContextInitializerTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/test/TestCreator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/test/mock/MockResponse.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/util/TestDescribedLocation.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/util/TestPageRenderSupport.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/BaseValidatorTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/FieldLabelTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestDateValidator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestEmailValidator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestIntValidator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestNumberValidator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestPatternValidator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestStringValidator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestUrlValidator.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestValidField.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/TestValidatorBindingFactory.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/valid/ValidationDelegateTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/web/BaseWebTestCase.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/web/ServletWebResponseTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/web/ServletWebSessionTest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/web/TestServletWebContext.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/web/TestServletWebRequest.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/web/TestWebUtils.java
tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/web/WebContextResourceTest.java
tapestry/tapestry4/trunk/pom.xml
Propchange: tapestry/tapestry4/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jun 27 11:21:31 2006
@@ -1,3 +1,4 @@
+
bin
private
dist
@@ -11,3 +12,5 @@
ext-package
cachedir
.clover
+TestNG context suite.launch
+tapestry_org.apache.tapestry.*.xml
Modified: tapestry/tapestry4/trunk/examples/TimeTracker/src/context/Home.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/examples/TimeTracker/src/context/Home.html?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/examples/TimeTracker/src/context/Home.html (original)
+++ tapestry/tapestry4/trunk/examples/TimeTracker/src/context/Home.html Tue Jun 27 11:21:31 2006
@@ -46,7 +46,6 @@
<input jwcid="@Submit" value="message:button.add" class="submitButton" action="listener:addTask" />
</td>
</tr>
-
</table>
</fieldset>
</form>
Modified: tapestry/tapestry4/trunk/framework/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/pom.xml?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/pom.xml (original)
+++ tapestry/tapestry4/trunk/framework/pom.xml Tue Jun 27 11:21:31 2006
@@ -92,6 +92,17 @@
<version>1.2.9</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>4.7</version>
+ <classifier>jdk15</classifier>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.javaforge.tapestry</groupId>
+ <artifactId>tapestry-testng</artifactId>
+ </dependency>
</dependencies>
<build>
@@ -228,7 +239,9 @@
<link>http://jakarta.apache.org/commons/logging/apidocs/</link>
<link>http://www.ognl.org/2.6.9/Documentation/javadoc/</link>
</links>
- <stylesheetfile>${basedir}/../src/site/resources/css/jdstyle.css</stylesheetfile>
+ <stylesheetfile>
+ ${basedir}/../src/site/resources/css/jdstyle.css
+ </stylesheetfile>
</configuration>
</plugin>
<plugin>
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/validator/Email.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/validator/Email.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/validator/Email.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/form/validator/Email.java Tue Jun 27 11:21:31 2006
@@ -16,11 +16,13 @@
import org.apache.tapestry.IMarkupWriter;
import org.apache.tapestry.IRequestCycle;
-import org.apache.tapestry.TapestryUtils;
import org.apache.tapestry.form.FormComponentContributorContext;
import org.apache.tapestry.form.IFormComponent;
import org.apache.tapestry.form.ValidationMessages;
+import org.apache.tapestry.json.JSONLiteral;
+import org.apache.tapestry.json.JSONObject;
import org.apache.tapestry.util.RegexpMatcher;
+import org.apache.tapestry.valid.ValidationConstants;
import org.apache.tapestry.valid.ValidationConstraint;
import org.apache.tapestry.valid.ValidationStrings;
import org.apache.tapestry.valid.ValidatorException;
@@ -68,23 +70,21 @@
new Object[]
{ field.getDisplayName() });
}
-
+
public void renderContribution(IMarkupWriter writer, IRequestCycle cycle,
FormComponentContributorContext context, IFormComponent field)
{
- context.includeClasspathScript("/org/apache/tapestry/form/validator/RegExValidator.js");
-
- String pattern = _matcher.getEscapedPatternString(PATTERN);
- String message = TapestryUtils.enquote(buildMessage(context, field));
-
- StringBuffer buffer = new StringBuffer("function(event) { Tapestry.validate_regex(event, '");
- buffer.append(field.getClientId());
- buffer.append("', '");
- buffer.append(pattern);
- buffer.append("', ");
- buffer.append(message);
- buffer.append("); }");
-
- context.addSubmitHandler(buffer.toString());
+
+ JSONObject profile = context.getProfile();
+
+ if (!profile.has(ValidationConstants.CONSTRAINTS)) {
+ profile.put(ValidationConstants.CONSTRAINTS, new JSONObject());
+ }
+ JSONObject cons = profile.getJSONObject(ValidationConstants.CONSTRAINTS);
+
+ cons.put(field.getClientId(), new JSONLiteral("[dojo.validate.isEmailAddress,false,true]"));
+
+ setProfileProperty(field, profile,
+ ValidationConstants.CONSTRAINTS, buildMessage(context, field));
}
}
Added: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/json/JSONLiteral.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/json/JSONLiteral.java?rev=417545&view=auto
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/json/JSONLiteral.java (added)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/json/JSONLiteral.java Tue Jun 27 11:21:31 2006
@@ -0,0 +1,37 @@
+// Copyright Jun 25, 2006 The Apache Software Foundation
+//
+// Licensed 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.tapestry.json;
+
+
+/**
+ * Represents a JSON literal string, useful for scenerios where you
+ * want to store a key/value pair but don't want the value to be quoted.
+ *
+ * @author jkuhnert
+ */
+public class JSONLiteral
+{
+
+ private String _value;
+
+ public JSONLiteral(String value)
+ {
+ _value = value;
+ }
+
+ public String toString()
+ {
+ return _value;
+ }
+}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/json/JSONObject.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/json/JSONObject.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/json/JSONObject.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/json/JSONObject.java Tue Jun 27 11:21:31 2006
@@ -844,7 +844,8 @@
if (value == null || value.equals(null)) { return "null"; }
if (value instanceof Number) { return numberToString((Number) value); }
if (value instanceof Boolean || value instanceof JSONObject
- || value instanceof JSONArray) { return value.toString(); }
+ || value instanceof JSONArray
+ || value instanceof JSONLiteral) { return value.toString(); }
return quote(value.toString());
}
Modified: tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstants.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstants.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstants.java (original)
+++ tapestry/tapestry4/trunk/framework/src/java/org/apache/tapestry/valid/ValidationConstants.java Tue Jun 27 11:21:31 2006
@@ -33,4 +33,6 @@
public static final String REQUIRED = "required";
public static final String REQUIRED_MESSAGE = "required-message";
+
+ public static final String CONSTRAINTS = "constraints";
}
Modified: tapestry/tapestry4/trunk/framework/src/js/tapestry/form.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/tapestry/form.js?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/tapestry/form.js (original)
+++ tapestry/tapestry4/trunk/framework/src/js/tapestry/form.js Tue Jun 27 11:21:31 2006
@@ -2,6 +2,7 @@
dojo.require("dojo.event");
dojo.require("dojo.event.browser");
+dojo.require("dojo.validate.web");
dojo.require("tapestry.core");
@@ -148,7 +149,7 @@
return;
}
- this.forms[id].profiles.push(profile);
+ this.forms[id].profiles.push(eval(profile));
},
/**
Modified: tapestry/tapestry4/trunk/framework/src/js/tapestry/form/validation.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/js/tapestry/form/validation.js?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/js/tapestry/form/validation.js (original)
+++ tapestry/tapestry4/trunk/framework/src/js/tapestry/form/validation.js Tue Jun 27 11:21:31 2006
@@ -87,6 +87,15 @@
formValid=false;
}
+ if (results.hasInvalid()) {
+ var invalid=results.getInvalid();
+ for (var i=0; i < invalid.length; i++) {
+ this.handleInvalidField(invalid[i], profile);
+ }
+
+ formValid=false;
+ }
+
return formValid; // if got past successful everything is invalid
},
@@ -97,16 +106,6 @@
* @param profile The form validation profile.
*/
handleMissingField:function(field, profile){
- // if it's a widget form control try to point the field
- // to the widget controlled field
- /* var w=dojo.widget.byId(field);
- if (w) {
- if (w["textInputNode"]){
- field=w.textInputNode;
- }
- }
- */
-
dojo.html.removeClass(field, this.invalidClass);
if (!dojo.html.hasClass(field, this.missingClass)){
@@ -162,8 +161,8 @@
if (results.hasInvalid()){
var fields=results.getInvalid();
for (var i=0; i<fields.length; i++){
- if (profile[fields[i]] && profile[fields[i]]["required"]){
- ierrs.push(profile[fields[i]]["required"]);
+ if (profile[fields[i]] && profile[fields[i]]["constraints"]){
+ ierrs.push(profile[fields[i]]["constraints"]);
}
}
}
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/BaseComponentTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/BaseComponentTestCase.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/BaseComponentTestCase.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/BaseComponentTestCase.java Tue Jun 27 11:21:31 2006
@@ -14,17 +14,31 @@
package org.apache.tapestry;
-import static org.easymock.EasyMock.*;
+import static org.easymock.EasyMock.anyObject;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
import java.io.CharArrayWriter;
import java.io.PrintWriter;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
import org.apache.commons.logging.Log;
import org.apache.hivemind.ClassResolver;
import org.apache.hivemind.Locatable;
import org.apache.hivemind.Location;
+import org.apache.hivemind.ModuleDescriptorProvider;
+import org.apache.hivemind.Registry;
import org.apache.hivemind.Resource;
+import org.apache.hivemind.impl.DefaultClassResolver;
+import org.apache.hivemind.impl.RegistryBuilder;
+import org.apache.hivemind.impl.XmlModuleDescriptorProvider;
import org.apache.hivemind.test.HiveMindTestCase;
+import org.apache.hivemind.util.URLResource;
import org.apache.tapestry.components.ILinkComponent;
import org.apache.tapestry.engine.IEngineService;
import org.apache.tapestry.engine.ILink;
@@ -40,7 +54,9 @@
import org.apache.tapestry.spec.IParameterSpecification;
import org.apache.tapestry.test.Creator;
import org.apache.tapestry.web.WebRequest;
-import org.easymock.MockControl;
+import org.testng.annotations.Test;
+
+import com.javaforge.tapestry.testng.TestBase;
/**
* Base class for testing components, or testing classes that operate on components. Simplifies
@@ -51,7 +67,8 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public abstract class BaseComponentTestCase extends HiveMindTestCase
+@Test
+public abstract class BaseComponentTestCase extends TestBase
{
private Creator _creator;
@@ -59,10 +76,15 @@
{
if (_creator == null)
_creator = new Creator();
-
+
return _creator;
}
+ protected ClassResolver getClassResolver()
+ {
+ return new DefaultClassResolver();
+ }
+
protected CharArrayWriter _charArrayWriter;
protected IMarkupWriter newBufferWriter()
@@ -90,6 +112,11 @@
_charArrayWriter.reset();
}
+ protected void assertExceptionSubstring(Throwable t, String msg)
+ {
+ assertTrue(t.getMessage().contains(msg));
+ }
+
protected Object newInstance(Class componentClass)
{
return newInstance(componentClass, null);
@@ -101,19 +128,14 @@
{ propertyName, propertyValue });
}
- protected Object newInstance(Class componentClass, Object[] properties)
- {
- return getCreator().newInstance(componentClass, properties);
- }
-
protected IRequestCycle newCycle()
{
- return (IRequestCycle)newMock(IRequestCycle.class);
+ return newMock(IRequestCycle.class);
}
protected IRequestCycle newCycle(IMarkupWriter writer)
{
- IRequestCycle cycle = (IRequestCycle) newMock(IRequestCycle.class);
+ IRequestCycle cycle = newMock(IRequestCycle.class);
trainResponseBuilder(cycle, writer);
@@ -127,9 +149,8 @@
protected IRequestCycle newCycle(boolean rewinding, boolean trainWriter)
{
- MockControl control = newControl(IRequestCycle.class);
- IRequestCycle cycle = (IRequestCycle) control.getMock();
-
+ IRequestCycle cycle = newRequestCycle();
+
trainIsRewinding(cycle, rewinding);
if (trainWriter)
@@ -140,8 +161,7 @@
protected IRequestCycle newCycle(boolean rewinding, IMarkupWriter writer)
{
- MockControl control = newControl(IRequestCycle.class);
- IRequestCycle cycle = (IRequestCycle) control.getMock();
+ IRequestCycle cycle = newRequestCycle();
trainIsRewinding(cycle, rewinding);
@@ -165,8 +185,7 @@
protected IRequestCycle newCycleGetPage(String pageName, IPage page)
{
- MockControl control = newControl(IRequestCycle.class);
- IRequestCycle cycle = (IRequestCycle) control.getMock();
+ IRequestCycle cycle = newRequestCycle();
expect(cycle.getPage(pageName)).andReturn(page);
@@ -175,8 +194,7 @@
protected IRequestCycle newCycleGetUniqueId(String id, String uniqueId)
{
- MockControl control = newControl(IRequestCycle.class);
- IRequestCycle cycle = (IRequestCycle) control.getMock();
+ IRequestCycle cycle = newRequestCycle();
expect(cycle.getUniqueId(id)).andReturn(uniqueId);
return cycle;
@@ -184,8 +202,7 @@
protected IRequestCycle newCycleGetParameter(String name, String value)
{
- MockControl control = newControl(IRequestCycle.class);
- IRequestCycle cycle = (IRequestCycle) control.getMock();
+ IRequestCycle cycle = newRequestCycle();
expect(cycle.getParameter(name)).andReturn(value);
return cycle;
@@ -193,13 +210,12 @@
protected IMarkupWriter newWriter()
{
- return (IMarkupWriter) newMock(IMarkupWriter.class);
+ return newMock(IMarkupWriter.class);
}
protected IBinding newBinding(Object value)
{
- MockControl control = newControl(IBinding.class);
- IBinding binding = (IBinding) control.getMock();
+ IBinding binding = newMock(IBinding.class);
expect(binding.getObject()).andReturn(value);
return binding;
@@ -216,8 +232,7 @@
protected IComponent newComponent(String extendedId, Location location)
{
- MockControl control = newControl(IComponent.class);
- IComponent component = (IComponent) control.getMock();
+ IComponent component = newMock(IComponent.class);
expect(component.getExtendedId()).andReturn(extendedId);
expect(component.getLocation()).andReturn(location);
@@ -226,8 +241,7 @@
protected IComponentSpecification newSpec(String parameterName, IParameterSpecification pspec)
{
- MockControl control = newControl(IComponentSpecification.class);
- IComponentSpecification spec = (IComponentSpecification) control.getMock();
+ IComponentSpecification spec = newMock(IComponentSpecification.class);
expect(spec.getParameter(parameterName)).andReturn(pspec);
return spec;
@@ -235,12 +249,12 @@
protected IRender newRender()
{
- return (IRender) newMock(IRender.class);
+ return newMock(IRender.class);
}
protected IPage newPage()
{
- return (IPage) newMock(IPage.class);
+ return newMock(IPage.class);
}
protected IPage newPage(String name)
@@ -250,7 +264,7 @@
protected IPage newPage(String name, int count)
{
- IPage page = (IPage)newMock(IPage.class);
+ IPage page = newMock(IPage.class);
expect(page.getPageName()).andReturn(name).times(count);
@@ -259,7 +273,7 @@
protected IForm newForm()
{
- return (IForm) newMock(IForm.class);
+ return newMock(IForm.class);
}
protected IRender newBody()
@@ -275,7 +289,7 @@
protected PageRenderSupport newPageRenderSupport()
{
- return (PageRenderSupport) newMock(PageRenderSupport.class);
+ return newMock(PageRenderSupport.class);
}
protected void trainGetSupport(IRequestCycle cycle, PageRenderSupport support)
@@ -315,12 +329,12 @@
protected IAsset newAsset()
{
- return (IAsset) newMock(IAsset.class);
+ return newMock(IAsset.class);
}
protected IEngine newEngine(ClassResolver resolver)
{
- IEngine engine = (IEngine) newMock(IEngine.class);
+ IEngine engine = newMock(IEngine.class);
return engine;
}
@@ -332,7 +346,7 @@
protected IComponent newComponent()
{
- return (IComponent) newMock(IComponent.class);
+ return newMock(IComponent.class);
}
protected void trainGetPage(IComponent component, IPage page)
@@ -352,7 +366,7 @@
protected IBinding newBinding()
{
- return (IBinding) newMock(IBinding.class);
+ return newMock(IBinding.class);
}
protected void trainGetComponent(IComponent container, String componentId, IComponent containee)
@@ -362,7 +376,7 @@
protected IEngineService newEngineService()
{
- return (IEngineService) newMock(IEngineService.class);
+ return newMock(IEngineService.class);
}
protected void trainGetLink(IEngineService service, IRequestCycle cycle, boolean post,
@@ -389,19 +403,32 @@
protected IComponentSpecification newSpec()
{
- return (IComponentSpecification) newMock(IComponentSpecification.class);
+ return newMock(IComponentSpecification.class);
}
protected Resource newResource()
{
- return (Resource) newMock(Resource.class);
+ return newMock(Resource.class);
}
protected WebRequest newRequest()
{
- return (WebRequest) newMock(WebRequest.class);
+ return newMock(WebRequest.class);
}
+ protected Location newLocation()
+ {
+ return newMock(Location.class);
+ }
+
+ protected Location fabricateLocation(int line)
+ {
+ Location location = newLocation();
+ expect(location.getLineNumber()).andReturn(line).anyTimes();
+
+ return location;
+ }
+
protected void trainEncodeURL(IRequestCycle rc, String URL, String encodedURL)
{
expect(rc.encodeURL(URL)).andReturn(encodedURL);
@@ -424,7 +451,7 @@
protected NestedMarkupWriter newNestedWriter()
{
- return (NestedMarkupWriter) newMock(NestedMarkupWriter.class);
+ return newMock(NestedMarkupWriter.class);
}
protected void trainGetNestedWriter(IMarkupWriter writer, NestedMarkupWriter nested)
@@ -444,7 +471,7 @@
protected ILink newLink()
{
- return (ILink) newMock(ILink.class);
+ return newMock(ILink.class);
}
protected void trainGetLink(ILinkComponent component, IRequestCycle cycle, ILink link)
@@ -479,7 +506,7 @@
protected Log newLog()
{
- return (Log) newMock(Log.class);
+ return newMock(Log.class);
}
protected void trainGetId(IComponent component, String id)
@@ -489,24 +516,92 @@
protected void trainExtractBrowserEvent(IRequestCycle cycle)
{
- expect(cycle.getParameter(BrowserEvent.NAME)).andReturn("onClick");
+ expect(cycle.getParameter(BrowserEvent.NAME)).andReturn("onClick").anyTimes();
- cycle.getParameter(BrowserEvent.TYPE);
- setReturnValue(cycle, "click");
- cycle.getParameters(BrowserEvent.KEYS);
- setReturnValue(cycle, null);
- cycle.getParameter(BrowserEvent.CHAR_CODE);
- setReturnValue(cycle, null);
- cycle.getParameter(BrowserEvent.PAGE_X);
- setReturnValue(cycle, "123");
- cycle.getParameter(BrowserEvent.PAGE_Y);
- setReturnValue(cycle, "1243");
- cycle.getParameter(BrowserEvent.LAYER_X);
- setReturnValue(cycle, null);
- cycle.getParameter(BrowserEvent.LAYER_Y);
- setReturnValue(cycle, null);
+ expect(cycle.getParameter(BrowserEvent.TYPE)).andReturn("click");
+ expect(cycle.getParameters(BrowserEvent.KEYS)).andReturn(null);
+ expect(cycle.getParameter(BrowserEvent.CHAR_CODE)).andReturn(null);
+ expect(cycle.getParameter(BrowserEvent.PAGE_X)).andReturn("123");
+ expect(cycle.getParameter(BrowserEvent.PAGE_Y)).andReturn("1243");
+ expect(cycle.getParameter(BrowserEvent.LAYER_X)).andReturn(null);
+ expect(cycle.getParameter(BrowserEvent.LAYER_Y)).andReturn(null);
- cycle.getParameter(BrowserEvent.TARGET + "." + BrowserEvent.TARGET_ATTR_ID);
- setReturnValue(cycle, "element1");
+ expect(cycle.getParameter(BrowserEvent.TARGET + "." + BrowserEvent.TARGET_ATTR_ID))
+ .andReturn("element1");
+ }
+
+ /**
+ * Convienience method for invoking {@link #buildFrameworkRegistry(String[])} with only a single
+ * file.
+ */
+ protected Registry buildFrameworkRegistry(String file) throws Exception
+ {
+ return buildFrameworkRegistry(new String[]
+ { file });
+ }
+
+ /**
+ * Builds a minimal registry, containing only the specified files, plus the master module
+ * descriptor (i.e., those visible on the classpath). Files are resolved using
+ * {@link HiveMindTestCase#getResource(String)}.
+ */
+ protected Registry buildFrameworkRegistry(String[] files) throws Exception
+ {
+ ClassResolver resolver = getClassResolver();
+
+ List descriptorResources = new ArrayList();
+ for (int i = 0; i < files.length; i++)
+ {
+ Resource resource = getResource(files[i]);
+
+ descriptorResources.add(resource);
+ }
+
+ ModuleDescriptorProvider provider = new XmlModuleDescriptorProvider(resolver,
+ descriptorResources);
+
+ return buildFrameworkRegistry(provider);
+ }
+
+ /**
+ * Builds a registry, containing only the modules delivered by the specified
+ * {@link org.apache.hivemind.ModuleDescriptorProvider}, plus the master module descriptor
+ * (i.e., those visible on the classpath).
+ */
+ protected Registry buildFrameworkRegistry(ModuleDescriptorProvider customProvider)
+ {
+ ClassResolver resolver = getClassResolver();
+
+ RegistryBuilder builder = new RegistryBuilder();
+
+ builder.addModuleDescriptorProvider(new XmlModuleDescriptorProvider(resolver));
+ builder.addModuleDescriptorProvider(customProvider);
+
+ return builder.constructRegistry(Locale.getDefault());
+ }
+
+ /**
+ * Builds a registry from exactly the provided resource; this registry will not include the
+ * <code>hivemind</code> module.
+ */
+ protected Registry buildMinimalRegistry(Resource l) throws Exception
+ {
+ RegistryBuilder builder = new RegistryBuilder();
+
+ return builder.constructRegistry(Locale.getDefault());
+ }
+
+ /**
+ * Returns the given file as a {@link Resource} from the classpath. Typically, this is to find
+ * files in the same folder as the invoking class.
+ */
+ protected Resource getResource(String file)
+ {
+ URL url = getClass().getResource(file);
+
+ if (url == null)
+ throw new NullPointerException("No resource named '" + file + "'.");
+
+ return new URLResource(url);
}
}
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TapestryUtilsTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TapestryUtilsTest.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TapestryUtilsTest.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TapestryUtilsTest.java Tue Jun 27 11:21:31 2006
@@ -14,9 +14,13 @@
package org.apache.tapestry;
+import static org.easymock.EasyMock.expect;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertSame;
+
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Location;
-import org.easymock.MockControl;
+import org.testng.annotations.Test;
/**
* Tests for {@link org.apache.tapestry.TapestryUtils}.
@@ -24,12 +28,13 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
+@Test
public class TapestryUtilsTest extends BaseComponentTestCase
{
private IRequestCycle newCycle(String key, Object attribute)
{
- IRequestCycle cycle = (IRequestCycle)newMock(IRequestCycle.class);
+ IRequestCycle cycle = newMock(IRequestCycle.class);
trainGetAttribute(cycle, key, attribute);
@@ -39,22 +44,19 @@
public void testStoreUniqueAttributeSuccess()
{
Object newInstance = new Object();
-
- MockControl control = newControl(IRequestCycle.class);
- IRequestCycle cycle = (IRequestCycle) control.getMock();
+ IRequestCycle cycle = newCycle();
String key = "foo.bar.Baz";
- cycle.getAttribute(key);
- control.setReturnValue(null);
+ expect(cycle.getAttribute(key)).andReturn(null);
cycle.setAttribute(key, newInstance);
- replayControls();
+ replay();
TapestryUtils.storeUniqueAttribute(cycle, key, newInstance);
- verifyControls();
+ verify();
}
public void testStoreUniqueAttributeFailure()
@@ -66,7 +68,7 @@
IRequestCycle cycle = newCycle(key, existing);
- replayControls();
+ replay();
try
{
@@ -79,7 +81,7 @@
.getMessage());
}
- verifyControls();
+ verify();
}
public void testGetPageRenderSupportSuccess()
@@ -88,39 +90,39 @@
PageRenderSupport support = newPageRenderSupport();
IRequestCycle cycle = newCycle(TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE, support);
- replayControls();
+ replay();
PageRenderSupport actual = TapestryUtils.getPageRenderSupport(cycle, component);
assertSame(support, actual);
- verifyControls();
+ verify();
}
public void testRemovePageRenderSupport()
{
- IRequestCycle cycle = (IRequestCycle)newMock(IRequestCycle.class);
+ IRequestCycle cycle = newMock(IRequestCycle.class);
cycle.removeAttribute(TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE);
- replayControls();
+ replay();
TapestryUtils.removePageRenderSupport(cycle);
- verifyControls();
+ verify();
}
public void testRemoveForm()
{
- IRequestCycle cycle = (IRequestCycle)newMock(IRequestCycle.class);
+ IRequestCycle cycle = newMock(IRequestCycle.class);
cycle.removeAttribute(TapestryUtils.FORM_ATTRIBUTE);
- replayControls();
+ replay();
TapestryUtils.removeForm(cycle);
- verifyControls();
+ verify();
}
public void testGetFormSuccess()
@@ -129,33 +131,27 @@
IForm form = newForm();
IRequestCycle cycle = newCycle(TapestryUtils.FORM_ATTRIBUTE, form);
- replayControls();
+ replay();
IForm actual = TapestryUtils.getForm(cycle, component);
assertSame(form, actual);
- verifyControls();
+ verify();
}
public void testGetPageRenderSupportFailure()
{
Location l = newLocation();
- MockControl control = newControl(IComponent.class);
- IComponent component = (IComponent) control.getMock();
-
- component.getExtendedId();
- control.setReturnValue("Foo/bar", 1);
+ IComponent component = newMock(IComponent.class);
- component.getLocation();
- control.setReturnValue(l);
-
- component.getExtendedId();
- control.setReturnValue("Foo/bar", 1);
+ expect(component.getExtendedId()).andReturn("Foo/bar").anyTimes();
+
+ expect(component.getLocation()).andReturn(l);
IRequestCycle cycle = newCycle(TapestryUtils.PAGE_RENDER_SUPPORT_ATTRIBUTE, null);
- replayControls();
+ replay();
try
{
@@ -168,27 +164,21 @@
assertSame(l, ex.getLocation());
}
- verifyControls();
+ verify();
}
public void testGetFormFailure()
{
Location l = newLocation();
- MockControl control = newControl(IComponent.class);
- IComponent component = (IComponent) control.getMock();
-
- component.getExtendedId();
- control.setReturnValue("Foo/bar", 1);
-
- component.getLocation();
- control.setReturnValue(l);
+ IComponent component = newMock(IComponent.class);
- component.getExtendedId();
- control.setReturnValue("Foo/bar", 1);
+ expect(component.getExtendedId()).andReturn("Foo/bar").anyTimes();
+
+ expect(component.getLocation()).andReturn(l);
IRequestCycle cycle = newCycle(TapestryUtils.FORM_ATTRIBUTE, null);
- replayControls();
+ replay();
try
{
@@ -201,42 +191,42 @@
assertSame(l, ex.getLocation());
}
- verifyControls();
+ verify();
}
public void testSplitBlank()
{
- assertListsEqual(new String[0], TapestryUtils.split(null));
- assertListsEqual(new String[0], TapestryUtils.split(""));
+ assertEquals(new String[0], TapestryUtils.split(null));
+ assertEquals(new String[0], TapestryUtils.split(""));
}
public void testSplitWithDelimiter()
{
- assertListsEqual(new String[]
+ assertEquals(new String[]
{ "fred", "barney" }, TapestryUtils.split("fred|barney", '|'));
}
public void testSplitNormal()
{
- assertListsEqual(new String[]
+ assertEquals(new String[]
{ "fred", "barney" }, TapestryUtils.split("fred,barney"));
}
public void testSplitNoDelimiter()
{
- assertListsEqual(new String[]
+ assertEquals(new String[]
{ "no-delimiter" }, TapestryUtils.split("no-delimiter"));
}
public void testTrailingDelimiter()
{
- assertListsEqual(new String[]
+ assertEquals(new String[]
{ "fred", "barney", "" }, TapestryUtils.split("fred,barney,"));
}
public void testEveryDelimiterCounts()
{
- assertListsEqual(new String[]
+ assertEquals(new String[]
{ "", "fred", "", "barney", "", "" }, TapestryUtils.split(",fred,,barney,,"));
}
@@ -276,11 +266,11 @@
trainGetComponent(container, "fred", containee);
- replayControls();
+ replay();
assertSame(containee, TapestryUtils.getComponent(container, "fred", IComponent.class, null));
- verifyControls();
+ verify();
}
public void testGetComponentWrongType()
@@ -292,7 +282,7 @@
trainGetComponent(container, "fred", containee);
trainGetExtendedId(containee, "Flintstone/fred");
- replayControls();
+ replay();
try
{
@@ -307,7 +297,7 @@
assertSame(l, ex.getLocation());
}
- verifyControls();
+ verify();
}
@@ -318,10 +308,9 @@
Throwable t = new RuntimeException("Poof!");
- container.getComponent("fred");
- setThrowable(container, t);
+ expect(container.getComponent("fred")).andThrow(t);
- replayControls();
+ replay();
try
{
@@ -335,6 +324,6 @@
assertSame(t, ex.getRootCause());
}
- verifyControls();
+ verify();
}
}
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestAbstractComponent.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestAbstractComponent.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestAbstractComponent.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestAbstractComponent.java Tue Jun 27 11:21:31 2006
@@ -14,10 +14,13 @@
package org.apache.tapestry;
-import static org.easymock.EasyMock.*;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertSame;
+
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.tapestry.spec.IContainedComponent;
import org.apache.tapestry.test.Creator;
+import org.testng.annotations.Test;
/**
* Tests a few new features of {@link org.apache.tapestry.AbstractComponent} added in release
@@ -26,6 +29,7 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
+@Test
public class TestAbstractComponent extends BaseComponentTestCase
{
private static class ConcreteComponent extends AbstractComponent
@@ -71,7 +75,7 @@
IContainedComponent cc = newContainedComponent();
- replayControls();
+ replay();
IComponent component = (IComponent) creator.newInstance(BaseComponent.class);
@@ -79,7 +83,7 @@
assertSame(cc, component.getContainedComponent());
- verifyControls();
+ verify();
}
public void testContainedComponentConflict()
@@ -93,7 +97,7 @@
trainGetIdPath(page, null);
- replayControls();
+ replay();
replay();
IComponent component = (IComponent) creator.newInstance(BaseComponent.class, new Object[]
@@ -113,12 +117,12 @@
ex.getMessage());
}
- verifyControls();
+ verify();
verify();
}
private IContainedComponent newContainedComponent()
{
- return (IContainedComponent) newMock(IContainedComponent.class);
+ return newMock(IContainedComponent.class);
}
}
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestBaseSessionStoreOptimized.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestBaseSessionStoreOptimized.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestBaseSessionStoreOptimized.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestBaseSessionStoreOptimized.java Tue Jun 27 11:21:31 2006
@@ -14,10 +14,12 @@
package org.apache.tapestry;
+import static org.testng.AssertJUnit.assertEquals;
+
import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionBindingEvent;
-import org.apache.hivemind.test.HiveMindTestCase;
+import org.testng.annotations.Test;
/**
* Tests for {@link org.apache.tapestry.BaseSessionStoreOptimized}.
@@ -25,7 +27,8 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public class TestBaseSessionStoreOptimized extends HiveMindTestCase
+@Test
+public class TestBaseSessionStoreOptimized extends BaseComponentTestCase
{
public void testMarkDirty()
{
@@ -40,36 +43,36 @@
public void testMarkClean()
{
- HttpSession session = (HttpSession) newMock(HttpSession.class);
+ HttpSession session = newMock(HttpSession.class);
BaseSessionStoreOptimized object = new BaseSessionStoreOptimized();
object.markSessionStoreNeeded();
- replayControls();
+ replay();
object.valueBound(new HttpSessionBindingEvent(session, "sessionid", object));
assertEquals(false, object.isStoreToSessionNeeded());
- verifyControls();
+ verify();
}
public void testUnboundDoesNothing()
{
- HttpSession session = (HttpSession) newMock(HttpSession.class);
+ HttpSession session = newMock(HttpSession.class);
BaseSessionStoreOptimized object = new BaseSessionStoreOptimized();
object.markSessionStoreNeeded();
- replayControls();
+ replay();
object.valueUnbound(new HttpSessionBindingEvent(session, "sessionid", object));
assertEquals(true, object.isStoreToSessionNeeded());
- verifyControls();
+ verify();
}
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestComponentMessageAccess.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestComponentMessageAccess.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestComponentMessageAccess.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/TestComponentMessageAccess.java Tue Jun 27 11:21:31 2006
@@ -14,10 +14,12 @@
package org.apache.tapestry;
+import static org.easymock.EasyMock.expect;
+import static org.testng.AssertJUnit.assertEquals;
+
import org.apache.hivemind.Messages;
-import org.apache.hivemind.test.HiveMindTestCase;
import org.apache.tapestry.test.Creator;
-import org.easymock.MockControl;
+import org.testng.annotations.Test;
/**
* Tests support for several deprecated methods on {@link org.apache.tapestry.AbstractComponent}
@@ -27,7 +29,8 @@
* @author Howard Lewis Ship
* @since 4.0
*/
-public class TestComponentMessageAccess extends HiveMindTestCase
+@Test
+public class TestComponentMessageAccess extends BaseComponentTestCase
{
private AbstractComponent newComponent(Messages messages)
{
@@ -39,66 +42,59 @@
public void testGetMessage()
{
- MockControl control = newControl(Messages.class);
- Messages m = (Messages) control.getMock();
+ Messages m = newMock(Messages.class);
- m.getMessage("fred");
- control.setReturnValue("flintstone");
+ expect(m.getMessage("fred")).andReturn("flintstone");
AbstractComponent ac = newComponent(m);
- replayControls();
+ replay();
assertEquals("flintstone", ac.getMessage("fred"));
- verifyControls();
+ verify();
}
public void testFormat()
{
- MockControl control = newControl(Messages.class);
- Messages m = (Messages) control.getMock();
+ Messages m = newMock(Messages.class);
- m.format("fred", "flintstone");
- control.setReturnValue("Fred Flintstone");
+ expect(m.format("fred", "flintstone")).andReturn("Fred Flintstone");
AbstractComponent ac = newComponent(m);
- replayControls();
+ replay();
assertEquals("Fred Flintstone", ac.format("fred", "flintstone"));
- verifyControls();
+ verify();
- m.format("fred", "wilma", "dino");
- control.setReturnValue("flintstone family");
+ expect(m.format("fred", "wilma", "dino")).andReturn("flintstone family");
- replayControls();
+ replay();
assertEquals("flintstone family", ac.format("fred", "wilma", "dino"));
- verifyControls();
+ verify();
- m.format("fred", "wilma", "dino", "pebbles");
- control.setReturnValue("flintstone family 2");
+ expect(m.format("fred", "wilma", "dino", "pebbles")).andReturn("flintstone family 2");
- replayControls();
+ replay();
assertEquals("flintstone family 2", ac.format("fred", "wilma", "dino", "pebbles"));
- verifyControls();
+ verify();
Object[] arguments = new String[]
{ "flinstone" };
- m.format("fred", arguments);
- control.setReturnValue("flintstone family 3");
+ expect(m.format("fred", arguments)).andReturn("flintstone family 3");
- replayControls();
+ replay();
assertEquals("flintstone family 3", ac.format("fred", arguments));
- verifyControls();
+ verify();
}
}
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/ClasspathAssetFactoryTest.java Tue Jun 27 11:21:31 2006
@@ -14,31 +14,37 @@
package org.apache.tapestry.asset;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertSame;
+import static org.testng.AssertJUnit.assertTrue;
+
import java.util.Locale;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Location;
import org.apache.hivemind.Resource;
import org.apache.hivemind.impl.LocationImpl;
-import org.apache.hivemind.test.HiveMindTestCase;
import org.apache.hivemind.util.ClasspathResource;
+import org.apache.tapestry.BaseComponentTestCase;
import org.apache.tapestry.IAsset;
import org.apache.tapestry.engine.IEngineService;
import org.apache.tapestry.l10n.DefaultResourceLocalizer;
+import org.testng.annotations.Test;
/**
* Tests for {@link org.apache.tapestry.asset.ClasspathAssetFactory}.
*
* @author Howard M. Lewis Ship
*/
-public class ClasspathAssetFactoryTest extends HiveMindTestCase
+@Test
+public class ClasspathAssetFactoryTest extends BaseComponentTestCase
{
public void testCreateAsset()
{
IEngineService assetService = newService();
Location l = newLocation();
- replayControls();
+ replay();
ClasspathAssetFactory factory = new ClasspathAssetFactory();
factory.setClassResolver(getClassResolver());
@@ -54,7 +60,7 @@
.getResourceLocation().getPath());
assertSame(l, asset.getLocation());
- verifyControls();
+ verify();
}
public void testCreateAssetMissing()
@@ -62,7 +68,7 @@
IEngineService assetService = newService();
Location l = newLocation();
- replayControls();
+ replay();
ClasspathAssetFactory factory = new ClasspathAssetFactory();
factory.setClassResolver(getClassResolver());
@@ -84,7 +90,7 @@
assertSame(l, ex.getLocation());
}
- verifyControls();
+ verify();
}
public void testCreateAbsoluteAsset()
@@ -92,7 +98,7 @@
IEngineService assetService = newService();
Location l = newLocation();
- replayControls();
+ replay();
ClasspathAssetFactory factory = new ClasspathAssetFactory();
factory.setClassResolver(getClassResolver());
@@ -109,7 +115,7 @@
.getResourceLocation().getPath());
assertSame(l, asset.getLocation());
- verifyControls();
+ verify();
}
public void testCreateAbsoluteAssetMissing()
@@ -117,7 +123,7 @@
IEngineService assetService = newService();
Location l = newLocation();
- replayControls();
+ replay();
ClasspathAssetFactory factory = new ClasspathAssetFactory();
factory.setClassResolver(getClassResolver());
@@ -140,7 +146,7 @@
assertSame(l, ex.getLocation());
}
- verifyControls();
+ verify();
}
public void testCreateDirectoryAsset()
@@ -148,7 +154,7 @@
IEngineService assetService = newService();
Location l = newLocation();
- replayControls();
+ replay();
ClasspathAssetFactory factory = new ClasspathAssetFactory();
factory.setClassResolver(getClassResolver());
@@ -165,7 +171,7 @@
.getResourceLocation().getPath());
assertSame(l, asset.getLocation());
- verifyControls();
+ verify();
}
public void testCreateRelativeDirectoryAsset()
@@ -175,7 +181,7 @@
"/org/apache/tapestry/html/Shell.jwc");
Location l = new LocationImpl(shell);
- replayControls();
+ replay();
ClasspathAssetFactory factory = new ClasspathAssetFactory();
factory.setClassResolver(getClassResolver());
@@ -193,7 +199,7 @@
.getResourceLocation().getPath());
assertSame(l, asset.getLocation());
- verifyControls();
+ verify();
}
public void testCreateRelativeDirectoryMissingAsset()
@@ -203,7 +209,7 @@
"/org/apache/tapestry/html/Shell.jwc");
Location l = new LocationImpl(shell);
- replayControls();
+ replay();
ClasspathAssetFactory factory = new ClasspathAssetFactory();
factory.setClassResolver(getClassResolver());
@@ -221,7 +227,7 @@
.getResourceLocation().getPath());
assertSame(l, asset.getLocation());
- verifyControls();
+ verify();
}
/**
@@ -232,7 +238,7 @@
IEngineService assetService = newService();
Location l = newLocation();
- replayControls();
+ replay();
ClasspathAssetFactory factory = new ClasspathAssetFactory();
factory.setClassResolver(getClassResolver());
@@ -248,7 +254,7 @@
asset.getResourceLocation().getPath());
assertSame(l, asset.getLocation());
- verifyControls();
+ verify();
}
private ClasspathResource newBaseResource()
@@ -259,6 +265,6 @@
private IEngineService newService()
{
- return (IEngineService) newMock(IEngineService.class);
+ return newMock(IEngineService.class);
}
}
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/ContextAssetFactoryTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/ContextAssetFactoryTest.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/ContextAssetFactoryTest.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/ContextAssetFactoryTest.java Tue Jun 27 11:21:31 2006
@@ -14,23 +14,30 @@
package org.apache.tapestry.asset;
+import static org.easymock.EasyMock.expect;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertSame;
+import static org.testng.AssertJUnit.assertTrue;
+
import java.net.URL;
import java.util.Locale;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Location;
import org.apache.hivemind.Resource;
-import org.apache.hivemind.test.HiveMindTestCase;
+import org.apache.tapestry.BaseComponentTestCase;
import org.apache.tapestry.IAsset;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.l10n.DefaultResourceLocalizer;
import org.apache.tapestry.web.WebContext;
+import org.testng.annotations.Test;
-public class ContextAssetFactoryTest extends HiveMindTestCase
+@Test
+public class ContextAssetFactoryTest extends BaseComponentTestCase
{
protected Resource newResource()
{
- return (Resource) newMock(Resource.class);
+ return newMock(Resource.class);
}
protected URL newURL()
@@ -50,7 +57,7 @@
trainGetResourceURL(relative, url);
trainGetLocalization(relative, Locale.FRENCH, localized);
- replayControls();
+ replay();
ContextAssetFactory factory = new ContextAssetFactory();
factory.setLocalizer(new DefaultResourceLocalizer());
@@ -63,7 +70,7 @@
assertSame(localized, asset.getResourceLocation());
assertSame(l, asset.getLocation());
- verifyControls();
+ verify();
}
public void testCreateAssetMissing()
@@ -75,7 +82,7 @@
trainGetResourceURL(relative, null);
trainGetLocalization(relative, Locale.FRENCH, null);
- replayControls();
+ replay();
ContextAssetFactory factory = new ContextAssetFactory();
factory.setLocalizer(new DefaultResourceLocalizer());
@@ -94,7 +101,7 @@
assertSame(l, ex.getLocation());
}
- verifyControls();
+ verify();
}
public void testCreateAssetForClasspath()
@@ -102,16 +109,16 @@
Resource base = newResource();
Resource relative = newResource();
Location l = newLocation();
- AssetFactory classpathFactory = (AssetFactory) newMock(AssetFactory.class);
- IAsset asset = (IAsset) newMock(IAsset.class);
+ AssetFactory classpathFactory = newMock(AssetFactory.class);
+ IAsset asset = newMock(IAsset.class);
trainGetRelativeResource(base, "/asset.png", relative);
trainGetResourceURL(relative, null);
- classpathFactory.createAbsoluteAsset("/asset.png", Locale.FRENCH, l);
- setReturnValue(classpathFactory, asset);
+ expect(classpathFactory.createAbsoluteAsset("/asset.png", Locale.FRENCH, l))
+ .andReturn(asset);
- replayControls();
+ replay();
ContextAssetFactory factory = new ContextAssetFactory();
@@ -120,18 +127,18 @@
assertSame(asset, factory.createAsset(base, "/asset.png", Locale.FRENCH, l));
- verifyControls();
+ verify();
}
public void testCreateAbsoluteAsset()
{
Location l = newLocation();
URL url = newURL();
- WebContext context = (WebContext) newMock(WebContext.class);
+ WebContext context = newMock(WebContext.class);
trainGetResource(context, "/asset_fr.png", url);
- replayControls();
+ replay();
ContextAssetFactory factory = new ContextAssetFactory();
factory.setLocalizer(new DefaultResourceLocalizer());
@@ -144,18 +151,18 @@
assertEquals("/asset_fr.png", asset.getResourceLocation().getPath());
assertSame(l, asset.getLocation());
- verifyControls();
+ verify();
}
public void testCreateAbsoluteAssetMissing()
{
Location l = newLocation();
- WebContext context = (WebContext) newMock(WebContext.class);
+ WebContext context = newMock(WebContext.class);
trainGetResource(context, "/asset_fr.png", null);
trainGetResource(context, "/asset.png", null);
- replayControls();
+ replay();
ContextAssetFactory factory = new ContextAssetFactory();
factory.setLocalizer(new DefaultResourceLocalizer());
@@ -172,21 +179,21 @@
assertEquals("Missing context resource '/asset.png'.", ex.getMessage());
assertSame(l, ex.getLocation());
}
- verifyControls();
+ verify();
}
public void testCreateAssetEncodeURL()
{
Location l = newLocation();
URL url = newURL();
- WebContext context = (WebContext) newMock(WebContext.class);
- IRequestCycle rc = (IRequestCycle) newMock(IRequestCycle.class);
+ WebContext context = newMock(WebContext.class);
+ IRequestCycle rc = newMock(IRequestCycle.class);
trainGetResource(context, "/asset_fr.png", url);
trainEncodeURL(rc, "/context/asset_fr.png", "/context/asset_fr.png?encoded");
- replayControls();
+ replay();
ContextAssetFactory factory = new ContextAssetFactory();
factory.setLocalizer(new DefaultResourceLocalizer());
@@ -198,36 +205,31 @@
assertTrue(assetUrl.endsWith("?encoded"));
- verifyControls();
+ verify();
}
private void trainGetLocalization(Resource resource, Locale locale, Resource localized)
{
- resource.getLocalization(locale);
- setReturnValue(resource, localized);
+ expect(resource.getLocalization(locale)).andReturn(localized);
}
protected void trainGetResourceURL(Resource resource, URL url)
{
- resource.getResourceURL();
- setReturnValue(resource, url);
+ expect(resource.getResourceURL()).andReturn(url);
}
protected void trainGetResource(WebContext context, String path, URL url)
{
- context.getResource(path);
- setReturnValue(context, url);
+ expect(context.getResource(path)).andReturn(url);
}
protected void trainGetRelativeResource(Resource base, String path, Resource relative)
{
- base.getRelativeResource(path);
- setReturnValue(base, relative);
+ expect(base.getRelativeResource(path)).andReturn(relative);
}
protected void trainEncodeURL(IRequestCycle rc, String URL, String encodedURL)
{
- rc.encodeURL(URL);
- setReturnValue(rc, encodedURL);
+ expect(rc.encodeURL(URL)).andReturn(encodedURL);
}
}
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestAssetSource.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestAssetSource.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestAssetSource.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestAssetSource.java Tue Jun 27 11:21:31 2006
@@ -14,15 +14,18 @@
package org.apache.tapestry.asset;
+import static org.easymock.EasyMock.expect;
+import static org.testng.AssertJUnit.assertSame;
+
import java.util.Collections;
import java.util.List;
import java.util.Locale;
import org.apache.hivemind.Location;
import org.apache.hivemind.Resource;
-import org.apache.hivemind.test.HiveMindTestCase;
+import org.apache.tapestry.BaseComponentTestCase;
import org.apache.tapestry.IAsset;
-import org.easymock.MockControl;
+import org.testng.annotations.Test;
/**
* Tests for {@link org.apache.tapestry.asset.AssetSourceImpl}.
@@ -30,7 +33,8 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public class TestAssetSource extends HiveMindTestCase
+@Test
+public class TestAssetSource extends BaseComponentTestCase
{
private AssetFactoryContribution newContribution(String prefix, AssetFactory factory)
{
@@ -46,28 +50,16 @@
return Collections.singletonList(newContribution(prefix, factory));
}
- private Resource newResource()
- {
- return (Resource) newMock(Resource.class);
- }
-
private AssetFactory newAssetFactory(Resource base, String path, Locale locale,
Location location, IAsset asset)
{
- MockControl control = newControl(AssetFactory.class);
- AssetFactory f = (AssetFactory) control.getMock();
+ AssetFactory f = newMock(AssetFactory.class);
- f.createAsset(base, path, locale, location);
- control.setReturnValue(asset);
+ expect(f.createAsset(base, path, locale, location)).andReturn(asset);
return f;
}
-
- private IAsset newAsset()
- {
- return (IAsset) newMock(IAsset.class);
- }
-
+
public void testKnownPrefix()
{
Location l = newLocation();
@@ -82,7 +74,7 @@
l,
asset));
- replayControls();
+ replay();
AssetSourceImpl as = new AssetSourceImpl();
as.setContributions(contributions);
@@ -93,7 +85,7 @@
assertSame(actual, asset);
- verifyControls();
+ verify();
}
public void testUnknownPrefix()
@@ -105,7 +97,7 @@
AssetFactory f = newAssetFactory(r, "unknown:path/to/asset", Locale.ENGLISH, l, asset);
- replayControls();
+ replay();
AssetSourceImpl as = new AssetSourceImpl();
as.setDefaultAssetFactory(f);
@@ -114,7 +106,7 @@
assertSame(actual, asset);
- verifyControls();
+ verify();
}
public void testNoPrefix()
@@ -126,7 +118,7 @@
AssetFactory f = newAssetFactory(r, "path/to/asset", Locale.ENGLISH, l, asset);
- replayControls();
+ replay();
AssetSourceImpl as = new AssetSourceImpl();
as.setLookupAssetFactory(f);
@@ -135,6 +127,6 @@
assertSame(actual, asset);
- verifyControls();
+ verify();
}
}
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestDefaultAssetFactory.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestDefaultAssetFactory.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestDefaultAssetFactory.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestDefaultAssetFactory.java Tue Jun 27 11:21:31 2006
@@ -14,8 +14,12 @@
package org.apache.tapestry.asset;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertSame;
+
import org.apache.hivemind.Location;
-import org.apache.hivemind.test.HiveMindTestCase;
+import org.apache.tapestry.BaseComponentTestCase;
+import org.testng.annotations.Test;
/**
* Tests for {@link org.apache.tapestry.asset.DefaultAssetFactory}.
@@ -23,13 +27,14 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public class TestDefaultAssetFactory extends HiveMindTestCase
+@Test
+public class TestDefaultAssetFactory extends BaseComponentTestCase
{
public void testCreateAssetFull()
{
Location l = newLocation();
- replayControls();
+ replay();
AssetFactory factory = new DefaultAssetFactory();
@@ -38,14 +43,14 @@
assertEquals("ExternalAsset[/foo/bar/baz]", asset.toString());
assertSame(l, asset.getLocation());
- verifyControls();
+ verify();
}
public void testCreateAssetFromResource()
{
Location l = newLocation();
- replayControls();
+ replay();
AssetFactory factory = new DefaultAssetFactory();
@@ -54,7 +59,7 @@
assertEquals("ExternalAsset[/foo/bar/baz]", asset.toString());
assertSame(l, asset.getLocation());
- verifyControls();
+ verify();
}
}
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestExternalResource.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestExternalResource.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestExternalResource.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestExternalResource.java Tue Jun 27 11:21:31 2006
@@ -15,6 +15,7 @@
package org.apache.tapestry.asset;
import org.apache.hivemind.test.HiveMindTestCase;
+import org.testng.annotations.Test;
/**
* Tests for {@link org.apache.tapestry.asset.ExternalResource}.
@@ -22,6 +23,7 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
+@Test
public class TestExternalResource extends HiveMindTestCase
{
public void testGetResourceURL()
Modified: tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestResourceDigestSource.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestResourceDigestSource.java?rev=417545&r1=417544&r2=417545&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestResourceDigestSource.java (original)
+++ tapestry/tapestry4/trunk/framework/src/test/org/apache/tapestry/asset/TestResourceDigestSource.java Tue Jun 27 11:21:31 2006
@@ -14,13 +14,16 @@
package org.apache.tapestry.asset;
+import static org.easymock.EasyMock.expect;
+import static org.testng.AssertJUnit.assertEquals;
+
import java.net.URL;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.ClassResolver;
import org.apache.hivemind.impl.DefaultClassResolver;
-import org.apache.hivemind.test.HiveMindTestCase;
-import org.easymock.MockControl;
+import org.apache.tapestry.BaseComponentTestCase;
+import org.testng.annotations.Test;
/**
* Tests for {@link org.apache.tapestry.asset.ResourceDigestSourceImpl}.
@@ -28,7 +31,8 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public class TestResourceDigestSource extends HiveMindTestCase
+@Test
+public class TestResourceDigestSource extends BaseComponentTestCase
{
public void testSuccess()
{
@@ -57,15 +61,13 @@
public void testCache()
{
- MockControl control = newControl(ClassResolver.class);
- ClassResolver resolver = (ClassResolver) control.getMock();
+ ClassResolver resolver = newMock(ClassResolver.class);
URL url = getClass().getResource("tapestry-in-action.png");
- resolver.getResource("/foo");
- control.setReturnValue(url);
+ expect(resolver.getResource("/foo")).andReturn(url);
- replayControls();
+ replay();
ResourceDigestSourceImpl s = new ResourceDigestSourceImpl();
s.setClassResolver(resolver);
@@ -77,12 +79,11 @@
assertEquals("a5f4663532ea3efe22084df086482290", s.getDigestForResource("/foo"));
- verifyControls();
+ verify();
- resolver.getResource("/foo");
- control.setReturnValue(url);
+ expect(resolver.getResource("/foo")).andReturn(url);
- replayControls();
+ replay();
// This clears the cache
@@ -92,7 +93,7 @@
assertEquals("a5f4663532ea3efe22084df086482290", s.getDigestForResource("/foo"));
- verifyControls();
+ verify();
}
}