Package com.opengamma.livedata

Examples of com.opengamma.livedata.UserPrincipal


    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));
  }
View Full Code Here


   
    FixedDistributionSpecificationResolver resolver = new FixedDistributionSpecificationResolver(fixes);
   
    LiveDataEntitlementChecker userEntitlementChecker = new UserEntitlementChecker(userManager, resolver);
   
    UserPrincipal john = new UserPrincipal("john", "127.0.0.1");
   
    AssertJUnit.assertTrue(userEntitlementChecker.isEntitled(john, aaplOnBloomberg.getFullyQualifiedLiveDataSpecification()));
    AssertJUnit.assertTrue(userEntitlementChecker.isEntitled(john, aaplOnBloombergWithNormalization.getFullyQualifiedLiveDataSpecification()));
    AssertJUnit.assertTrue(userEntitlementChecker.isEntitled(john, bondOnBloomberg.getFullyQualifiedLiveDataSpecification()));
    AssertJUnit.assertFalse(userEntitlementChecker.isEntitled(john, bondOnBloombergWithNormalization.getFullyQualifiedLiveDataSpecification()));
    AssertJUnit.assertFalse(userEntitlementChecker.isEntitled(john, fxOnBloomberg.getFullyQualifiedLiveDataSpecification()));
    AssertJUnit.assertFalse(userEntitlementChecker.isEntitled(john, fxOnBloombergWithNormalization.getFullyQualifiedLiveDataSpecification()));
   
    // non-existent user
    UserPrincipal mike = new UserPrincipal("mike", "127.0.0.1");
    AssertJUnit.assertFalse(userEntitlementChecker.isEntitled(mike, aaplOnBloomberg.getFullyQualifiedLiveDataSpecification()));
    AssertJUnit.assertFalse(userEntitlementChecker.isEntitled(mike, fxOnBloomberg.getFullyQualifiedLiveDataSpecification()));
   
    // bogus spec
    AssertJUnit.assertFalse(userEntitlementChecker.isEntitled(john,
View Full Code Here

    final DefaultCompiledFunctionResolver functions = new DefaultCompiledFunctionResolver(context, rules);
    functions.compileRules();
    builder.setFunctionResolver(functions);
    builder.setFunctionExclusionGroups(_builderContext.getFunctionExclusionGroups());
    // TODO this isn't used. is this OK?
    final UserPrincipal marketDataUser = UserPrincipal.getLocalUser();
    final MarketDataProviderResolver resolver = _builderContext.getMarketDataProviderResolver();
    List<MarketDataSpecification> marketData = properties.getMarketData();
    if (marketData == null || marketData.isEmpty()) {
      marketData = Collections.<MarketDataSpecification>singletonList(MarketData.live());
    }
View Full Code Here

    assertTrue(_server.unsubscribe(nonpersistent));
    assertTrue(_server.unsubscribe(persistent));
  }

  public void subscribeUnsubscribeC() {
    UserPrincipal user = new UserPrincipal("mark", "1.1.1.1");

    LiveDataSpecification requestedSpec = new LiveDataSpecification(
        StandardRules.getNoNormalization().getId(),
        ExternalId.of(_domain, "testsub"));
View Full Code Here

    assertEquals(requestedSpec.getIdentifiers().toString(), response.getResponses().get(0).getTickDistributionSpecification());
    assertEquals(null, response.getResponses().get(0).getUserMessage());
  }

  public void snapshot() {
    UserPrincipal user = new UserPrincipal("mark", "1.1.1.1");

    LiveDataSpecification requestedSpec = new LiveDataSpecification(
        StandardRules.getNoNormalization().getId(),
        ExternalId.of(_domain, "testsub"));
View Full Code Here

  @Override
  protected void handleSubscriptionRequest(Collection<SubscriptionHandle> subHandles) {
    ArgumentChecker.notEmpty(subHandles, "Subscription handle collection");
   
    // Determine common user and subscription type
    UserPrincipal user = null;
    SubscriptionType type = null;
   
    ArrayList<LiveDataSpecification> specs = new ArrayList<>();
    for (SubscriptionHandle subHandle : subHandles) {

      // TODO - as a LiveDataSpec is immutable, why do we copy rather than just use it?
      specs.add(new LiveDataSpecification(subHandle.getRequestedSpecification()));
     
      if (user == null) {
        user = subHandle.getUser();
      } else if (!user.equals(subHandle.getUser())) {
        throw new OpenGammaRuntimeException("Not all usernames are equal");       
      }
     
      if (type == null) {
        type = subHandle.getSubscriptionType();
View Full Code Here

  private MarketDataManager _manager;

  @BeforeMethod
  public void setUp() throws Exception {
    _manager = new MarketDataManager(createChangeListener(), createResolver(), null, null);
    _manager.createSnapshotManagerForCycle(new UserPrincipal("bloggs", "127.0.0.1"),
                                           ImmutableList.of(new MarketDataSpecification()));
  }
View Full Code Here

    ArgumentChecker.notNull(commandLine, "commandLine");
    ArgumentChecker.notNull(toolContext, "toolContext");
   
    String portfolioName = trimToNull(commandLine.getOptionValue(PORTFOLIO_NAME_OPT));
    String userOption = trimToNull(commandLine.getOptionValue(USER_OPT));
    UserPrincipal user = null;
    if (userOption == null) {
      user = DEFAULT_USER;
    } else {
      Matcher matcher = USER_OR_HISTORICAL_PATTERN.matcher(userOption);
      if (matcher.matches()) {
        String username = matcher.group(1);
        String ipaddress = matcher.group(2);
        user = new UserPrincipal(username, ipaddress);
      } else {
        throw new OpenGammaRuntimeException("Given user option [" + userOption + "] does not match expected format username/ipaddress");
      }
    }
   
View Full Code Here

    final PortfolioTreeTableModel treeTableModel = new PortfolioTreeTableModel();
    return treeTableModel;
  }

  protected void startViewer(final ViewProcessor viewProcessor) {
    final UserPrincipal user = UserPrincipal.getLocalUser();
    final ViewClient viewClient = viewProcessor.createViewClient(user);
    final PortfolioTreeTableModel treeTableModel = buildTreeTableModel();
    viewClient.setResultListener(treeTableModel);
    viewClient.attachToViewProcess(viewProcessor.getConfigSource().getSingle(ViewDefinition.class, "Equity Portfolio View", VersionCorrection.LATEST).getUniqueId(),
        ExecutionOptions.infinite(MarketData.live()));
View Full Code Here

        try {
          ipAddress = InetAddress.getLocalHost().getHostAddress();
        } catch (final UnknownHostException e) {
          ipAddress = "unknown";
        }
        return new UserPrincipal("MarketDataSnapshotterTool", ipAddress);
      }

      @Override
      public void viewDefinitionCompiled(final CompiledViewDefinition compiledViewDefinition, final boolean hasMarketDataPermissions) {
      }
View Full Code Here

TOP

Related Classes of com.opengamma.livedata.UserPrincipal

Copyright © 2018 www.massapicom. 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.