converted tabs to spaces

This commit is contained in:
Jonas Bonér 2010-03-20 10:56:46 +01:00
parent ae4d9d8876
commit 9fdc29fd3e
8 changed files with 139 additions and 139 deletions

0
akka-spring/akka-spring-test-java/pom.xml Executable file → Normal file
View file

View file

@ -2,9 +2,9 @@ package se.scalablesolutions.akka.spring.foo;
public class Bar implements IBar {
@Override
public String getBar() {
return "bar";
}
@Override
public String getBar() {
return "bar";
}
}

View file

@ -1,7 +1,7 @@
package se.scalablesolutions.akka.spring.foo;
public interface IBar {
String getBar();
String getBar();
}

View file

@ -1,33 +1,33 @@
package se.scalablesolutions.akka.spring.foo;
public class MyPojo {
private String foo;
private String bar;
public MyPojo() {
this.foo = "foo";
this.bar = "bar";
}
private String foo;
private String bar;
public MyPojo() {
this.foo = "foo";
this.bar = "bar";
}
public String getFoo() {
return foo;
}
public String getFoo() {
return foo;
}
public String getBar() {
return bar;
}
public void preRestart() {
System.out.println("pre restart");
}
public void postRestart() {
System.out.println("post restart");
}
public String getBar() {
return bar;
}
public void preRestart() {
System.out.println("pre restart");
}
public void postRestart() {
System.out.println("post restart");
}
public String longRunning() {
try {

View file

@ -7,7 +7,7 @@
http://www.akkasource.org/schema/akka
file:////Users/michaelkober/akka/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka.xsd">
<bean id="wrappedService"
<bean id="wrappedService"
class="se.scalablesolutions.akka.actor.ActiveObject"
factory-method="newInstance">
<constructor-arg index="0" type="java.lang.Class" value="se.scalablesolutions.akka.spring.foo.MyPojo"/>
@ -15,62 +15,62 @@
</bean>
<akka:active-object id="simple-active-object"
target="se.scalablesolutions.akka.spring.foo.MyPojo"
timeout="1000"/>
target="se.scalablesolutions.akka.spring.foo.MyPojo"
timeout="1000"/>
<akka:active-object id="simple-active-object-long-timeout"
target="se.scalablesolutions.akka.spring.foo.MyPojo"
timeout="10000"/>
target="se.scalablesolutions.akka.spring.foo.MyPojo"
timeout="10000"/>
<akka:active-object id="transactional-active-object"
target="se.scalablesolutions.akka.spring.foo.MyPojo"
timeout="2000"
transactional="true"/>
target="se.scalablesolutions.akka.spring.foo.MyPojo"
timeout="2000"
transactional="true"/>
<akka:active-object id="active-object-callbacks"
target="se.scalablesolutions.akka.spring.foo.MyPojo"
timeout="2000"
transactional="true">
<akka:restart-callbacks pre="preRestart" post="postRestart"/>
</akka:active-object>
target="se.scalablesolutions.akka.spring.foo.MyPojo"
timeout="2000"
transactional="true">
<akka:restart-callbacks pre="preRestart" post="postRestart"/>
</akka:active-object>
<akka:active-object id="remote-active-object"
target="se.scalablesolutions.akka.spring.foo.MyPojo"
timeout="2000"
transactional="true">
target="se.scalablesolutions.akka.spring.foo.MyPojo"
timeout="2000"
transactional="true">
<akka:restart-callbacks pre="preRestart" post="postRestart"/>
<akka:remote host="localhost" port="9999" />
</akka:active-object>
<akka:remote host="localhost" port="9999" />
</akka:active-object>
<akka:active-object id="remote-service1" target="se.scalablesolutions.akka.spring.foo.MyPojo" timeout="1000">
<akka:remote host="localhost" port="9999" />
<akka:remote host="localhost" port="9999" />
</akka:active-object>
<akka:supervision id="supervision1">
<akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
<akka:trap-exits>
<akka:trap-exit>java.io.IOException</akka:trap-exit>
<akka:trap-exit>java.lang.NullPointerException</akka:trap-exit>
</akka:trap-exits>
</akka:restart-strategy>
<akka:active-objects>
<akka:active-object target="se.scalablesolutions.akka.spring.foo.Foo" lifecycle="permanent" timeout="1000"/>
<akka:active-object interface="se.scalablesolutions.akka.spring.foo.IBar" target="se.scalablesolutions.akka.spring.foo.Bar" lifecycle="permanent" timeout="1000"/>
<akka:active-object target="se.scalablesolutions.akka.spring.foo.MyPojo" lifecycle="temporary" timeout="1000">
<akka:restart-callbacks pre="preRestart" post="postRestart"/>
</akka:active-object>
</akka:active-objects>
<akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
<akka:trap-exits>
<akka:trap-exit>java.io.IOException</akka:trap-exit>
<akka:trap-exit>java.lang.NullPointerException</akka:trap-exit>
</akka:trap-exits>
</akka:restart-strategy>
<akka:active-objects>
<akka:active-object target="se.scalablesolutions.akka.spring.foo.Foo" lifecycle="permanent" timeout="1000"/>
<akka:active-object interface="se.scalablesolutions.akka.spring.foo.IBar" target="se.scalablesolutions.akka.spring.foo.Bar" lifecycle="permanent" timeout="1000"/>
<akka:active-object target="se.scalablesolutions.akka.spring.foo.MyPojo" lifecycle="temporary" timeout="1000">
<akka:restart-callbacks pre="preRestart" post="postRestart"/>
</akka:active-object>
</akka:active-objects>
</akka:supervision>
<akka:supervision id="supervision2">
<akka:restart-strategy failover="AllForOne" retries="3" timerange="5000">
<akka:trap-exits>
<akka:trap-exit>java.lang.Exception</akka:trap-exit>
</akka:trap-exits>
</akka:restart-strategy>
<akka:active-objects>
<akka:active-object target="se.scalablesolutions.akka.spring.foo.StatefulPojo" lifecycle="permanent" timeout="10000" transactional="true"/>
</akka:active-objects>
<akka:restart-strategy failover="AllForOne" retries="3" timerange="5000">
<akka:trap-exits>
<akka:trap-exit>java.lang.Exception</akka:trap-exit>
</akka:trap-exits>
</akka:restart-strategy>
<akka:active-objects>
<akka:active-object target="se.scalablesolutions.akka.spring.foo.StatefulPojo" lifecycle="permanent" timeout="10000" transactional="true"/>
</akka:active-objects>
</akka:supervision>
</beans>

View file

@ -38,47 +38,47 @@ public class SpringConfigurationTest {
* can be used as a top level element.
*/
@Test
public void testParse() throws Exception {
public void testParse() throws Exception {
final Resource CONTEXT = new ClassPathResource("se/scalablesolutions/akka/spring/foo/test-config.xml");
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
reader.loadBeanDefinitions(CONTEXT);
assertTrue(beanFactory.containsBeanDefinition("simple-active-object"));
assertTrue(beanFactory.containsBeanDefinition("remote-active-object"));
assertTrue(beanFactory.containsBeanDefinition("supervision1"));
}
@Test
public void testSimpleActiveObject() {
MyPojo myPojo = (MyPojo) context.getBean("simple-active-object");
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(beanFactory);
reader.loadBeanDefinitions(CONTEXT);
assertTrue(beanFactory.containsBeanDefinition("simple-active-object"));
assertTrue(beanFactory.containsBeanDefinition("remote-active-object"));
assertTrue(beanFactory.containsBeanDefinition("supervision1"));
}
@Test
public void testSimpleActiveObject() {
MyPojo myPojo = (MyPojo) context.getBean("simple-active-object");
String msg = myPojo.getFoo();
msg += myPojo.getBar();
assertEquals("wrong invocation order", "foobar", msg);
}
}
@Test(expected=FutureTimeoutException.class)
public void testSimpleActiveObject_Timeout() {
MyPojo myPojo = (MyPojo) context.getBean("simple-active-object");
public void testSimpleActiveObject_Timeout() {
MyPojo myPojo = (MyPojo) context.getBean("simple-active-object");
myPojo.longRunning();
}
}
@Test
public void testSimpleActiveObject_NoTimeout() {
MyPojo myPojo = (MyPojo) context.getBean("simple-active-object-long-timeout");
public void testSimpleActiveObject_NoTimeout() {
MyPojo myPojo = (MyPojo) context.getBean("simple-active-object-long-timeout");
String msg = myPojo.longRunning();
assertEquals("this took long", msg);
}
}
@Test
public void testTransactionalActiveObject() {
MyPojo myPojo = (MyPojo) context.getBean("transactional-active-object");
@Test
public void testTransactionalActiveObject() {
MyPojo myPojo = (MyPojo) context.getBean("transactional-active-object");
String msg = myPojo.getFoo();
msg += myPojo.getBar();
assertEquals("wrong invocation order", "foobar", msg);
}
@Test
public void testRemoteActiveObject() {
}
@Test
public void testRemoteActiveObject() {
new Thread(new Runnable() {
public void run() {
RemoteNode.start();
@ -87,22 +87,22 @@ public class SpringConfigurationTest {
try { Thread.currentThread().sleep(1000); } catch (Exception e) {}
Config.config();
MyPojo myPojo = (MyPojo) context.getBean("remote-active-object");
MyPojo myPojo = (MyPojo) context.getBean("remote-active-object");
assertEquals("foo", myPojo.getFoo());
}
@Test
public void testSupervision() {
// get ActiveObjectConfigurator bean from spring context
ActiveObjectConfigurator myConfigurator = (ActiveObjectConfigurator) context.getBean("supervision1");
}
@Test
public void testSupervision() {
// get ActiveObjectConfigurator bean from spring context
ActiveObjectConfigurator myConfigurator = (ActiveObjectConfigurator) context.getBean("supervision1");
// get ActiveObjects
Foo foo = myConfigurator.getInstance(Foo.class);
assertNotNull(foo);
Foo foo = myConfigurator.getInstance(Foo.class);
assertNotNull(foo);
IBar bar = myConfigurator.getInstance(IBar.class);
assertNotNull(bar);
MyPojo pojo = myConfigurator.getInstance(MyPojo.class);
assertNotNull(pojo);
}
}
@Test
public void testTransactionalState() {
@ -116,5 +116,5 @@ public class SpringConfigurationTest {
assertEquals("some vector state", stateful.getVectorState());
assertEquals("some ref state", stateful.getRefState());
}
}

View file

@ -36,15 +36,15 @@ class ActiveObjectBeanDefinitionParserTest extends Spec with ShouldMatchers {
private def createTestElement : Element = {
val xml = <akka:active-object id="active-object1"
target="foo.bar.MyPojo"
timeout="1000"
target="foo.bar.MyPojo"
timeout="1000"
transactional="true"/>
dom(xml).getDocumentElement
}
private def createTestElement2 : Element = {
val xml = <akka:active-object id="active-object1"
timeout="1000"
timeout="1000"
transactional="true"/>
dom(xml).getDocumentElement
}

View file

@ -67,27 +67,27 @@ class SupervisionBeanDefinitionParserTest extends Spec with ShouldMatchers {
private def createActiveObjectElement : Element = {
val xml = <akka:active-object id="active-object1"
target="foo.bar.MyPojo"
timeout="1000"
target="foo.bar.MyPojo"
timeout="1000"
transactional="true"/>
dom(xml).getDocumentElement
}
private def createSupervisorElement : Element = {
val xml = <akka:supervision id="supervision1">
<akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
<akka:trap-exits>
<akka:trap-exit>java.io.IOException</akka:trap-exit>
<akka:trap-exit>java.lang.NullPointerException</akka:trap-exit>
</akka:trap-exits>
</akka:restart-strategy>
<akka:active-objects>
<akka:active-object target="foo.bar.Foo" lifecycle="permanent" timeout="1000"/>
<akka:active-object interface="foo.bar.IBar" target="foo.bar.Bar" lifecycle="permanent" timeout="1000"/>
<akka:active-object target="foo.bar.MyPojo" lifecycle="temporary" timeout="1000">
<akka:restart-callbacks pre="preRestart" post="postRestart"/>
</akka:active-object>
</akka:active-objects>
<akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
<akka:trap-exits>
<akka:trap-exit>java.io.IOException</akka:trap-exit>
<akka:trap-exit>java.lang.NullPointerException</akka:trap-exit>
</akka:trap-exits>
</akka:restart-strategy>
<akka:active-objects>
<akka:active-object target="foo.bar.Foo" lifecycle="permanent" timeout="1000"/>
<akka:active-object interface="foo.bar.IBar" target="foo.bar.Bar" lifecycle="permanent" timeout="1000"/>
<akka:active-object target="foo.bar.MyPojo" lifecycle="temporary" timeout="1000">
<akka:restart-callbacks pre="preRestart" post="postRestart"/>
</akka:active-object>
</akka:active-objects>
</akka:supervision>
dom(xml).getDocumentElement
}
@ -95,26 +95,26 @@ class SupervisionBeanDefinitionParserTest extends Spec with ShouldMatchers {
private def createSupervisorMissingAttribute : Element = {
val xml = <akka:supervision id="supervision1">
<akka:restart-strategy failover="AllForOne" retries="3">
<akka:trap-exits>
<akka:trap-exit>java.io.IOException</akka:trap-exit>
</akka:trap-exits>
</akka:restart-strategy>
<akka:active-objects>
<akka:active-object target="foo.bar.Foo" lifecycle="permanent" timeout="1000"/>
</akka:active-objects>
<akka:restart-strategy failover="AllForOne" retries="3">
<akka:trap-exits>
<akka:trap-exit>java.io.IOException</akka:trap-exit>
</akka:trap-exits>
</akka:restart-strategy>
<akka:active-objects>
<akka:active-object target="foo.bar.Foo" lifecycle="permanent" timeout="1000"/>
</akka:active-objects>
</akka:supervision>
dom(xml).getDocumentElement
}
private def createSupervisorMissingElement : Element = {
val xml = <akka:supervision id="supervision1">
<akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
</akka:restart-strategy>
<akka:active-objects>
<akka:active-object target="foo.bar.Foo" lifecycle="permanent" timeout="1000"/>
<akka:active-object interface="foo.bar.IBar" target="foo.bar.Bar" lifecycle="permanent" timeout="1000"/>
</akka:active-objects>
<akka:restart-strategy failover="AllForOne" retries="3" timerange="1000">
</akka:restart-strategy>
<akka:active-objects>
<akka:active-object target="foo.bar.Foo" lifecycle="permanent" timeout="1000"/>
<akka:active-object interface="foo.bar.IBar" target="foo.bar.Bar" lifecycle="permanent" timeout="1000"/>
</akka:active-objects>
</akka:supervision>
dom(xml).getDocumentElement
}