1 package org.apache.turbine.modules.actions;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 import static org.junit.Assert.assertNotNull;
24
25 import org.apache.fulcrum.factory.FactoryService;
26 import org.apache.turbine.annotation.TurbineService;
27 import org.apache.turbine.pipeline.PipelineData;
28 import org.apache.turbine.services.rundata.RunDataService;
29 import org.apache.velocity.context.Context;
30
31
32
33
34
35 public class VelocityActionWithServiceInjection extends VelocityAction
36 {
37
38 @TurbineService( RunDataService.SERVICE_NAME )
39 private RunDataService runDataService;
40
41
42 @TurbineService
43 private RunDataService runDataService2;
44
45
46 @TurbineService
47 private FactoryService factory;
48
49
50
51
52
53
54
55
56 @Override
57 public void doPerform(PipelineData pipelineData, Context context) throws Exception
58 {
59 log.debug("Calling doPerform(PipelineData)");
60 assertNotNull("runDataService object was Null.", runDataService);
61 log.debug("Injected service is " + runDataService.getName());
62 assertNotNull("runDataService2 object was Null.", runDataService2);
63 log.debug("Injected service is " + runDataService2.getName());
64 assertNotNull("factory object was Null.", factory);
65 log.debug("Injected service is " + factory.getClass());
66 }
67 }