use of com.thecoderscorner.menu.editorui.generator.core.CreatorProperty in project tcMenu by davetcc.
the class FileBasedProjectPersistorTest method testSaveThenLoad.
@Test
public void testSaveThenLoad() throws IOException {
Path projFile = dir.resolve("projectSave.emf");
FileBasedProjectPersistor persistor = new FileBasedProjectPersistor();
MenuTree tree = TestUtils.buildCompleteTree();
List<String> remoteUuids = List.of("uuid3");
List<CreatorProperty> propsList = Collections.singletonList(new CreatorProperty("name", "desc", "extra desc", "123", DISPLAY, CreatorProperty.PropType.USE_IN_DEFINE, CannedPropertyValidators.textValidator(), new AlwaysApplicable()));
var options = new CodeGeneratorOptionsBuilder().withPlatform(ARDUINO_AVR.getBoardId()).withDisplay("uuid1").withInput("uuid2").withTheme("uuid4").withRemotes(remoteUuids).withProperties(propsList).withAppName("app name").withNewId(APPLICATION_UUID).withEepromDefinition(new NoEepromDefinition()).withAuthenticationDefinition(new NoAuthenticatorDefinition()).withExpanderDefinitions(new IoExpanderDefinitionCollection()).codeOptions();
persistor.save(projFile.toString(), "", tree, options);
MenuTreeWithCodeOptions openResult = persistor.open(projFile.toString());
compareTrees(tree, openResult.getMenuTree());
assertEquals(ARDUINO_AVR.getBoardId(), openResult.getOptions().getEmbeddedPlatform());
assertEquals("uuid1", openResult.getOptions().getLastDisplayUuid());
assertEquals("uuid2", openResult.getOptions().getLastInputUuid());
assertEquals("uuid3", openResult.getOptions().getLastRemoteCapabilitiesUuids().get(0));
assertEquals("app name", openResult.getOptions().getApplicationName());
assertEquals("app name", openResult.getOptions().getApplicationName());
assertEquals(APPLICATION_UUID, openResult.getOptions().getApplicationUUID());
List<CreatorProperty> returnedProps = openResult.getOptions().getLastProperties();
assertEquals("123", returnedProps.get(0).getLatestValue());
assertEquals("name", returnedProps.get(0).getName());
assertEquals(DISPLAY, returnedProps.get(0).getSubsystem());
}
use of com.thecoderscorner.menu.editorui.generator.core.CreatorProperty in project tcMenu by davetcc.
the class TestUtils method findAndCheckProperty.
public static CreatorProperty findAndCheckProperty(CodePluginItem creator, String name, SubSystem subSystem, CreatorProperty.PropType type, String newVal) {
CreatorProperty prop = creator.getProperties().stream().filter(p -> p.getName().equals(name)).findFirst().orElse(null);
assertNotNull(prop);
assertEquals(subSystem, prop.getSubsystem());
assertEquals(type, prop.getPropType());
prop.setLatestValue(newVal);
assertEquals(newVal, prop.getLatestValue());
return prop;
}
Aggregations