Package org.hibernate.tool.hbmlint.detector

Examples of org.hibernate.tool.hbmlint.detector.SchemaByMetaDataDetector


    return new HbmLint(
      new Detector[] {
          new BadCachingDetector(),
          new InstrumentationDetector(),
          new ShadowedIdentifierDetector(),
          new SchemaByMetaDataDetector()
      });
   
  }
View Full Code Here


  public void testSchemaAnalyzer() {
    Configuration configuration = new Configuration();
    addMappings( getMappings(), configuration );
    configuration.buildMappings();
 
    SchemaByMetaDataDetector analyzer = new SchemaByMetaDataDetector();
    ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder()
      .applySettings( configuration.getProperties() )
      .build();
    analyzer.initialize( configuration, configuration.buildSettings(serviceRegistry) );
   
    Iterator tableMappings = configuration.getTableMappings();
   
   
    while ( tableMappings.hasNext() ) {
      Table table = (Table) tableMappings.next();
   
      MockCollector mc = new MockCollector();
     
      if(table.getName().equalsIgnoreCase( "missingtable" )) {
        analyzer.visit( configuration, table, mc );       
        assertEquals(mc.problems.size(),1);
        Issue ap = (Issue) mc.problems.get( 0 );
        assertTrue(ap.getDescription().indexOf( "Missing table" ) >=0);
      } else if(table.getName().equalsIgnoreCase( "category" )) {
        analyzer.visit( configuration, table, mc );
        assertEquals(mc.problems.size(),1);
        Issue ap = (Issue) mc.problems.get( 0 );
        assertTrue(ap.getDescription().indexOf( "missing column: name" ) >=0);             
      } else if(table.getName().equalsIgnoreCase( "badtype" )) {
        analyzer.visit( configuration, table, mc );
        assertEquals(mc.problems.size(),1);
        Issue ap = (Issue) mc.problems.get( 0 );
        assertTrue(ap.getDescription().indexOf( "wrong column type for name" ) >=0);
      } else {
        fail("Unkown table " + table);
      }
    }
   
    MockCollector mc = new MockCollector();
    analyzer.visitGenerators( configuration, mc );
    assertEquals(1,mc.problems.size());
    Issue issue = (Issue) mc.problems.get( 0 );
    assertTrue(issue.getDescription().indexOf( "hibernate_unique_key" ) >=0);
   
  }
View Full Code Here

    return new HbmLint(
      new Detector[] {
          new BadCachingDetector(),
          new InstrumentationDetector(),
          new ShadowedIdentifierDetector(),
          new SchemaByMetaDataDetector()
      });
   
  }
View Full Code Here

    return new HbmLint(
      new Detector[] {
          new BadCachingDetector(),
          new InstrumentationDetector(),
          new ShadowedIdentifierDetector(),
          new SchemaByMetaDataDetector()
      });
   
  }
View Full Code Here

TOP

Related Classes of org.hibernate.tool.hbmlint.detector.SchemaByMetaDataDetector

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.