hlship 2004/07/21 06:32:14
Modified: framework/src/test/hivemind/test/services
TestBuilderFactory.java
framework/src/java/org/apache/hivemind/test
RegexpArgumentsMatcher.java
framework/src/descriptor/META-INF hivemodule.sdl
Added: framework/src/test/hivemind/test/services
SetObjectFixture.java AutowireService.sdl
SetObject.sdl
framework/src/test/hivemind/test/services/impl
SetObjectFixtureImpl.java
Log:
HIVEMIND-25: Fix a mistake in the BuilderFactory's set-object element, and
add integration tests.
Revision Changes Path
1.13 +26 -4
jakarta-hivemind/framework/src/test/hivemind/test/services/TestBuilderFactory.java
Index: TestBuilderFactory.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/test/hivemind/test/services/TestBuilderFactory.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- TestBuilderFactory.java 20 Jul 2004 17:26:25 -0000 1.12
+++ TestBuilderFactory.java 21 Jul 2004 13:32:14 -0000 1.13
@@ -282,7 +282,7 @@
MockControl mc = newControl(Module.class);
Module module = (Module) mc.getMock();
- MockControl lc = newControl(Log.class);
+ MockControl lc = newControl(Log.class);
Log log = (Log) lc.getMock();
BuilderParameter parameter = new BuilderParameter();
@@ -295,9 +295,9 @@
module.getService(StringHolder.class);
mc.setReturnValue(h);
- log.isDebugEnabled();
- lc.setReturnValue(false);
-
+ log.isDebugEnabled();
+ lc.setReturnValue(false);
+
replayControls();
parameter.setClassName(ServiceAutowireTarget.class.getName());
@@ -355,4 +355,26 @@
verifyControls();
}
+
+ public void testSetObject() throws Exception
+ {
+ Registry r = buildFrameworkRegistry("SetObject.sdl");
+
+ SetObjectFixture f = (SetObjectFixture)
r.getService(SetObjectFixture.class);
+
+ assertNotNull(f.getClassFactory1());
+ assertSame(f.getClassFactory1(), f.getClassFactory2());
+ }
+
+ public void testAutowireService() throws Exception
+ {
+ Registry r = buildFrameworkRegistry("AutowireService.sdl");
+
+ SetObjectFixture f = (SetObjectFixture)
r.getService(SetObjectFixture.class);
+
+ assertNotNull(f.getClassFactory1());
+ assertSame(f.getClassFactory1(), f.getClassFactory2());
+ }
+
+
}
1.1
jakarta-hivemind/framework/src/test/hivemind/test/services/SetObjectFixture.java
Index: SetObjectFixture.java
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package hivemind.test.services;
import org.apache.hivemind.service.ClassFactory;
/**
* Used to test the BuilderFactory's set-object element.
*
* @author Howard Lewis Ship
*/
public interface SetObjectFixture
{
public ClassFactory getClassFactory1();
public ClassFactory getClassFactory2();
}
1.1
jakarta-hivemind/framework/src/test/hivemind/test/services/AutowireService.sdl
Index: AutowireService.sdl
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
module (id=hivemind.test.services version="1.0.0")
{
service-point (id=AutowireService
interface=hivemind.test.services.SetObjectFixture)
{
invoke-factory (service-id=hivemind.BuilderFactory)
{
// Should wire up the classFactory1 and classFactory2 properties
// to hivemind.ClassFactory anyway!
construct (class=hivemind.test.services.impl.SetObjectFixtureImpl)
}
}
}
1.1
jakarta-hivemind/framework/src/test/hivemind/test/services/SetObject.sdl
Index: SetObject.sdl
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
module (id=hivemind.test.services version="1.0.0")
{
service-point (id=SestObject
interface=hivemind.test.services.SetObjectFixture)
{
invoke-factory (service-id=hivemind.BuilderFactory)
{
construct (class=hivemind.test.services.impl.SetObjectFixtureImpl)
{
set-object (property=classFactory1
value=service:hivemind.ClassFactory)
set-object (property=classFactory2
value=service:hivemind.ClassFactory)
}
}
}
}
1.2 +14 -0
jakarta-hivemind/framework/src/java/org/apache/hivemind/test/RegexpArgumentsMatcher.java
Index: RegexpArgumentsMatcher.java
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/test/RegexpArgumentsMatcher.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RegexpArgumentsMatcher.java 20 Jul 2004 17:26:25 -0000 1.1
+++ RegexpArgumentsMatcher.java 21 Jul 2004 13:32:14 -0000 1.2
@@ -1,3 +1,17 @@
+// Copyright 2004 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
package org.apache.hivemind.test;
import org.apache.hivemind.ApplicationRuntimeException;
1.18 +1 -1
jakarta-hivemind/framework/src/descriptor/META-INF/hivemodule.sdl
Index: hivemodule.sdl
===================================================================
RCS file:
/home/cvs/jakarta-hivemind/framework/src/descriptor/META-INF/hivemodule.sdl,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- hivemodule.sdl 19 Jul 2004 14:07:35 -0000 1.17
+++ hivemodule.sdl 21 Jul 2004 13:32:14 -0000 1.18
@@ -471,7 +471,7 @@
{
create-object
(class=org.apache.hivemind.service.impl.BuilderPropertyFacet)
read-attribute
(property=propertyName attribute=property)
- read-attribute
(property=attributeValue attribute=value)
+ read-attribute (property=value
attribute=value)
invoke-parent
(method=addProperty depth=6)
}
}
1.1
jakarta-hivemind/framework/src/test/hivemind/test/services/impl/SetObjectFixtureImpl.java
Index: SetObjectFixtureImpl.java
===================================================================
// Copyright 2004 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package hivemind.test.services.impl;
import org.apache.hivemind.service.ClassFactory;
import hivemind.test.services.SetObjectFixture;
/**
* Used to test the BuilderFactory's set-object element.
*
* @author Howard Lewis Ship
*/
public class SetObjectFixtureImpl implements SetObjectFixture
{
private ClassFactory _classFactory1;
private ClassFactory _classFactory2;
public ClassFactory getClassFactory1()
{
return _classFactory1;
}
public ClassFactory getClassFactory2()
{
return _classFactory2;
}
public void setClassFactory1(ClassFactory factory)
{
_classFactory1 = factory;
}
public void setClassFactory2(ClassFactory factory)
{
_classFactory2 = factory;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]