Examples of SchemaVersion


Examples of com.opengamma.integration.tool.portfolio.xml.SchemaVersion

  /**
   * Creates an instance.
   */
  public PortfolioConversionV1_0() {
    super(new SchemaVersion("1.0"), PortfolioDocumentV1_0.class, new PortfolioDocumentConverterV1_0(), new IdRefResolverFactoryV1_0());
  }
View Full Code Here

Examples of com.opengamma.integration.tool.portfolio.xml.SchemaVersion

  }

  @Test
  public void testNoSchemaFoundInEmptyDirectory() throws IOException {
    FilesystemPortfolioSchemaLocator locator = new FilesystemPortfolioSchemaLocator(createEmptySchemaLocation());
    assertNull(locator.lookupSchema(new SchemaVersion("1.0")));
  }
View Full Code Here

Examples of com.opengamma.integration.tool.portfolio.xml.SchemaVersion

  @Test
  public void testMatchingSchemaFoundInDirectory() throws IOException {
    FilesystemPortfolioSchemaLocator locator = new FilesystemPortfolioSchemaLocator(
        createSchemaLocationWithVersions("1.0", "1.1", "2.0"));
    assertNotNull(locator.lookupSchema(new SchemaVersion("1.0")));
    assertNotNull(locator.lookupSchema(new SchemaVersion("1.1")));
    assertNotNull(locator.lookupSchema(new SchemaVersion("2.0")));
  }
View Full Code Here

Examples of com.opengamma.integration.tool.portfolio.xml.SchemaVersion

  @Test
  public void testNoSchemaFoundInDirectory() throws IOException {
    FilesystemPortfolioSchemaLocator locator = new FilesystemPortfolioSchemaLocator(
        createSchemaLocationWithVersions("1.0", "1.1", "2.0"));
    assertNull(locator.lookupSchema(new SchemaVersion("1.2")));
    assertNull(locator.lookupSchema(new SchemaVersion("2.1")));
    assertNull(locator.lookupSchema(new SchemaVersion("3.0")));
  }
View Full Code Here

Examples of com.opengamma.integration.tool.portfolio.xml.SchemaVersion

@Test(groups = TestGroup.UNIT)
public class SchemaVersionTest {

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNullVersionIsNotAllowed() {
    new SchemaVersion(null);
  }
View Full Code Here

Examples of com.opengamma.integration.tool.portfolio.xml.SchemaVersion

    new SchemaVersion(null);
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testNonNumericVersionIsNotAllowed() {
    new SchemaVersion("1.a");
  }
View Full Code Here

Examples of com.opengamma.integration.tool.portfolio.xml.SchemaVersion

    new SchemaVersion("1.a");
  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testTrailingNonNumericIsNotAllowed() {
    new SchemaVersion("1.4a");
  }
View Full Code Here

Examples of com.sonymobile.backlogtool.dbupdate.SchemaVersion

    /**
     * Checks for schema updates and applies them in order.
     */
    private void updateDatabaseSchema() {

        SchemaVersion schemaVersion = null;
        Session session = sessionFactory.openSession();
        Transaction tx = null;
        try {
            tx = session.beginTransaction();
            Query query = session.createQuery("from SchemaVersion");
            Object result = query.uniqueResult();
            if (result instanceof SchemaVersion) {
                schemaVersion = (SchemaVersion) result;
            }
            else {
                //The table SchemaVersion did not exist; create new
                schemaVersion = new SchemaVersion();
                session.save(schemaVersion);
            }

            //Scans for all classes annotated with @DbUpdate
            ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(true);
            scanner.addIncludeFilter(new AnnotationTypeFilter(DbUpdate.class));
            List<DbUpdater> updateList = new ArrayList<DbUpdater>();
            for (BeanDefinition bd : scanner.findCandidateComponents("com.sonymobile.backlogtool.dbupdate")) {
                try {
                    DbUpdater updater = (DbUpdater) Class.forName(bd.getBeanClassName()).newInstance();
                    updateList.add(updater);

                } catch (ClassNotFoundException e) {
                    e.printStackTrace();
                } catch (InstantiationException e) {
                    e.printStackTrace();
                } catch (IllegalAccessException e) {
                    e.printStackTrace();
                }
            }
            //Attempt to run all updates in order
            Collections.sort(updateList);
            for (DbUpdater updater : updateList) {
                if (updater.getFromVersion() == schemaVersion.getVersion()) {
                    boolean success = updater.update(sessionFactory);
                    String updateName = updater.getClass().getSimpleName();
                    if (success) {
                        System.out.println("Ran schema update " + updateName);
                        System.out.println("New schema version " + updater.getToVersion());
                        schemaVersion.setVersion(updater.getToVersion());
                    } else {
                        System.out.println("Failed to make schema update " + updateName);
                    }
                }
            }
View Full Code Here

Examples of net.raymanoz.domain.SchemaVersion

 
  public String summary(){
    StringBuilder builder = new StringBuilder();
    LOG.info(configuration.getMigrationMessage());

    SchemaVersion ver = version();
    logAndAppend(builder, STARTUP_STATUS_MESSAGE_FMT, ver.getDBVersion(), ver.getPatchNo());
    scriptsToBeApplied = 0;
    long totalScripts = 0;
    for (ScriptList scriptlist: scripts()){
      totalScripts += scriptlist.size();
      long thisToApplied = helper.scriptsToBeApplied(ver, scriptlist);
View Full Code Here

Examples of net.raymanoz.domain.SchemaVersion

 
  boolean migrate(Script script){
    if (alreadyMigrated(script)) return true;
    final long thisPatchNo = script.getPatch();
    final long thisDBver = script.getDBVersion();
    SchemaVersion version = version();
    repository.validateNoOtherActivity(thisDBver, thisPatchNo);
    scriptIdx++;
    logAndSendStatus(ScriptStatus.STARTED, script);
    repository.recordStartPatch(script);
    ScriptStatus status = script.execute(interactionStrategy);
    repository.recordFinishPatch(script, status);
   
    logAndSendStatus(status, script);
    version.setDBVersion(thisDBver);
    version.setPatchNo(thisPatchNo);
    switch (status){
      case COMPLETED:
        scriptsApplied++;
        return true;
      case SKIPPED:
View Full Code Here
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.