/**
 * 
 */
package org.commcare.util.mocks;

import org.commcare.suite.model.StackFrameStep;
import org.commcare.util.CommCarePlatform;
import org.commcare.util.CommCareSession;
import org.javarosa.core.model.condition.EvaluationContext;

/**
 * Extends a generic CommCare session to include context about the
 * current runtime environment
 * 
 * @author ctsims
 *
 */
public class SessionWrapper extends CommCareSession {
    
    MockUserDataSandbox mSandbox;
    CommCarePlatform mPlatform;
    
    public SessionWrapper(CommCarePlatform platform, MockUserDataSandbox sandbox) {
        super(platform);
        this.mSandbox = sandbox;
        this.mPlatform = platform;
    }
    
    
    /**
     * @return The evaluation context for the current state.
     */
    public EvaluationContext getEvaluationContext() {
        return getEvaluationContext(getIIF());
    }
    
    /**
     * @param commandId The id of the command to evaluate against
     * @return The evaluation context relevant for the provided command id 
     */
    public EvaluationContext getEvaluationContext(String commandId) {
        return getEvaluationContext(getIIF(), commandId);
    }
    
    CommCareInstanceInitializer initializer;
    public CommCareInstanceInitializer getIIF() {
        if(initializer == null) {
            initializer = new CommCareInstanceInitializer(this, mSandbox, mPlatform);
        } 
        
        return initializer;
    }
}

@@ -39,16 +39,70 @@
 mocks;%0A%0A
+import org.commcare.api.interfaces.UserDataInterface;%0A
 import o
@@ -481,28 +481,24 @@
    %0A    
-Mock
 UserData
 Sandbox 
@@ -489,23 +489,25 @@
 UserData
-Sandbox
+Interface
  mSandbo
@@ -603,20 +603,16 @@
 rm, 
-Mock
 UserData
 Sand
@@ -607,23 +607,25 @@
 UserData
-Sandbox
+Interface
  sandbox

use UserDatabaseInterface