Search in sources :

Example 1 with NoEepromDefinition

use of com.thecoderscorner.menu.editorui.generator.parameters.eeprom.NoEepromDefinition 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());
}
Also used : Path(java.nio.file.Path) MenuTree(com.thecoderscorner.menu.domain.state.MenuTree) NoEepromDefinition(com.thecoderscorner.menu.editorui.generator.parameters.eeprom.NoEepromDefinition) CreatorProperty(com.thecoderscorner.menu.editorui.generator.core.CreatorProperty) CodeGeneratorOptionsBuilder(com.thecoderscorner.menu.editorui.generator.CodeGeneratorOptionsBuilder) AlwaysApplicable(com.thecoderscorner.menu.editorui.generator.applicability.AlwaysApplicable) NoAuthenticatorDefinition(com.thecoderscorner.menu.editorui.generator.parameters.auth.NoAuthenticatorDefinition) IoExpanderDefinitionCollection(com.thecoderscorner.menu.editorui.generator.parameters.IoExpanderDefinitionCollection) Test(org.junit.jupiter.api.Test)

Aggregations

MenuTree (com.thecoderscorner.menu.domain.state.MenuTree)1 CodeGeneratorOptionsBuilder (com.thecoderscorner.menu.editorui.generator.CodeGeneratorOptionsBuilder)1 AlwaysApplicable (com.thecoderscorner.menu.editorui.generator.applicability.AlwaysApplicable)1 CreatorProperty (com.thecoderscorner.menu.editorui.generator.core.CreatorProperty)1 IoExpanderDefinitionCollection (com.thecoderscorner.menu.editorui.generator.parameters.IoExpanderDefinitionCollection)1 NoAuthenticatorDefinition (com.thecoderscorner.menu.editorui.generator.parameters.auth.NoAuthenticatorDefinition)1 NoEepromDefinition (com.thecoderscorner.menu.editorui.generator.parameters.eeprom.NoEepromDefinition)1 Path (java.nio.file.Path)1 Test (org.junit.jupiter.api.Test)1