Dear Wiki user, You have subscribed to a wiki page or wiki category on "Hadoop Wiki" for change notification.
The "HowToUseInjectionFramework" page has been changed by KonstantinBoudnik. http://wiki.apache.org/hadoop/HowToUseInjectionFramework?action=diff&rev1=4&rev2=5 -------------------------------------------------- * The join point {{{pointcut callReceivepacket()}}} which servers as an identification mark of a specific point (in control and/or data flow) in the life of an application. - * A call to the advice - {{{before () throws IOException : callReceivepacket()}}} - will be injected (see [#alltogether Putting It All Together]) before that specific spot of the application's code. + * A call to the advice - {{{before () throws IOException : callReceivepacket()}}} - will be injected (see ''Putting It All Together'' below) before that specific spot of the application's code. The pointcut identifies an invocation of class' {{{java.io.OutputStream write()}}} method with any number of parameters and any return type. This invoke should take place within the body of method {{{receivepacket()}}} from class {{{BlockReceiver}}}. The method can have any parameters and any return type. Possible invocations of {{{write()}}} method happening anywhere within the aspect {{{BlockReceiverAspects}}} or its heirs will be ignored. '''Note 1''': This short example doesn't illustrate the fact that you can have more than a single injection point per class. In such a case the names of the faults have to be different if a developer wants to trigger them separately. - '''Note 2''': After the injection step (see [#alltogether Putting It All Together] you can verify that the faults were properly injected by searching for {{{ajc}}} keywords in a disassembled class file. + '''Note 2''': After the injection step (see ''Putting It All Together'' below) you can verify that the faults were properly injected by searching for {{{ajc}}} keywords in a disassembled class file. ==== Fault Naming Convention and Namespaces ==== For the sake of a unified naming convention the following two types of names are recommended for a new aspects development: @@ -116, +116 @@ * IntelliJ IDEA provides AspectJ weaver and Spring-AOP plugins <a name="alltogether"> + + ==== Putting It All Together ==== Faults (aspects) have to injected (or woven) together before they can be used. Follow these instructions: @@ -172, +174 @@ import org.junit.Test; import org.junit.Before; - import junit.framework.TestCase; + import org.junit.After; - public class DemoFiTest extends TestCase { + public class DemoFiTest { public static final String BLOCK_RECEIVER_FAULT="hdfs.datanode.BlockReceiver"; @Override @Before
