// Path: server/src/main/java/com/threerings/nexus/distrib/Action.java
// public abstract class Action<E>
// {
//     /** A variant of {@link Action} that can be used when you know that the action will not cross
//      * server boundaries. This allows things to be referenced from the enclosing scope <em>when
//      * that is known to be thread safe</em>. Remember that actions likely execute in a different
//      * thread context than the one from which they were initiated, so one must be careful not to
//      * use things from an enclosing scope that will cause race conditions. */
//     public static abstract class Local<E> extends Action<E> {
//     }
// 
//     /**
//      * Called with the requested entity on the thread appropriate for said entity.
//      */
//     public abstract void invoke (E entity);
// 
//     /**
//      * Called if the action could not be processed due to the target entity being not found. Note:
//      * this only occurs for keyed entities, not singleton entities. Note also that this method will
//      * be called in no execution context, which means that one must either perform only thread-safe
//      * operations in the body of this method, or one must dispatch a new action to process the
//      * failure. The default implementation simply logs a warning.
//      *
//      * @param nexus a reference to the nexus for convenient dispatch of a new action.
//      * @param eclass the class of the entity that could not be found.
//      * @param key the key of the entity that could not be found.
//      */
//     public void onDropped (Nexus nexus, Class<?> eclass, Comparable<?> key) {
//         log.warning("Dropping action on unknown entity", "eclass", eclass.getName(), "key", key,
//                     "action", this);
//     }
// }
// 
// Path: core/src/main/java/com/threerings/nexus/distrib/DValue.java
// public class DValue<T> extends react.Value<T> implements DAttribute
// {
//     /**
//      * Creates a new attribute with the specified owner and initial value.
//      */
//     public static <T> DValue<T> create (NexusObject owner, T value) {
//         return new DValue<T>(owner, value);
//     }
// 
//     @Override public void readContents (Streamable.Input in) {
//         _value = in.<T>readValue();
//     }
// 
//     @Override public void writeContents (Streamable.Output out) {
//         out.writeValue(_value);
//     }
// 
//     protected DValue (NexusObject owner, T value) {
//         super(value);
//         _owner = owner;
//         _index = owner.registerAttr(this);
//     }
// 
//     @Override protected void emitChange (T value, T oldValue) {
//         // we don't call super as we defer notification until the event is dispatched
//         ChangeEvent<T> event = new ChangeEvent<T>(_owner.getId(), _index, value);
//         event.oldValue = oldValue;
//         _owner.postEvent(event);
//     }
// 
//     protected void applyChange (T value, T oldValue) {
//         if (oldValue == DistribUtil.<T>sentinelValue()) {
//             // we came in over the network: read our old value and update _value
//             oldValue = updateLocal(value);
//         } // else: we were initiated in this JVM: _value was already updated
//         notifyChange(value, oldValue);
//     }
// 
//     /** An event emitted when a value changes. */
//     protected static class ChangeEvent<T> extends DAttribute.Event {
//         public T oldValue = DistribUtil.<T>sentinelValue();
// 
//         public ChangeEvent (int targetId, short index, T value) {
//             super(targetId, index);
//             _value = value;
//         }
// 
//         @Override public void applyTo (NexusObject target) {
//             target.<DValue<T>>getAttribute(this.index).applyChange(_value, oldValue);
//         }
// 
//         @Override protected void toString (StringBuilder buf) {
//             super.toString(buf);
//             buf.append(", value=").append(_value);
//         }
// 
//         protected final T _value;
//     }
// 
//     /** The object that owns this attribute. */
//     protected final NexusObject _owner;
// 
//     /** The index of this attribute in its containing object. */
//     protected final short _index;
// }
// 
// Path: test-support/src/main/java/com/threerings/nexus/distrib/TestObject.java
// public class TestObject extends NexusObject
//     implements Singleton
// {
//     public final DValue<String> value = DValue.create(this, "test");
// 
//     public final DService<TestService> testsvc;
// 
//     public TestObject (DService.Factory<TestService> testsvc) {
//         this.testsvc = testsvc.createService(this);
//     }
// }
// 
// Path: core/src/main/java/com/threerings/nexus/util/Log.java
// public static Logger log = new JavaLogger("nexus");


import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.threerings.nexus.distrib.Action;
import com.threerings.nexus.distrib.DValue;
import com.threerings.nexus.distrib.TestObject;
import org.junit.*;
import static org.junit.Assert.*;
import static com.threerings.nexus.util.Log.log;
//
// Nexus JVMServer - server-side support for Nexus java.nio-based services
// http://github.com/threerings/nexus/blob/master/LICENSE

package com.threerings.nexus.server;





/**
 * Tests basic Nexus server functionality.
 */
