@Transactional @Rollback(true) @Test public void testUpdateWidgetInstance() throws IllegalArgumentException, IllegalAccessException, InvocationTargetException, SecurityException, NoSuchMethodException, IOException { ObjectMapper objectMapper = new ObjectMapper(); DefaultWidgetInstance defaultWidgetInstance = prepareData(objectMapper); Map<String, String> responsMap = uIService.createOrUpdateWidgetInstance(defaultWidgetInstance); Assert.isTrue( responsMap.get("widgetInstanceAction").equals("update"), "The response action should have been 'updated'"); Canvas retrievedPerishableCanvas = uIService.getCanvasByName("Perishable Goods Canvas"); List<DefaultWidgetInstance> retrievedDefaultWidgetInstances = retrievedPerishableCanvas.getWidgetInstanceList(); DefaultWidgetInstance retrievedRefaultWidgetInstance = retrievedDefaultWidgetInstances.get(0); Assert.isTrue( objectMapper .writeValueAsString(actualViewConfig) .equals(retrievedRefaultWidgetInstance.getActualViewConfig())); }
@Test @Transactional public void testHydratedCanvas() throws Exception { final Canvas canvas = this.uIService.getHydratedCanvas(300L); Assert.notNull(canvas, "Canvas Doesn't Exist for CanvasId 300"); final List<DefaultWidgetInstance> defaultWidgetInstances = canvas.getWidgetInstanceList(); Assert.notNull(defaultWidgetInstances, "DefaultWidgetInstance List for CanvasId 6 is Null"); }
@Test @Transactional public void testGetCanvasById() throws Exception { final Canvas canvas = this.uIService.getCanvasById(1L); Assert.notNull(canvas, "Canvas Doesn't Exist for CanvasId 1"); final List<DefaultWidgetInstance> defaultWidgetInstances = canvas.getWidgetInstanceList(); Assert.notNull(defaultWidgetInstances, "DefaultWidgetInstance List for CanvasId 5 is Null"); }