Package com.opengamma.master.security

Examples of com.opengamma.master.security.ManageableSecurity


    _secMaster.add(doc);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_add_addWithMissingExternalIdBundleProperty() {
    ManageableSecurity security = mock(ManageableSecurity.class);
    when(security.getSecurityType()).thenReturn("MANAGEABLE");
    when(security.getName()).thenReturn("Test");
    SecurityDocument doc = new SecurityDocument(security);
    _secMaster.add(doc);
  }
View Full Code Here


    _secMaster.add(doc);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_add_addWithMissingTypeProperty() {
    ManageableSecurity security = mock(ManageableSecurity.class);
    when(security.getName()).thenReturn("Test");
    when(security.getExternalIdBundle()).thenReturn(ExternalIdBundle.of("A", "B"));
    SecurityDocument doc = new SecurityDocument(security);
    _secMaster.add(doc);
  }
View Full Code Here

    _secMaster.add(doc);
  }

  @Test
  public void test_add_addWithMinimalProperties() {
    ManageableSecurity security = new ManageableSecurity();
    SecurityDocument doc = new SecurityDocument(security);
    _secMaster.add(doc);
  }
View Full Code Here

   * @param security the security to store, not null
   * @return the identifier bundle, not null
   */
  public final ExternalIdBundle storeSecurity(final ManageableSecurity security) {
    ArgumentChecker.notNull(security, "security");
    final ManageableSecurity clone = JodaBeanUtils.clone(security);
    clone.setUniqueId(null);
    clone.setExternalIdBundle(clone.getExternalIdBundle().withoutScheme(getScheme()));
    ExternalIdBundle identifiers = _securities.get(clone);
    if (identifiers != null) {
      return identifiers;
    }
    final ExternalId guid = ExternalId.of(getScheme(), createGuid());
View Full Code Here

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_update_noSecurityId() {
    UniqueId uniqueId = UniqueId.of("DbSec", "101");
    ManageableSecurity security = new ManageableSecurity(uniqueId, "Name", "Type", ExternalIdBundle.of("A", "B"));
    SecurityDocument doc = new SecurityDocument();
    doc.setSecurity(security);
    _secMaster.update(doc);
  }
View Full Code Here

  }

  @Test(expectedExceptions = DataNotFoundException.class)
  public void test_update_notFound() {
    UniqueId uniqueId = UniqueId.of("DbSec", "0", "0");
    ManageableSecurity security = new ManageableSecurity(uniqueId, "Name", "Type", ExternalIdBundle.of("A", "B"));
    SecurityDocument doc = new SecurityDocument(security);
    _secMaster.update(doc);
  }
View Full Code Here

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void test_update_notLatestVersion() {
    UniqueId uniqueId = UniqueId.of("DbSec", "201", "0");
    ManageableSecurity security = new ManageableSecurity(uniqueId, "Name", "Type", ExternalIdBundle.of("A", "B"));
    SecurityDocument doc = new SecurityDocument(security);
    _secMaster.update(doc);
  }
View Full Code Here

  public void test_update_getUpdateGet() {
    Instant now = Instant.now(_secMaster.getClock());
   
    UniqueId uniqueId = UniqueId.of("DbSec", "101", "0");
    SecurityDocument base = _secMaster.get(uniqueId);
    ManageableSecurity security = new ManageableSecurity(uniqueId, "Name", "Type", ExternalIdBundle.of("A", "B"));
    SecurityDocument input = new SecurityDocument(security);
   
    SecurityDocument updated = _secMaster.update(input);
    assertEquals(false, base.getUniqueId().equals(updated.getUniqueId()));
    assertEquals(now, updated.getVersionFromInstant());
View Full Code Here

  public void test_update_rollback() {
    DbSecurityMaster w = new DbSecurityMaster(_secMaster.getDbConnector());
    w.setElSqlBundle(ElSqlBundle.of(new ElSqlConfig("TestRollback"), DbSecurityMaster.class));
    final SecurityDocument base = _secMaster.get(UniqueId.of("DbSec", "101", "0"));
    UniqueId uniqueId = UniqueId.of("DbSec", "101", "0");
    ManageableSecurity security = new ManageableSecurity(uniqueId, "Name", "Type", ExternalIdBundle.of("A", "B"));
    SecurityDocument input = new SecurityDocument(security);
    try {
      w.update(input);
      Assert.fail();
    } catch (BadSqlGrammarException ex) {
View Full Code Here

      if (fieldData == null) {
        _logger.warn("No reference data for {} cannot be null", securityDes);
        continue;
      }
      // get field data
      ManageableSecurity security = createSecurity(fieldData);
      if (security != null) {
        result.put(securityDes, security);
      }
    }
    return result;
View Full Code Here

TOP

Related Classes of com.opengamma.master.security.ManageableSecurity

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.