Package com.opengamma.livedata.entitlement

Source Code of com.opengamma.livedata.entitlement.DistributedEntitlementCheckerTest

/**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.livedata.entitlement;

import org.testng.annotations.Test;

import com.opengamma.id.ExternalId;
import com.opengamma.livedata.LiveDataSpecification;
import com.opengamma.livedata.UserPrincipal;
import com.opengamma.livedata.client.DistributedEntitlementChecker;
import com.opengamma.transport.ByteArrayFudgeRequestSender;
import com.opengamma.transport.FudgeRequestDispatcher;
import com.opengamma.transport.InMemoryByteArrayRequestConduit;
import com.opengamma.util.test.TestGroup;

/**
* Integration test between {@link DistributedEntitlementChecker} and {@link EntitlementServer}.
*/
@Test(groups = TestGroup.UNIT)
public class DistributedEntitlementCheckerTest {

  public void testRequestResponse() {
    PermissiveLiveDataEntitlementChecker delegate = new PermissiveLiveDataEntitlementChecker();
    EntitlementServer server = new EntitlementServer(delegate);
   
    FudgeRequestDispatcher fudgeRequestDispatcher = new FudgeRequestDispatcher(server);
    InMemoryByteArrayRequestConduit inMemoryByteArrayRequestConduit = new InMemoryByteArrayRequestConduit(fudgeRequestDispatcher);
    ByteArrayFudgeRequestSender fudgeRequestSender = new ByteArrayFudgeRequestSender(inMemoryByteArrayRequestConduit);

    DistributedEntitlementChecker client = new DistributedEntitlementChecker(fudgeRequestSender);

    LiveDataSpecification testSpec = new LiveDataSpecification(
        "TestNormalization",
        ExternalId.of("test1", "test1"));
    UserPrincipal megan = new UserPrincipal("megan", "127.0.0.1");

    // TODO reenable test once entitlement checking has been reimplemented correctly
    //assertTrue(client.isEntitled(megan, testSpec));
  }

}
TOP

Related Classes of com.opengamma.livedata.entitlement.DistributedEntitlementCheckerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.