コード例 #1
0
 @Test
 @Transactional
 @Rollback(true)
 public void testCreateCanvas() throws Exception {
   uIService.saveWidget(widget);
   canvas = new Canvas("testCanvas");
   canvas.setCanvasType(CanvasType.PRIVATE);
   canvas.setCanvasLayout(uIService.getCanvasLayoutById(1L));
   canvas.setShortName("testCanvas");
   canvas.setCreatedByUserName("createdByUserName");
   canvas.setCreatedDateTime(new Date());
   canvas.setWidgetInstanceList(widgetInstanceList);
   uIService.saveCanvas(canvas);
   Canvas retrivedCanvas = uIService.getCanvasByName(canvas.getName());
   Assert.notNull(retrivedCanvas);
 }
コード例 #2
0
  /**
   * @Author Adarsh kumar
   *
   * <p>testCanvasPersistedAndDeletion() provide the functionality of deletion of the canvas based
   * on the canvasId or canvasName in this test case new canvas is inserted and then deleted by the
   * uiService for testing.
   *
   * @throws Exception
   */
  @Test
  @Rollback(value = true)
  @Transactional
  public void testCanvasPersistedAndDeletion() throws Exception {

    /* CREATING NEW CANVAS FOR TESTING PURPOSE */
    this.uIService.saveWidget(widget);
    final Canvas canvasNew = new Canvas("testCanvas");
    canvasNew.setCanvasType(CanvasType.PRIVATE);
    canvasNew.setCanvasLayout(uIService.getCanvasLayoutById(1L));
    canvasNew.setShortName("testCanvas");
    canvasNew.setCreatedByUserName("createdByUserName");
    canvasNew.setCreatedDateTime(new Date());
    canvasNew.setWidgetInstanceList(widgetInstanceList);
    final Long canvasId = this.uIService.saveCanvas(canvasNew);
    Assert.notNull(canvasId, "Canvas Isn't Persisted into database " + canvasId);

    /* DELETING THE CANVAS FROM DATABASE BASED ON ID   */
    final Boolean result = this.uIService.deleteCanvasById(canvasNew.getCanvasId());
    Assert.isTrue(result, "Canvas Isn't deleted from database");
  }