Search in sources :

Example 1 with WSMenuEntryE

use of org.talend.mdm.repository.model.mdmserverobject.WSMenuEntryE in project tmdm-studio-se by Talend.

the class NewMenuAction method newBlankMenu.

private WSMenuE newBlankMenu(String key) {
    WSMenuMenuEntriesDescriptionsE descriptions = MdmserverobjectFactory.eINSTANCE.createWSMenuMenuEntriesDescriptionsE();
    descriptions.setLabel(key);
    // $NON-NLS-1$
    descriptions.setLanguage("en");
    // 
    WSMenuEntryE entry = MdmserverobjectFactory.eINSTANCE.createWSMenuEntryE();
    entry.getDescriptions().add(descriptions);
    entry.setId(key);
    // 
    WSMenuE menu = MdmserverobjectFactory.eINSTANCE.createWSMenuE();
    menu.setName(key);
    menu.getMenuEntries().add(entry);
    // 
    return menu;
}
Also used : WSMenuMenuEntriesDescriptionsE(org.talend.mdm.repository.model.mdmserverobject.WSMenuMenuEntriesDescriptionsE) WSMenuEntryE(org.talend.mdm.repository.model.mdmserverobject.WSMenuEntryE) WSMenuE(org.talend.mdm.repository.model.mdmserverobject.WSMenuE)

Example 2 with WSMenuEntryE

use of org.talend.mdm.repository.model.mdmserverobject.WSMenuEntryE in project tmdm-studio-se by Talend.

the class Bean2EObjUtilTest method testConvertFromBean2EObj.

/**
 * Test method for {@link Bean2EObjUtil#convertFromBean2EObj(java.lang.Object)}.
 */
@Test
public void testConvertFromBean2EObj() {
    WSMenu menu = new WSMenu();
    initBean(menu);
    Bean2EObjUtil util = Bean2EObjUtil.getInstance();
    util.registerClassMap(WSMenu.class);
    EObject eObject = util.convertFromBean2EObj(menu, null);
    assertNotNull(eObject);
    WSMenuE menuE = (WSMenuE) eObject;
    // 
    assertEquals(menu.getName(), menuE.getName());
    assertEquals(menu.getDescription(), menuE.getDescription());
    // 
    List<WSMenuEntry> menuEntries = menu.getMenuEntries();
    EList<WSMenuEntryE> menuEntriesE = menuE.getMenuEntries();
    for (int i = 0; i < menuEntries.size(); i++) {
        checkMenuEntry(menuEntries.get(i), menuEntriesE.get(i));
    }
}
Also used : WSMenu(com.amalto.workbench.webservices.WSMenu) EObject(org.eclipse.emf.ecore.EObject) WSMenuE(org.talend.mdm.repository.model.mdmserverobject.WSMenuE) WSMenuEntryE(org.talend.mdm.repository.model.mdmserverobject.WSMenuEntryE) WSMenuEntry(com.amalto.workbench.webservices.WSMenuEntry) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 3 with WSMenuEntryE

use of org.talend.mdm.repository.model.mdmserverobject.WSMenuEntryE in project tmdm-studio-se by Talend.

the class Bean2EObjUtilTest method testConvertFromEObj2Bean.

@Test
public void testConvertFromEObj2Bean() {
    WSMenuE menuE = MdmserverobjectFactory.eINSTANCE.createWSMenuE();
    initEObject(menuE);
    // 
    Bean2EObjUtil util = Bean2EObjUtil.getInstance();
    util.registerClassMap(WSMenu.class);
    WSMenu menu = (WSMenu) util.convertFromEObj2Bean(menuE);
    assertNotNull(menu);
    // 
    assertEquals(menu.getName(), menuE.getName());
    assertEquals(menu.getDescription(), menuE.getDescription());
    List<WSMenuEntry> menuEntries = menu.getMenuEntries();
    EList<WSMenuEntryE> menuEntriesE = menuE.getMenuEntries();
    for (int i = 0; i < menuEntries.size(); i++) {
        checkMenuEntry(menuEntries.get(i), menuEntriesE.get(i));
    }
}
Also used : WSMenu(com.amalto.workbench.webservices.WSMenu) WSMenuE(org.talend.mdm.repository.model.mdmserverobject.WSMenuE) WSMenuEntryE(org.talend.mdm.repository.model.mdmserverobject.WSMenuEntryE) WSMenuEntry(com.amalto.workbench.webservices.WSMenuEntry) Test(org.junit.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 4 with WSMenuEntryE

use of org.talend.mdm.repository.model.mdmserverobject.WSMenuEntryE in project tmdm-studio-se by Talend.

the class Bean2EObjUtilTest method initEObject.

private void initEObject(WSMenuE menuE) {
    // $NON-NLS-1$
    menuE.setDescription("this is a description");
    // $NON-NLS-1$
    menuE.setName("menuA");
    menuE.setSystem(false);
    menuE.getMenuEntries();
    // 
    WSMenuEntryE wsMenuEntry = MdmserverobjectFactory.eINSTANCE.createWSMenuEntryE();
    // $NON-NLS-1$
    wsMenuEntry.setApplication("application A");
    // $NON-NLS-1$
    wsMenuEntry.setContext("contextA");
    // $NON-NLS-1$
    wsMenuEntry.setIcon("icon A");
    // $NON-NLS-1$
    wsMenuEntry.setId("id A");
    menuE.getMenuEntries().add(wsMenuEntry);
    // 
    wsMenuEntry = MdmserverobjectFactory.eINSTANCE.createWSMenuEntryE();
    // $NON-NLS-1$
    wsMenuEntry.setApplication("application B");
    // $NON-NLS-1$
    wsMenuEntry.setContext("contextB");
    // $NON-NLS-1$
    wsMenuEntry.setIcon("icon B");
    // wsMenuEntry.setId("id B");
    menuE.getMenuEntries().add(wsMenuEntry);
    // 
    WSMenuMenuEntriesDescriptionsE ds = MdmserverobjectFactory.eINSTANCE.createWSMenuMenuEntriesDescriptionsE();
    // $NON-NLS-1$
    ds.setLabel("Label C");
    // $NON-NLS-1$
    ds.setLanguage("En");
    wsMenuEntry.getDescriptions().add(ds);
}
Also used : WSMenuMenuEntriesDescriptionsE(org.talend.mdm.repository.model.mdmserverobject.WSMenuMenuEntriesDescriptionsE) WSMenuEntryE(org.talend.mdm.repository.model.mdmserverobject.WSMenuEntryE)

Aggregations

WSMenuEntryE (org.talend.mdm.repository.model.mdmserverobject.WSMenuEntryE)4 WSMenuE (org.talend.mdm.repository.model.mdmserverobject.WSMenuE)3 WSMenu (com.amalto.workbench.webservices.WSMenu)2 WSMenuEntry (com.amalto.workbench.webservices.WSMenuEntry)2 Test (org.junit.Test)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 WSMenuMenuEntriesDescriptionsE (org.talend.mdm.repository.model.mdmserverobject.WSMenuMenuEntriesDescriptionsE)2 EObject (org.eclipse.emf.ecore.EObject)1