From: <st...@us...> - 2008-01-18 13:04:21
|
Revision: 5770 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=5770&view=rev Author: steve_l Date: 2008-01-18 05:04:16 -0800 (Fri, 18 Jan 2008) Log Message: ----------- SFOS-182 SLP tests are failing Modified Paths: -------------- trunk/core/components/slp/build.xml trunk/core/components/slp/src/org/smartfrog/services/comm/slp/Advertiser.java trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/tcn80.sf Added Paths: ----------- trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpNegativeTest.java trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpPositiveTest.java trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpTestBase.java Modified: trunk/core/components/slp/build.xml =================================================================== --- trunk/core/components/slp/build.xml 2008-01-18 12:16:01 UTC (rev 5769) +++ trunk/core/components/slp/build.xml 2008-01-18 13:04:16 UTC (rev 5770) @@ -60,17 +60,10 @@ <!--available file="../../common.xml" property="root.dir" value="../.."/--> <import file="${root.dir}/common.xml"/> + <echo message="==================================================================="/> + <echo message="= ${ant.project.name}"/> - <!-- =================================================================== --> - <!-- Initialization target --> - <!-- =================================================================== --> - <target name="init" depends="init-standard-output-dirs"> - <echo message="==================================================================="/> - <echo message="= ${ant.project.name}"/> - </target> - - <!-- ========================================================== --> <!-- parse test files --> <!-- ========================================================== --> Modified: trunk/core/components/slp/src/org/smartfrog/services/comm/slp/Advertiser.java =================================================================== --- trunk/core/components/slp/src/org/smartfrog/services/comm/slp/Advertiser.java 2008-01-18 12:16:01 UTC (rev 5769) +++ trunk/core/components/slp/src/org/smartfrog/services/comm/slp/Advertiser.java 2008-01-18 13:04:16 UTC (rev 5770) @@ -50,7 +50,7 @@ Vector serviceLocationAttributes) throws ServiceLocationException; - /** Return the language locale with which this object was created */ + /** @return the language locale with which this object was created */ public abstract Locale getLocale(); Copied: trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpNegativeTest.java (from rev 5766, trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SLPTest.java) =================================================================== --- trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpNegativeTest.java (rev 0) +++ trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpNegativeTest.java 2008-01-18 13:04:16 UTC (rev 5770) @@ -0,0 +1,113 @@ +/** (C) Copyright 2004-2007 Hewlett-Packard Development Company, LP + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + For more information: www.smartfrog.org + + */ + + +package org.smartfrog.test.system.components.slp; + +import org.smartfrog.test.SmartFrogTestBase; +import org.smartfrog.sfcore.prim.Prim; +import org.smartfrog.services.comm.slp.SFSlpLocatorImpl; +import org.smartfrog.services.comm.slp.SFSlpDA; +import org.smartfrog.services.comm.slp.SFSlpAdvertiser; +import org.smartfrog.services.comm.slp.SFSlpLocator; +import org.smartfrog.examples.helloworld.Printer; + +/** + * JUnit test class for test cases related to "SLP" component + * */ +public class SlpNegativeTest extends SlpTestBase { + + public SlpNegativeTest(String s) { + super(s); + } + + + public void testCaseTCP38() throws Throwable { + deployDirectoryAgent(); + } + +/* Testing without serviceType in Service Agant */ + + public void testCaseTCN80() throws Throwable { +// application = deployExpectingSuccess("org/smartfrog/services/comm/slp/sf/SFSlpDA.sf", "DirectoryAgentTCN80"); + deployExpectingException(FILES + "tcn80.sf", + "tcn80", + null, + null, + EXCEPTION_LINKRESOLUTION, + "serviceType"); + //Unresolved Reference: HERE serviceType + } + + + /* Testing without toAdvertise in Service Agant */ + public void testCaseTCN81() throws Throwable { +// application = deployExpectingSuccess("org/smartfrog/services/comm/slp/sf/SFSlpDA.sf", "DirectoryAgentTCN81"); + deployExpectingException(FILES + "tcn81.sf", + "tcn81", + EXCEPTION_LIFECYCLE, + "sfDeploy", + EXCEPTION_SMARTFROG, + "Could not find 'toAdvertise' attribute"); + + } + + /* Testing without serviceType in User Agant*/ + public void testCaseTCN82() throws Throwable { +// Prim applicationtcn70 = deployExpectingSuccess("org/smartfrog/services/comm/slp/sf/SFSlpDA.sf", "DirectoryAgentTCN82"); + application = deployExpectingSuccess(FILES + "ServiceProvider.sf", "serviceAgentTCN70"); + deployExpectingException(FILES + "tcn82.sf", + "tcn170", + EXCEPTION_LIFECYCLE, + "sfDeploy", + EXCEPTION_RESOLUTION, + SFSlpLocatorImpl.EXCEPTION_NO_SERVICE_TYPE); + } + + + + // Expecting failer in locating-Test case - there is no service adv. + public void testCaseTCN83() throws Throwable { + deployExpectingException(FILES + "ServiceRequestor.sf", + "UserAgentTCN83", + EXCEPTION_LIFECYCLE, + "sfDeploy", + EXCEPTION_RESOLUTION, + SFSlpLocatorImpl.EXCEPTION_NO_SLP_SERVICE); + } + + // Testing service life time - Expecting failure because of life time time out. + public void testCaseTCN84() throws Throwable { + deployDirectoryAgent(); + application = deployExpectingSuccess(FILES + "tcn84_SA.sf", "ServiceAgentTCN84"); + Thread.sleep(SLEEP_DELAY); + deployExpectingException(FILES + "tcn84_UA.sf", + "UserAgentTCP84", + EXCEPTION_LIFECYCLE, + "sfDeploy", + EXCEPTION_RESOLUTION, + SFSlpLocatorImpl.EXCEPTION_NO_SLP_SERVICE); + } + + + +} + + Property changes on: trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpNegativeTest.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Added: trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpPositiveTest.java =================================================================== --- trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpPositiveTest.java (rev 0) +++ trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpPositiveTest.java 2008-01-18 13:04:16 UTC (rev 5770) @@ -0,0 +1,101 @@ +/** (C) Copyright 2007 Hewlett-Packard Development Company, LP + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +For more information: www.smartfrog.org + +*/ +package org.smartfrog.test.system.components.slp; + +import org.smartfrog.sfcore.prim.Prim; +import org.smartfrog.services.comm.slp.SFSlpAdvertiser; +import org.smartfrog.services.comm.slp.SFSlpLocator; +import org.smartfrog.examples.helloworld.Printer; + +/** + * + * Created 18-Jan-2008 12:52:26 + * + */ + +public class SlpPositiveTest extends SlpTestBase{ + + public SlpPositiveTest(String name) { + super(name); + } + + /* Success in advertising- Test case */ + public void testCaseTCP39() throws Throwable { + // Prim applicationtcn39D = deployExpectingSuccess("org/smartfrog/services/comm/slp/sf/SFSlpDA.sf", "DirectoryAgentTCP39"); + application = deployExpectingSuccess(FILES + "ServiceProvider.sf", "ServiceAgentTCP39"); + + Prim adv = (Prim) application.sfResolveHere("adv"); + assertInstanceOf(adv, SFSlpAdvertiser.class); + Prim printer = (Prim) application.sfResolveHere("p"); + assertInstanceOf(printer, Printer.class); + String actualPSfClass = (String) printer.sfResolveHere("sfClass"); + assertEquals("org.smartfrog.examples.helloworld.PrinterImpl", actualPSfClass); + } + + /* Success in locating-Test case */ + public void testCaseTCP40() throws Throwable { + Prim serviceProvider = null; + Prim serviceRequestor = null; + try { + deployDirectoryAgent(); + serviceProvider = deployExpectingSuccess(FILES + "ServiceProvider.sf", + "testCaseTCP40ServiceProvider"); + serviceRequestor = deployExpectingSuccess(FILES + "ServiceRequestor.sf", + "testCaseTCP40ServiceRequestor"); + Thread.sleep(SLEEP_DELAY); + assertNotNull(serviceRequestor); + Prim loc = (Prim) serviceRequestor.sfResolveHere("loc"); + assertInstanceOf(loc, SFSlpLocator.class); + + Prim g = (Prim) serviceRequestor.sfResolve("g"); + String actualSfClass = (String) g.sfResolveHere("sfClass"); + assertEquals("org.smartfrog.examples.helloworld.GeneratorImpl", actualSfClass); + + } finally { + terminateApplication(serviceProvider); + terminateApplication(serviceRequestor); + } + + } + // change the port and test the success + public void testCaseTCP41() throws Throwable { + // Prim applicationtcn41D = deployExpectingSuccess("org/smartfrog/services/comm/slp/sf/SFSlpDA.sf", "DirectoryAgentTCP41"); + Prim userAgent = null; + try { + application = deployExpectingSuccess(FILES + "tcp41_SA.sf", "tcp41_ServiceAgent"); + userAgent = deployExpectingSuccess(FILES + "tcp41_UA.sf", "tcp41_UserAgent"); + Thread.sleep(SLEEP_DELAY); + assertNotNull(userAgent); + + Prim loc = (Prim) userAgent.sfResolveHere("loc"); + String actual_loc_SfClass = (String) loc.sfResolveHere("sfClass"); + assertEquals("org.smartfrog.services.comm.slp.SFSlpLocatorImpl", actual_loc_SfClass); + + Prim g = (Prim) userAgent.sfResolve("g"); + String actualSfClass = (String) g.sfResolveHere("sfClass"); + assertEquals("org.smartfrog.examples.helloworld.GeneratorImpl", actualSfClass); + } finally { + // terminateApplication(applicationtcn41D); + terminateApplication(userAgent); + } + + + } +} Added: trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpTestBase.java =================================================================== --- trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpTestBase.java (rev 0) +++ trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/SlpTestBase.java 2008-01-18 13:04:16 UTC (rev 5770) @@ -0,0 +1,56 @@ +/** (C) Copyright 2007 Hewlett-Packard Development Company, LP + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +For more information: www.smartfrog.org + +*/ +package org.smartfrog.test.system.components.slp; + +import org.smartfrog.test.SmartFrogTestBase; +import org.smartfrog.test.DeployingTestBase; +import org.smartfrog.sfcore.prim.Prim; +import org.smartfrog.services.comm.slp.SFSlpDA; + +/** + * + * Created 18-Jan-2008 12:54:43 + * + */ + +public class SlpTestBase extends DeployingTestBase { + protected static final String FILES = "org/smartfrog/test/system/components/slp/"; + protected static final int SLEEP_DELAY = 10000; + + public SlpTestBase(String name) { + super(name); + } + + /** + * deploy the DA into the directoryAgent member variable, and under the name DirectoryAgent. + * The DA will be terminated at the end of every test run. + * @return the deployed application. + * @throws Throwable + */ + protected Prim deployDirectoryAgent() throws Throwable { + application = deployExpectingSuccess(FILES + "DirectoryAgent.sf","DirectoryAgent"); + assertInstanceOf(getDirectoryAgent(), SFSlpDA.class); + return application; + } + + public Prim getDirectoryAgent() { + return application; + } +} Modified: trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/tcn80.sf =================================================================== --- trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/tcn80.sf 2008-01-18 12:16:01 UTC (rev 5769) +++ trunk/core/components/slp/test/org/smartfrog/test/system/components/slp/tcn80.sf 2008-01-18 13:04:16 UTC (rev 5770) @@ -7,6 +7,7 @@ p extends Printer; adv extends SFSlpAdvertiser { + serviceType "service:sf-prim:printer"; toAdvertise LAZY p; } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |