コード例 #1
0
  /** @throws Exception */
  @Test
  public void testCompositeId() throws Exception {
    EntityMeta entityMeta = entityMetaFactory.getEntityMeta(Bbb.class);
    ServiceModelFactoryImpl serviceModelFactory =
        new ServiceModelFactoryImpl("aaa.bbb", "Service", namesModelFactory, true, "jdbcManager");
    ServiceModel serviceModel = serviceModelFactory.getServiceModel(entityMeta);
    assertNotNull(serviceModel);
    assertEquals("aaa.bbb", serviceModel.getPackageName());
    assertEquals("ServiceModelFactoryImplTest$BbbService", serviceModel.getShortClassName());
    assertEquals(2, serviceModel.getIdPropertyMetaList().size());
    assertEquals("jdbcManager", serviceModel.getJdbcManagerName());
    assertFalse(serviceModel.isJdbcManagerSetterNecessary());

    assertEquals(4, serviceModel.getImportNameSet().size());
    Iterator<String> iterator = serviceModel.getImportNameSet().iterator();
    assertEquals(Date.class.getCanonicalName(), iterator.next());
    assertEquals(List.class.getCanonicalName(), iterator.next());
    assertEquals(Generated.class.getCanonicalName(), iterator.next());
    assertEquals(Bbb.class.getCanonicalName(), iterator.next());

    assertEquals(2, serviceModel.getStaticImportNameSet().size());
    iterator = serviceModel.getStaticImportNameSet().iterator();
    assertEquals("aaa.ccc.ServiceModelFactoryImplTest$BbbNames.*", iterator.next());
    assertEquals(Operations.class.getCanonicalName() + ".*", iterator.next());
  }
コード例 #2
0
 /** @throws Exception */
 @Before
 public void setUp() throws Exception {
   PersistenceConvention pc = new PersistenceConventionImpl();
   ColumnMetaFactoryImpl cmf = new ColumnMetaFactoryImpl();
   cmf.setPersistenceConvention(pc);
   PropertyMetaFactoryImpl propertyMetaFactory = new PropertyMetaFactoryImpl();
   propertyMetaFactory.setPersistenceConvention(pc);
   propertyMetaFactory.setColumnMetaFactory(cmf);
   TableMetaFactoryImpl tmf = new TableMetaFactoryImpl();
   tmf.setPersistenceConvention(pc);
   entityMetaFactory = new EntityMetaFactoryImpl();
   entityMetaFactory.setPersistenceConvention(pc);
   entityMetaFactory.setPropertyMetaFactory(propertyMetaFactory);
   entityMetaFactory.setTableMetaFactory(tmf);
   namesModelFactory = new NamesModelFactoryImpl("aaa.ccc", "Names");
 }