Skip to content

Conversation

carter-cundiff
Copy link
Collaborator

@carter-cundiff carter-cundiff commented Dec 13, 2024

All the changes generator classes are an update to use the new Fermenter functionality for getting the metadata repository from the generation context. This is to avoid harcdoding our Metamodel Repository class name in, which was preventing downstream projects from extending foundation-mda.
Old way:

AIOpsModelInstanceRepostory metamodelRepository = ModelInstanceRepositoryManager
                .getMetamodelRepository(AIOpsModelInstanceRepostory.class);

New way:

AissembleModelInstanceRepository metamodelRepository = (AissembleModelInstanceRepository) 
               context.getModelInstanceRepository();

Note in some metamodel classes (ex: RecordFieldTypeElement.java) we don't have access to the generation context as it hasn't been created yet, so we instead have to use the Fermenter ModelInstanceRepositoryManager with new functionality for handling class extensions: Fermenter PR

Unit test files of interest:

<version.buildnumber.plugin>3.2.1</version.buildnumber.plugin>
<version.failsafe.plugin>${version.maven.surefire.plugin}</version.failsafe.plugin>
<version.fermenter>2.10.3</version.fermenter>
<version.fermenter>2.10.5</version.fermenter>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I: This version of fermenter will be released prior to merging

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


@Given("a pipeline with metamodel extensions")
public void a_pipeline_with_metamodel_extensions() {
this.modelSource = new File("src/test/resources/models/model-extension.jar");
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I: This jar file contains a pipeline with the new extension field.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Is this jar file typically generated by Maven?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We're using it to mimic what maven would be providing the plugin in an actual execution

@carter-cundiff carter-cundiff force-pushed the 495-extending-foundation-mda branch 2 times, most recently from c7415e5 to af7ae0b Compare December 13, 2024 15:11

Scenario Outline: Foundation-mda metamodel elements are extendable
Given a class extending the "<type>" metamodel with new simple and complex fields
When the "<profile>" profile is generated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A: This feels like it has the potential to clash and the profiles we've selected feel a little arbitrary. It's extra coverage so I'm OK leaving it, but I'd also be OK with just making this "When the extended models are read in" or something to that effect.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I added it was cause the error itself occurs when the generators are run, so felt like the tests we insufficient if we didn't include them.

@carter-cundiff carter-cundiff force-pushed the 495-extending-foundation-mda branch from af7ae0b to ec74d6a Compare December 13, 2024 18:33
@carter-cundiff carter-cundiff force-pushed the 495-extending-foundation-mda branch from ec74d6a to 5bcef20 Compare December 13, 2024 20:19
@carter-cundiff carter-cundiff merged commit 911f9b8 into dev Dec 13, 2024
3 checks passed
@carter-cundiff carter-cundiff deleted the 495-extending-foundation-mda branch December 13, 2024 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Add functionality for extending foundation-mda so that I can modify existing metamodel schemas in a downstream project

4 participants