Author: chatellier Date: 2009-01-12 10:39:50 +0000 (Mon, 12 Jan 2009) New Revision: 1292 Added: topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleService.java topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceImpl.java topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceServer.java topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceTest.java Log: Replace "Taist" by "Example" :p Copied: topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleService.java (from rev 1290, topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/TaistService.java) =================================================================== --- topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleService.java (rev 0) +++ topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleService.java 2009-01-12 10:39:50 UTC (rev 1292) @@ -0,0 +1,41 @@ +/* *##% ToPIA - Tools for Portable and Independent Architecture + * Copyright (C) 2004 - 2008 CodeLutin + * + * This program 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 3 of the + * License, or (at your option) any later version. + * + * This program 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 General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ + +package org.codelutin.topia.service; + +import org.codelutin.topia.TopiaException; + +/** + * TestService.java + * <p/> + * Genere par Topia ! + * + * @author chatellier + * @version $Revision$ + * <p/> + * Last update : $Date$ By : $Author$ + */ +public interface ExampleService extends TopiaApplicationService { + + /** + * Declaration d'un service + * + * @param name le nom + * @return hello + */ + public String sayHello(String name) throws TopiaException; +} Property changes on: topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleService.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:mergeinfo + Name: svn:eol-style + native Copied: topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceImpl.java (from rev 1290, topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/TaistServiceImpl.java) =================================================================== --- topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceImpl.java (rev 0) +++ topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceImpl.java 2009-01-12 10:39:50 UTC (rev 1292) @@ -0,0 +1,63 @@ +/* *##% ToPIA - Tools for Portable and Independent Architecture + * Copyright (C) 2004 - 2008 CodeLutin + * + * This program 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 3 of the + * License, or (at your option) any later version. + * + * This program 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 General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ + +package org.codelutin.topia.service; + +import org.codelutin.topia.service.TopiaApplicationServiceAbstract; +import org.junit.Ignore; + +/** + * TestServiceImpl.java + * + * Developpe par le programmeur ! + * + * @author chatellier + * @version $Revision$ + * + * Last update : $Date$ By : $Author$ + */ +@Ignore +public class ExampleServiceImpl extends TopiaApplicationServiceAbstract implements + ExampleService { + + private String prefix; + + private static int nb = 0; + + public ExampleServiceImpl() { + this.prefix = "Salut"; + nb = nb + 1; + } + + /** + * + * @param prefix + */ + public ExampleServiceImpl(String prefix) { + this(); + this.prefix = prefix; + } + + /* + * (non-Javadoc) + * + * @see service.TaistService#sayHello(java.lang.String) + */ + public String sayHello(String name) { + return prefix + " " + name + " (instance " + nb + ")"; + } +} Property changes on: topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceImpl.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:mergeinfo + Name: svn:eol-style + native Copied: topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceServer.java (from rev 1290, topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/TaistServiceServer.java) =================================================================== --- topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceServer.java (rev 0) +++ topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceServer.java 2009-01-12 10:39:50 UTC (rev 1292) @@ -0,0 +1,59 @@ +/* *##% ToPIA - Tools for Portable and Independent Architecture + * Copyright (C) 2004 - 2008 CodeLutin + * + * This program 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 3 of the + * License, or (at your option) any later version. + * + * This program 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 General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ + +package org.codelutin.topia.service; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.junit.Ignore; + +/** + * TopiaServiceServer.java + * <p/> + * Class main chargee de lire le fichier de configuration et de lancer les + * serveurs, pour les protocoles definit. + * + * @author chatellier + * @version $Revision$ + * <p/> + * Last update : $Date$ By : $Author$ + */ +@Ignore +public class ExampleServiceServer { + + /** Logger (common logging) */ + private static final Log logger = LogFactory + .getLog(ExampleServiceServer.class); + + /** + * Main. Demarre les serveurs. + * + * @param args arguments + */ + public static void main(String... args) { + + // TaistService ts = new TaistServiceImpl("Bonjour"); + // TopiaServiceFactory.addService(TaistService.class, ts , + // Protocole.XML_RPC); + //TopiaServiceFactory.addService(TaistService.class, + // TaistServiceImpl.class, Protocole.XML_RPC); + TopiaApplicationServiceFactory.addService(ExampleService.class, + ExampleServiceImpl.class, Protocol.SOAP); + + logger.info("Service ExampleService added..."); + } +} Property changes on: topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceServer.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:mergeinfo + Name: svn:eol-style + native Copied: topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceTest.java (from rev 1290, topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/TaistServiceTest.java) =================================================================== --- topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceTest.java (rev 0) +++ topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceTest.java 2009-01-12 10:39:50 UTC (rev 1292) @@ -0,0 +1,75 @@ +/* *##% ToPIA - Tools for Portable and Independent Architecture + * Copyright (C) 2004 - 2008 CodeLutin + * + * This program 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 3 of the + * License, or (at your option) any later version. + * + * This program 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 General Lesser Public License for more details. + * + * You should have received a copy of the GNU General Lesser Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/lgpl-3.0.html>. ##%*/ + +package org.codelutin.topia.service; + +import org.codelutin.topia.TopiaException; +import org.codelutin.topia.TopiaNotFoundException; +import org.junit.Assert; +import org.junit.Test; +import org.junit.BeforeClass; +import org.junit.Ignore; + +/** + * TestServiceTestCase.java + * <p/> + * Test junit du service. + * <p/> + * Il faut lancer les serveurs avant ce test + * + * @author chatellier + * @version $Revision$ + * <p/> + * Last update : $Date$ By : $Author$ + * @see ExampleServiceServer + */ +@Ignore +public class ExampleServiceTest { + + @BeforeClass + public static void beforeClass() { + //one dayit will works :) + //TaistServiceServer.main(); + } + + /** Test de la methode say hello */ + @Test + public void testSayHello() { + + String reponse = null; + + ExampleService testService; + try { + testService = TopiaApplicationServiceFactory + .getService(ExampleService.class); + + String myName = "test"; + + reponse = testService.sayHello(myName); + + System.out.println("ExampleService says : " + reponse); + } catch (TopiaNotFoundException e) { + System.err + .println("TopiaNotFoundException: erreur du fichier de configuration"); + } catch (TopiaException e) { + System.err + .println("TopiaException: impossible d'instancier le service"); + } + + Assert.assertNotNull(reponse); + } +} Property changes on: topia/trunk/topia-soa/src/test/java/org/codelutin/topia/service/ExampleServiceTest.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:mergeinfo + Name: svn:eol-style + native
participants (1)
-
chatellierï¼ users.labs.libre-entreprise.org