Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-dev] Hi, Everyone, Have some one ever use this kind of testcase.

Looks like this test case needs to be updated because it has not been ported to the new build API.  Please file a bug report and CC me on it.  In the meantime you should be able to look through how the compiler invokes the build as an example of how to use the new API or refer to the docs and discussion on the following bug:

 

148190: revisit the interface tools are expected to use to invoke the compiler

https://bugs.eclipse.org/bugs/show_bug.cgi?id=148190

 

Mik

 

From: aspectj-dev-bounces@xxxxxxxxxxx [mailto:aspectj-dev-bounces@xxxxxxxxxxx] On Behalf Of ???
Sent: Tuesday, July 24, 2007 10:57 PM
To: aspectj-dev; aspectj-users@xxxxxxxxxxx
Subject: [aspectj-dev] Hi, Everyone, Have some one ever use this kind of testcase.

 

Hi everyone:

           I am still working on to get the join point & advice relationships, and I have try what Mr. Mik Kersten that :

check out docs/sandbox/api-clients as a project

and run org.aspectj.samples/AsmRelationshipMapUsageTest 

But here comes the problem, this test case cannot be compiled, in it there is  a error during its compile. I cite the code for you:

/* *******************************************************************
 * Copyright (c) 2004 Contributors.
 * All rights reserved.
 * This program and the accompanying materials are made available
 * under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Mik Kersten     initial implementation
 * ******************************************************************/

package org.aspectj.samples;

import java.util.Iterator;
import java.util.List;

import org.aspectj.ajde.AjdeTestCase;
import org.aspectj.ajdt.internal.core.builder.AjBuildManager;
import org.aspectj.asm.*;

/**
 * Collects join point information for all advised methods and constructors. 
 *
 * @author Mik Kersten
 */
public class AsmRelationshipMapUsageTest extends AjdeTestCase {

    public void testFindAdvisedMethods() {       
        System.out.println("----------------------------------");
        System.out.println("Methods affected by advice: ");
        HierarchyWalker walker = new HierarchyWalker() {
            public void preProcess(IProgramElement node) {
                if (node.getKind().equals(IProgramElement.Kind.METHOD)) {
                    List relations = AsmManager.getDefault().getRelationshipMap().get(node);
                    if (relations != null) {
                     for (Iterator it = relations.iterator(); it.hasNext(); ) {
                         IRelationship relationship = (IRelationship)it.next();
                         if ( relationship.getKind().equals(IRelationship.Kind.ADVICE)) {
                             System.out.println(
                                     "method: " + node.toString()
                                     + ", advised by: " + relationship.getTargets());
                         }
                     }
                    }
                }
            }
        };
        AsmManager.getDefault().getHierarchy().getRoot().walk(walker);
    }
   
    public void testListFilesAffectedByInterTypeDecs() {
        System.out.println("----------------------------------");
        System.out.println("Files affected by inter type declarations: ");
        HierarchyWalker walker = new HierarchyWalker() {
            public void preProcess(IProgramElement node) {
                if (node.getKind().equals(IProgramElement.Kind.CLASS)) {
                    List relations = AsmManager.getDefault().getRelationshipMap().get(node);
                    System.out.println("haha");
                    if (relations != null) {
                     for (Iterator it = relations.iterator (); it.hasNext(); ) {
                         IRelationship relationship = (IRelationship)it.next();
                         if (relationship.getKind().equals(IRelationship.Kind.DECLARE_INTER_TYPE)) {
                             System.out.println(
                                    "file: " + node.getSourceLocation().getSourceFile().getName()
                                    + ", declared on by: " + relationship.getTargets ());
                         }
                     }
                    }
                }
            }
        };
        AsmManager.getDefault().getHierarchy().getRoot().walk(walker);
    }
   
 
 protected void setUp() throws Exception {
     super.setUp();
  assertTrue("build success",  doSynchronousBuild("../examples/spacewar/spacewar/debug.lst")); 
 }
}

The red code I have emphasized has an error, there is no doSynchronousBuild Method ever exist. Not in the class AsmRelationshipMapUsageTest nor its father class AjdeTestCase.

 

Has someone have ever run this test case, and would some one tell me how to run its test case. Thank you very much and May you all happy days.

 

Thank you and wait for your reply.

 

Sincerely

Zhong Xian Gu


 


Back to the top