public class SimpleServerTest
{
    @Before
    public void suppressLogging () {
// Path: server/src/main/java/com/threerings/nexus/distrib/Action.java
// public abstract class Action<E>
// {
//     /** A variant of {@link Action} that can be used when you know that the action will not cross
//      * server boundaries. This allows things to be referenced from the enclosing scope <em>when
//      * that is known to be thread safe</em>. Remember that actions likely execute in a different
//      * thread context than the one from which they were initiated, so one must be careful not to
//      * use things from an enclosing scope that will cause race conditions. */
//     public static abstract class Local<E> extends Action<E> {
//     }
// 
//     /**
//      * Called with the requested entity on the thread appropriate for said entity.
//      */
//     public abstract void invoke (E entity);
// 
//     /**
//      * Called if the action could not be processed due to the target entity being not found. Note:
//      * this only occurs for keyed entities, not singleton entities. Note also that this method will
//      * be called in no execution context, which means that one must either perform only thread-safe
//      * operations in the body of this method, or one must dispatch a new action to process the
//      * failure. The default implementation simply logs a warning.
//      *
//      * @param nexus a reference to the nexus for convenient dispatch of a new action.
//      * @param eclass the class of the entity that could not be found.
//      * @param key the key of the entity that could not be found.
//      */
//     public void onDropped (Nexus nexus, Class<?> eclass, Comparable<?> key) {
//         log.warning("Dropping action on unknown entity", "eclass", eclass.getName(), "key", key,
//                     "action", this);
//     }
// }
// 
// Path: core/src/main/java/com/threerings/nexus/distrib/DValue.java
// public class DValue<T> extends react.Value<T> implements DAttribute
// {
//     /**
//      * Creates a new attribute with the specified owner and initial value.
//      */
//     public static <T> DValue<T> create (NexusObject owner, T value) {
//         return new DValue<T>(owner, value);
//     }
// 
//     @Override public void readContents (Streamable.Input in) {
//         _value = in.<T>readValue();
//     }
// 
//     @Override public void writeContents (Streamable.Output out) {
//         out.writeValue(_value);
//     }
// 
//     protected DValue (NexusObject owner, T value) {
//         super(value);
//         _owner = owner;
//         _index = owner.registerAttr(this);
//     }
// 
//     @Override protected void emitChange (T value, T oldValue) {
//         // we don't call super as we defer notification until the event is dispatched
//         ChangeEvent<T> event = new ChangeEvent<T>(_owner.getId(), _index, value);
//         event.oldValue = oldValue;
//         _owner.postEvent(event);
//     }
// 
//     protected void applyChange (T value, T oldValue) {
//         if (oldValue == DistribUtil.<T>sentinelValue()) {
//             // we came in over the network: read our old value and update _value
//             oldValue = updateLocal(value);
//         } // else: we were initiated in this JVM: _value was already updated
//         notifyChange(value, oldValue);
//     }
// 
//     /** An event emitted when a value changes. */
//     protected static class ChangeEvent<T> extends DAttribute.Event {
//         public T oldValue = DistribUtil.<T>sentinelValue();
// 
//         public ChangeEvent (int targetId, short index, T value) {
//             super(targetId, index);
//             _value = value;
//         }
// 
//         @Override public void applyTo (NexusObject target) {
//             target.<DValue<T>>getAttribute(this.index).applyChange(_value, oldValue);
//         }
// 
//         @Override protected void toString (StringBuilder buf) {
//             super.toString(buf);
//             buf.append(", value=").append(_value);
//         }
// 
//         protected final T _value;
//     }
// 
//     /** The object that owns this attribute. */
//     protected final NexusObject _owner;
// 
//     /** The index of this attribute in its containing object. */
//     protected final short _index;
// }
// 
// Path: test-support/src/main/java/com/threerings/nexus/distrib/TestObject.java
// public class TestObject extends NexusObject
//     implements Singleton
// {
//     public final DValue<String> value = DValue.create(this, "test");
// 
//     public final DService<TestService> testsvc;
// 
//     public TestObject (DService.Factory<TestService> testsvc) {
//         this.testsvc = testsvc.createService(this);
//     }
// }
// 
// Path: core/src/main/java/com/threerings/nexus/util/Log.java
// public static Logger log = new JavaLogger("nexus");


// Path: jvm-server/src/test/java/com/threerings/nexus/server/SimpleServerTest.java
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.threerings.nexus.distrib.Action;
import com.threerings.nexus.distrib.DValue;
import com.threerings.nexus.distrib.TestObject;
import org.junit.*;
import static org.junit.Assert.*;
import static com.threerings.nexus.util.Log.log;

//
// Nexus JVMServer - server-side support for Nexus java.nio-based services
// http://github.com/threerings/nexus/blob/master/LICENSE

package com.threerings.nexus.server;





/**
 * Tests basic Nexus server functionality.
 */
public class SimpleServerTest
{
    @Before
    public void suppressLogging () {
        log.setWarnOnly(true);