Commit 20e772fa authored by Gwenael Cattez's avatar Gwenael Cattez

Add Light mock module for "La maison au doigt et à l'oeil"

parent c5d220ec
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>common-homeautomation</artifactId>
<groupId>org.ow2.frascati.demo</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>common-homeautomation-light-mock</artifactId>
<name>Common Mock Ligth component</name>
<properties>
<composite.file.local>light-mock</composite.file.local>
<composite.file.deploy>light-mock</composite.file.deploy>
</properties>
<dependencies>
<dependency>
<groupId>org.ow2.frascati.demo</groupId>
<artifactId>common-onoffdevice</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.frascati.demo</groupId>
<artifactId>common-homeautomation-interface</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-binding-ws</artifactId>
</dependency>
<dependency>
<groupId>org.ow2.frascati.examples.test</groupId>
<artifactId>frascati-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ow2.frascati</groupId>
<artifactId>frascati-runtime-factory</artifactId>
<version>${frascati.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2008-2012 Inria, University of Lille
*
* 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: Gwénaël Cattez
*
* Contributor(s):
*
*/
package org.ow2.frascati.demo.common.homeautomation.light;
import java.util.logging.Logger;
import org.osoa.sca.annotations.EagerInit;
import org.osoa.sca.annotations.Scope;
import org.ow2.frascati.demo.common.homeautomation.actuator.OnOffDimActuator;
import org.ow2.frascati.demo.common.onoffdevice.SwOnOffDevice;
/**
* Implementation of an on,off,dim light communicated with a zibase
*/
@EagerInit
@Scope("COMPOSITE")
public class LightMock extends SwOnOffDevice implements OnOffDimActuator
{
private static final long serialVersionUID = 7739837659903828745L;
private static final Logger logger = Logger.getLogger(LightMock.class.getName());
/**
* Constructor for {@link SwOnOffDevice} class, set the title of the Swing Panel
*/
public LightMock()
{
super("Mocked Ligth");
}
/**
* @see org.ow2.frascati.demo.common.onoffdevice.SwOnOffDevice#onAction()
*/
@Override
public Boolean onAction()
{
acturatorOn();
return null;
}
/**
* @see org.ow2.frascati.demo.common.onoffdevice.SwOnOffDevice#offAction()
*/
@Override
public Boolean offAction()
{
acturatorOff();
return null;
}
/**
* @see org.ow2.frascati.demo.common.homeautomation.actuator.OnOffActuator#acturatorOn()
*/
public void acturatorOn()
{
logger.info("[LightMock] invoke method on");
}
/**
* @see org.ow2.frascati.demo.common.homeautomation.actuator.OnOffActuator#acturatorOff()
*/
public void acturatorOff()
{
logger.info("[LightMock] invoke method off");
}
/**
* @see org.ow2.frascati.demo.common.homeautomation.actuator.OnOffDimActuator#actuatorDim(int)
*/
public void actuatorDim(int dimValue)
{
logger.info("[LightMock] invoke method dim with value "+dimValue);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (C) 2008-2012 Inria, University of Lille -->
<!-- -->
<!-- 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: Gwenael CATTEZ -->
<!-- -->
<!-- Contributors : -->
<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdli="http://www.w3.org/2004/08/wsdl-instance"
name="light-mock">
<component name="light-mock">
<property name="onText">turn on</property>
<property name="offText">turn off</property>
<property name="onIconPath">images/light_on.png</property>
<property name="offIconPath">images/light_off.png</property>
<service name="onoffdim-actuator">
<interface.java interface="org.ow2.frascati.demo.common.homeautomation.actuator.OnOffDimActuator" />
</service>
<implementation.java class="org.ow2.frascati.demo.common.homeautomation.light.LightMock" />
</component>
<service name="onoffdim-actuator" promote="light-mock/onoffdim-actuator">
<binding.ws uri="http://localhost:9123/light/mock"/>
</service>
</composite>
\ No newline at end of file
/**
* OW2 FraSCAti Assembly Factory
* Copyright (C) 2008-2012 Inria, University of Lille
*
* 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: Gwénaël Cattez
*
* Contributor(s):
*
*/
package org.ow2.frascati.demo.common.homeautomation.light;
import org.junit.Test;
import org.ow2.frascati.demo.common.homeautomation.actuator.OnOffDimActuator;
import org.ow2.frascati.examples.test.FraSCAtiTestCase;
/**
*
*/
public class LightMockTest extends FraSCAtiTestCase
{
/* (non-Javadoc)
* @see org.ow2.frascati.examples.test.FraSCAtiTestCase#getComposite()
*/
@Override
public String getComposite()
{
return "light-mock";
}
@Test
public final void testInvoke()
{
OnOffDimActuator lightMock=getService(OnOffDimActuator.class, "onoffdim-actuator");
lightMock.acturatorOn();
lightMock.actuatorDim(50);
lightMock.acturatorOff();
}
}
\ No newline at end of file
......@@ -41,6 +41,7 @@
<module>common-homeautomation-switch</module>
<module>common-homeautomation-switch-mock</module>
<module>common-homeautomation-light</module>
<module>common-homeautomation-light-mock</module>
<module>common-homeautomation-videoscreen-mock</module>
</modules>
......
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