Skip to content

Commit 72e1e2c

Browse files
committed
rework maven plugin. improve ecore genmodel deps.
- Add includeGenModelInJar parameter for saving GenModel to resources - Fix cross-package reference handling by including all packages in GenModel - Delete generated files for referenced packages after generation - Create GenPackages from Ecore annotations when loading from JARs Signed-off-by: Stefan Bischof <[email protected]>
1 parent c23e018 commit 72e1e2c

File tree

14 files changed

+697
-427
lines changed

14 files changed

+697
-427
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright (c) 2025 Contributors to the Eclipse Foundation.
3+
*
4+
* This program and the accompanying materials are made
5+
* available under the terms of the Eclipse Public License 2.0
6+
* which is available at https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*/
10+
package org.eclipse.daanse.example.catalog;
11+
12+
import static org.junit.jupiter.api.Assertions.assertEquals;
13+
import static org.junit.jupiter.api.Assertions.assertNotNull;
14+
15+
import java.math.BigDecimal;
16+
17+
import org.junit.jupiter.api.Test;
18+
19+
class CatalogModelTest {
20+
21+
@Test
22+
void testPackageInitialized() {
23+
assertNotNull(CatalogPackage.eINSTANCE);
24+
assertNotNull(CatalogFactory.eINSTANCE);
25+
}
26+
27+
@Test
28+
void testCreateCatalog() {
29+
Catalog catalog = CatalogFactory.eINSTANCE.createCatalog();
30+
catalog.setName("Main Catalog");
31+
assertEquals("Main Catalog", catalog.getName());
32+
}
33+
34+
@Test
35+
void testCreateProduct() {
36+
Product product = CatalogFactory.eINSTANCE.createProduct();
37+
product.setName("Widget");
38+
product.setPrice(new BigDecimal("9.99"));
39+
assertEquals("Widget", product.getName());
40+
assertEquals(new BigDecimal("9.99"), product.getPrice());
41+
}
42+
}

emf/codegen.maven.example/ecore.copyright/model/vehicle.ecore

Lines changed: 0 additions & 17 deletions
This file was deleted.

emf/codegen.maven.example/ecore.copyright/pom.xml

Lines changed: 0 additions & 107 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright (c) 2025 Contributors to the Eclipse Foundation.
3+
*
4+
* This program and the accompanying materials are made
5+
* available under the terms of the Eclipse Public License 2.0
6+
* which is available at https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*/
10+
package org.eclipse.daanse.example.extended;
11+
12+
import static org.junit.jupiter.api.Assertions.assertEquals;
13+
import static org.junit.jupiter.api.Assertions.assertNotNull;
14+
15+
import org.junit.jupiter.api.Test;
16+
17+
class ExtendedModelTest {
18+
19+
@Test
20+
void testPackageInitialized() {
21+
assertNotNull(ExtendedPackage.eINSTANCE);
22+
assertNotNull(ExtendedFactory.eINSTANCE);
23+
}
24+
25+
@Test
26+
void testCreateEmployee() {
27+
Employee employee = ExtendedFactory.eINSTANCE.createEmployee();
28+
employee.setName("Jane");
29+
employee.setEmployeeId("E123");
30+
assertEquals("Jane", employee.getName());
31+
assertEquals("E123", employee.getEmployeeId());
32+
}
33+
34+
@Test
35+
void testCreateCompany() {
36+
Company company = ExtendedFactory.eINSTANCE.createCompany();
37+
company.setName("Acme Corp");
38+
assertEquals("Acme Corp", company.getName());
39+
}
40+
}

emf/codegen.maven.example/ecore.fileext/model/config.ecore

Lines changed: 0 additions & 20 deletions
This file was deleted.

emf/codegen.maven.example/ecore.fileext/pom.xml

Lines changed: 0 additions & 105 deletions
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2025 Contributors to the Eclipse Foundation.
3+
*
4+
* This program and the accompanying materials are made
5+
* available under the terms of the Eclipse Public License 2.0
6+
* which is available at https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*/
10+
package org.eclipse.daanse.example.simple;
11+
12+
import static org.junit.jupiter.api.Assertions.assertEquals;
13+
import static org.junit.jupiter.api.Assertions.assertNotNull;
14+
15+
import org.junit.jupiter.api.Test;
16+
17+
class SimpleModelTest {
18+
19+
@Test
20+
void testPackageInitialized() {
21+
assertNotNull(SimplePackage.eINSTANCE);
22+
assertNotNull(SimpleFactory.eINSTANCE);
23+
}
24+
25+
@Test
26+
void testCreateItem() {
27+
Item item = SimpleFactory.eINSTANCE.createItem();
28+
item.setName("Test Item");
29+
assertEquals("Test Item", item.getName());
30+
}
31+
32+
@Test
33+
void testCreateContainer() {
34+
Container container = SimpleFactory.eINSTANCE.createContainer();
35+
container.setLabel("Box");
36+
assertEquals("Box", container.getLabel());
37+
}
38+
}

0 commit comments

Comments
 (0)