[Asterisk-java-cvs] CVS: asterisk-java/src/test/net/sf/asterisk/fastagi ResourceBundleMappingStrateg
Brought to you by:
srt
From: Stefan R. <sr...@us...> - 2005-03-10 21:31:44
|
Update of /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8941/src/test/net/sf/asterisk/fastagi Added Files: ResourceBundleMappingStrategyTest.java fastagi-mapping.properties HelloAGIScript.java Log Message: Added ResourceBundleMappingStrategy --- NEW FILE: ResourceBundleMappingStrategyTest.java --- /* * Copyright 2004-2005 Stefan Reuter * * 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 net.sf.asterisk.fastagi; import junit.framework.TestCase; public class ResourceBundleMappingStrategyTest extends TestCase { private ResourceBundleMappingStrategy mappingStrategy; protected void setUp() throws Exception { super.setUp(); this.mappingStrategy = new ResourceBundleMappingStrategy(); this.mappingStrategy .setResourceBundleName("net.sf.asterisk.fastagi.fastagi-mapping"); } public void testDetermineScript() { AGIScript scriptFirstPass; AGIScript scriptSecondPass; AGIRequestImpl request; request = new AGIRequestImpl(); request.setScript("hello.agi"); scriptFirstPass = mappingStrategy.determineScript(request); scriptSecondPass = mappingStrategy.determineScript(request); assertTrue("incorrect script determined", scriptFirstPass instanceof HelloAGIScript); assertTrue("script instances are not cached", scriptFirstPass == scriptSecondPass); } public void testDetermineScriptWithResourceBundleUnavailable() { AGIRequestImpl request; request = new AGIRequestImpl(); request.setScript("hello.agi"); mappingStrategy.setResourceBundleName("net.sf.asterisk.fastagi.unavailable"); assertNull(mappingStrategy.determineScript(request)); } } --- NEW FILE: fastagi-mapping.properties --- hello.agi = net.sf.asterisk.fastagi.HelloAGIScript string.agi = java.lang.String nonexisting.agi = net.sf.asterisk.fastagi.NonExistingAGIScript --- NEW FILE: HelloAGIScript.java --- /* * Copyright 2004-2005 Stefan Reuter * * 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 net.sf.asterisk.fastagi; /** * Test script for use with the ResourceBundleMappingStrategyTest. * * @author srt * @version $Id: HelloAGIScript.java,v 1.1 2005/03/10 21:31:31 srt Exp $ */ public class HelloAGIScript implements AGIScript { public HelloAGIScript() { } public void service(AGIRequest request, AGIResponse response) { return; } } |