package org.jboss.capedwarf.tck;

import java.lang.reflect.Method;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.log.LogService;
import com.google.appengine.tck.base.ServicesLifecycle;
import org.kohsuke.MetaInfServices;

/**
 * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
 */
@MetaInfServices
public class CapeDwarfServicesLifecycle implements ServicesLifecycle {
    public <T> void before(T service) {
    }

    public <T> void after(T service) {
        if (service instanceof DatastoreService) {
            invoke(service, "clearCache");
        } else if (service instanceof LogService) {
            invoke(service, "clearLog");
        }
    }

    protected void invoke(Object service, String method) {
        final Class<?> clazz = service.getClass();
        try {
            Method clearLog = clazz.getMethod(method);
            clearLog.invoke(service);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}

@@ -857,24 +857,17 @@
  Method 
-clearLog
+m
  = clazz
@@ -898,24 +898,52 @@
         
-clearLog
+m.setAccessible(true);%0A            m
 .invoke(

Set accessible.