use of com.enonic.xp.macro.MacroDescriptors in project xp by enonic.
the class MacroDescriptorServiceTest method testGetByApplications.
@Test
public void testGetByApplications() throws Exception {
final MacroDescriptors result = this.service.getByApplications(ApplicationKeys.from("myapp1", "myapp2", ApplicationKey.SYSTEM.getName()));
assertNotNull(result);
assertEquals(4, result.getSize());
}
use of com.enonic.xp.macro.MacroDescriptors in project xp by enonic.
the class ApplicationInfoServiceImplTest method testMacros.
@Test
public void testMacros() {
mockMacros(this.applicationKey);
final MacroDescriptors macros = this.service.getMacroDescriptors(this.applicationKey);
assertEquals(macros.getSize(), 2);
}
use of com.enonic.xp.macro.MacroDescriptors in project xp by enonic.
the class ApplicationInfoServiceImplTest method mockMacros.
private void mockMacros(final ApplicationKey applicationKey) {
final MacroDescriptor macroDescriptor1 = MacroDescriptor.create().key(MacroKey.from("my-app1:macro1")).description("my description").displayName("A macro").form(Form.create().build()).build();
final MacroDescriptor macroDescriptor2 = MacroDescriptor.create().key(MacroKey.from("my-app2:macro2")).description("my description").displayName("B macro").form(Form.create().build()).build();
final MacroDescriptors macroDescriptors = MacroDescriptors.from(macroDescriptor1, macroDescriptor2);
Mockito.when(this.macroDescriptorService.getByApplications(ApplicationKeys.from(applicationKey, ApplicationKey.SYSTEM))).thenReturn(macroDescriptors);
}
use of com.enonic.xp.macro.MacroDescriptors in project xp by enonic.
the class MacroDescriptorServiceImpl method getAll.
@Override
public MacroDescriptors getAll() {
final Set<MacroDescriptor> set = new LinkedHashSet<>(builtinMacrosDescriptors.getAll().getSet());
for (final Application application : this.applicationService.getInstalledApplications()) {
final MacroDescriptors macroDescriptors = getByApplication(application.getKey());
set.addAll(macroDescriptors.getSet());
}
return MacroDescriptors.from(set);
}
use of com.enonic.xp.macro.MacroDescriptors in project xp by enonic.
the class MacroDescriptorServiceTest method testGetBySystemApplication.
@Test
public void testGetBySystemApplication() throws Exception {
final MacroDescriptors result = this.service.getByApplication(ApplicationKey.SYSTEM);
assertNotNull(result);
assertEquals(2, result.getSize());
}
Aggregations