Ejemplo n.º 1
0
  /**
   * Complex test (addDocument, addComponent, getRootComponent, setRootComponent, createComponent,
   * of class org.netbeans.modules.vmd.api.model.DesignDocument.
   */
  public void testComplex() {
    System.out.println(
        "addDocument, addComponent, getRootComponent, setRootComponent,"
            + // NOI18N
            " createComponent,getComponentByID"
            + "getComponentByID"); // NOI18N

    final DesignDocument instance =
        ModelTestUtil.createTestDesignDocument(ModelTestUtil.PROJECT_ID);

    instance
        .getTransactionManager()
        .writeAccess(
            new Runnable() {
              public void run() {
                DesignComponent comp1 = instance.createComponent(FirstCD.TYPEID_CLASS);
                DesignComponent comp2 = instance.createComponent(SecondCD.TYPEID_CLASS);

                // setRooComponent, addComponent
                instance.setRootComponent(comp1);
                comp1.addComponent(comp2);
                // getComponentByID
                DesignComponent resultComp2ByID =
                    instance.getComponentByUID(comp2.getComponentID());
                DesignComponent expComp2 = comp2;
                assertEquals(expComp2, resultComp2ByID);
                // setRootComponent getRootComponent
                DesignComponent expGetComp = comp1;
                DesignComponent resultGetComp = instance.getRootComponent();
                assertEquals(expGetComp, resultGetComp);
                // writeProperty to Component
                comp1.writeProperty(
                    FirstCD.PROPERTY_REFERENCE, PropertyValue.createComponentReference(comp2));
              }
            });
  }
Ejemplo n.º 2
0
 protected void setUp() throws Exception {
   document = ModelTestUtil.createTestDesignDocument();
 }