Commit 8c8c2a6b authored by Lionel Seinturier's avatar Lionel Seinturier
Browse files

Bug fix and associated test.

parent 734fa63a
......@@ -57,7 +57,7 @@ public class SCAEasy implements JuliacModuleItf {
JuliacConfig jconf = jc.getJuliacConfig();
MembraneLoaderItf mloader =
jconf.loadModuleIfNew(
JulietLoader.class.getName(), MembraneLoaderItf.class );
JulietLoader.class.getName(), JulietLoader.class );
mloader.put( SCAEasyPrimitive.NAME, SCAEasyPrimitive.class );
mloader.put(
......
......@@ -34,6 +34,11 @@
<artifactId>frascati-tinfi-mixins</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
</project>
......@@ -30,7 +30,6 @@ import org.oasisopen.sca.annotation.Callback;
import org.objectweb.fractal.api.type.InterfaceType;
import org.objectweb.fractal.julia.type.BasicInterfaceType;
import org.objectweb.fractal.juliac.api.ClassGeneratorItf;
import org.objectweb.fractal.juliac.api.MembraneLoaderItf;
import org.objectweb.fractal.juliac.conf.JuliacConfig;
import org.objectweb.fractal.juliac.conf.JulietLoader;
import org.objectweb.fractal.juliac.desc.MembraneDesc;
......@@ -64,12 +63,17 @@ extends org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator {
* Use loadModuleIfNew instead of loadModule, since other modules may
* retrieve the Juliet module to register membrane definitions. This is
* the case with the EasyCommons Implementation module.
*
* Use JulietLoader as the service type, instead of MembraneLoaderItf,
* since we really want an instance of JulietLoader, not of e.g.
* MembraneLoader which would be the case when e.g. the OO mode is
* registered before the current one (see the associated JUnit test).
*/
JuliacConfig jconf = jc.getJuliacConfig();
mloader =
jconf.loadModuleIfNew(
JulietLoader.class.getName(), MembraneLoaderItf.class );
JulietLoader.class.getName(), JulietLoader.class );
mloader.put(SCAPrimitive.NAME,SCAPrimitive.class);
mloader.put(SCAComposite.NAME,SCAComposite.class);
......
/***
* OW2 FraSCAti Tinfi
* Copyright (C) 2012 Inria, Univ. Lille 1
*
* 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 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
*
* Contact: frascati@ow2.org
*
* Author: Lionel Seinturier
*/
package org.ow2.frascati.tinfi.opt.oo;
import java.io.IOException;
import org.junit.Test;
import org.objectweb.fractal.juliac.Juliac;
import org.objectweb.fractal.juliac.api.JuliacModuleItf;
import org.objectweb.fractal.juliac.conf.JuliacConfig;
/**
* Class for testing the functionalities of the {@link
* FCOOCtrlSourceCodeGeneratorTestCase} class.
*
* @author Lionel Seinturier <Lionel.Seinturier@univ-lille1.fr>
* @since 1.4.5
*/
public class FCOOCtrlSourceCodeGeneratorTestCase {
/**
* Test whether the OO and Tinfi OO mode can cohabit. This is related to the
* cohabitation of ModuleLoader and JulietLoader.
*/
@Test
public void testTwoGenerators() throws IOException {
Juliac jc = new Juliac();
JuliacConfig jconf = new JuliacConfig(jc);
jc.setJuliacConfig(jconf);
JuliacModuleItf oo =
new org.objectweb.fractal.juliac.opt.oo.FCOOCtrlSourceCodeGenerator();
JuliacModuleItf tinfioo =
new org.ow2.frascati.tinfi.opt.oo.FCOOCtrlSourceCodeGenerator();
oo.init(jc);
tinfioo.init(jc);
tinfioo.close(jc);
oo.close(jc);
jc.close();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment