本文整理汇总了Java中org.eclipse.emf.ecore.util.EcoreUtil.Copier.get方法的典型用法代码示例。如果您正苦于以下问题:Java Copier.get方法的具体用法?Java Copier.get怎么用?Java Copier.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.ecore.util.EcoreUtil.Copier
的用法示例。
在下文中一共展示了Copier.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initLocationEObject
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void initLocationEObject() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
final List<EObject> eObjects = new ArrayList<EObject>(copier.copyAll(AnydslPackage.eINSTANCE
.eContents()));
copier.copyReferences();
final EClass producerEClass = (EClass)copier.get(AnydslPackage.eINSTANCE.getProducer());
final Resource resource = createResource("test.xmi");
resource.getContents().addAll(eObjects);
container.setResource(resource);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
final IEObjectLocation location = new TestEObjectLocation();
location.setContainer(container);
final TestEObjectContainerConnector testEObjectContainerConnector = new TestEObjectContainerConnector();
MappingUtils.getConnectorRegistry().register(testEObjectContainerConnector);
final EObjectConnector eObjectConnector = new EObjectConnector();
MappingUtils.getConnectorRegistry().register(eObjectConnector);
super.initLocation(container, location, producerEClass);
final Object element = eObjectConnector.getElement(location);
assertTrue(element instanceof EObject);
assertEquals(producerEClass, element);
assertNull(location.getFeatureName());
MappingUtils.getConnectorRegistry().unregister(testEObjectContainerConnector);
MappingUtils.getConnectorRegistry().unregister(eObjectConnector);
}
示例2: initLocationSetting
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void initLocationSetting() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
final List<EObject> eObjects = new ArrayList<EObject>(copier.copyAll(AnydslPackage.eINSTANCE
.eContents()));
copier.copyReferences();
final EClass producerEClass = (EClass)copier.get(AnydslPackage.eINSTANCE.getProducer());
final Resource resource = createResource("test.xmi");
resource.getContents().addAll(eObjects);
container.setResource(resource);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
final IEObjectLocation location = new TestEObjectLocation();
location.setContainer(container);
final TestEObjectContainerConnector testEObjectContainerConnector = new TestEObjectContainerConnector();
MappingUtils.getConnectorRegistry().register(testEObjectContainerConnector);
final EObjectConnector eObjectConnector = new EObjectConnector();
MappingUtils.getConnectorRegistry().register(eObjectConnector);
super.initLocation(container, location, ((InternalEObject)producerEClass).eSetting(
EcorePackage.eINSTANCE.getENamedElement_Name()));
final Object element = eObjectConnector.getElement(location);
assertTrue(element instanceof Setting);
assertEquals(producerEClass, ((Setting)element).getEObject());
assertEquals(EcorePackage.eINSTANCE.getENamedElement_Name(), ((Setting)element)
.getEStructuralFeature());
assertEquals("Producer", ((Setting)element).get(true));
assertEquals(EcorePackage.eINSTANCE.getENamedElement_Name().getName(), location.getFeatureName());
MappingUtils.getConnectorRegistry().unregister(testEObjectContainerConnector);
MappingUtils.getConnectorRegistry().unregister(eObjectConnector);
}
示例3: getLocationEObject
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void getLocationEObject() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
final List<EObject> eObjects = new ArrayList<EObject>(copier.copyAll(AnydslPackage.eINSTANCE
.eContents()));
copier.copyReferences();
final EClass producerEClass = (EClass)copier.get(AnydslPackage.eINSTANCE.getProducer());
final Resource resource = createResource("test.xmi");
resource.getContents().addAll(eObjects);
container.setResource(resource);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
final IEObjectLocation location = new TestEObjectLocation();
location.setContainer(container);
container.getContents().add(location);
final TestEObjectContainerConnector connector = new TestEObjectContainerConnector();
MappingUtils.getConnectorRegistry().register(connector);
super.initLocation(container, location, producerEClass);
assertEquals(location, super.getLocation(container, producerEClass));
assertEquals(null, super.getLocation(container, ((InternalEObject)producerEClass).eSetting(
EcorePackage.eINSTANCE.getENamedElement_Name())));
MappingUtils.getConnectorRegistry().unregister(connector);
}
示例4: getLocationSetting
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void getLocationSetting() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
final List<EObject> eObjects = new ArrayList<EObject>(copier.copyAll(AnydslPackage.eINSTANCE
.eContents()));
final EClass producerEClass = (EClass)copier.get(AnydslPackage.eINSTANCE.getProducer());
copier.copyReferences();
final Resource resource = createResource("test.xmi");
resource.getContents().addAll(eObjects);
container.setResource(resource);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
final IEObjectLocation location = new TestEObjectLocation();
location.setContainer(container);
container.getContents().add(location);
final TestEObjectContainerConnector connector = new TestEObjectContainerConnector();
MappingUtils.getConnectorRegistry().register(connector);
super.initLocation(container, location, ((InternalEObject)producerEClass).eSetting(
EcorePackage.eINSTANCE.getENamedElement_Name()));
assertEquals(null, super.getLocation(container, producerEClass));
assertEquals(location, super.getLocation(container, ((InternalEObject)producerEClass).eSetting(
EcorePackage.eINSTANCE.getENamedElement_Name())));
MappingUtils.getConnectorRegistry().unregister(connector);
}
示例5: updateEObjects
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjects() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(IEObjectLocation.class,
new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
copier.copyReferences();
final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
final Resource initialResource = createResource("initialResource");
container.setResource(initialResource);
initialResource.getContents().addAll(testEObjects);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
final IEObjectLocation location = createEObjectLocation(copier, container);
final EObject expectedEObject = copier.get(original[0]);
final EStructuralFeature expectedFeature = (EStructuralFeature)original[1];
final Object expectedValue;
if (original[2] instanceof EObject) {
expectedValue = copier.get(original[2]);
} else {
expectedValue = original[2];
}
List<EObject> newEObjects = testEObjects;
final Resource newResource = createResource("newResource");
newResource.getContents().addAll(newEObjects);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
container.setResource(newResource);
assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
示例6: updateEObjectsPlusShift
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsPlusShift() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(IEObjectLocation.class,
new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
copier.copyReferences();
final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
final Resource initialResource = createResource("initialResource");
container.setResource(initialResource);
initialResource.getContents().addAll(testEObjects);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
final IEObjectLocation location = createEObjectLocation(copier, container);
final EObject expectedEObject = copier.get(original[0]);
final EStructuralFeature expectedFeature = (EStructuralFeature)original[1];
final Object expectedValue;
if (original[2] instanceof EObject) {
expectedValue = copier.get(original[2]);
} else {
expectedValue = original[2];
}
List<EObject> newEObjects = new ArrayList<EObject>(MappingPackage.eINSTANCE.getEClassifiers());
newEObjects.addAll(testEObjects);
final Resource newResource = createResource("newResource");
newResource.getContents().addAll(newEObjects);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
container.setResource(newResource);
assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
示例7: updateEObjectsMinusShift
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsMinusShift() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(IEObjectLocation.class,
new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
copier.copyReferences();
final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
final Resource initialResource = createResource("initialResource");
container.setResource(initialResource);
initialResource.getContents().addAll(testEObjects);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
final IEObjectLocation location = createEObjectLocation(copier, container);
final EObject expectedEObject = copier.get(original[0]);
final EStructuralFeature expectedFeature = (EStructuralFeature)original[1];
final Object expectedValue;
if (original[2] instanceof EObject) {
expectedValue = copier.get(original[2]);
} else {
expectedValue = original[2];
}
List<EObject> newEObjects = new ArrayList<EObject>(testEObjects);
newEObjects.remove(0);
newEObjects.remove(0);
final Resource newResource = createResource("newResource");
newResource.getContents().addAll(newEObjects);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
container.setResource(newResource);
assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
示例8: updateEObjectContainerEObjectLocationDeleted
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectContainerEObjectLocationDeleted() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(IReport.class, new BaseElementFactory.FactoryDescriptor<TestReport>(
TestReport.class));
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
final List<EObject> eObjects = new ArrayList<EObject>(copier.copyAll(AnydslPackage.eINSTANCE
.eContents()));
copier.copyReferences();
final EClass producerEClass = (EClass)copier.get(AnydslPackage.eINSTANCE.getProducer());
final Resource resource = createResource("test.xmi");
resource.getContents().addAll(eObjects);
container.setResource(resource);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
final IEObjectLocation location = new TestEObjectLocation();
location.setContainer(container);
final ILocation target = new TestTextLocation();
final ILink link = new BaseElementFactoryTests.TestLink();
location.getTargetLinks().add(link);
link.setSource(location);
target.getSourceLinks().add(link);
link.setTarget(target);
final TestEObjectContainerConnector connector = new TestEObjectContainerConnector();
MappingUtils.getConnectorRegistry().register(connector);
super.initLocation(container, location, producerEClass);
resource.getContents().remove(producerEClass);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
assertTrue(location.isMarkedAsDeleted());
assertEquals(1, base.getReports().size());
final IReport report = base.getReports().get(0);
assertEquals(link, report.getLink());
assertTrue(report.getDescription().contains("Producer"));
assertTrue(report.getDescription().contains(location.getURIFragment()));
assertTrue(report.getDescription().contains("has been deleted."));
MappingUtils.getConnectorRegistry().unregister(connector);
}
示例9: updateEObjectContainerEObjectLocationChanged
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectContainerEObjectLocationChanged() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(IReport.class, new BaseElementFactory.FactoryDescriptor<TestReport>(
TestReport.class));
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
final List<EObject> eObjects = new ArrayList<EObject>(copier.copyAll(AnydslPackage.eINSTANCE
.eContents()));
copier.copyReferences();
final EClass producerEClass = (EClass)copier.get(AnydslPackage.eINSTANCE.getProducer());
final Resource resource = createResource("test.xmi");
resource.getContents().addAll(eObjects);
container.setResource(resource);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
final IEObjectLocation location = new TestEObjectLocation();
location.setContainer(container);
final ILocation target = new TestTextLocation();
final ILink link = new BaseElementFactoryTests.TestLink();
location.getTargetLinks().add(link);
link.setSource(location);
target.getSourceLinks().add(link);
link.setTarget(target);
final TestEObjectContainerConnector connector = new TestEObjectContainerConnector();
MappingUtils.getConnectorRegistry().register(connector);
super.initLocation(container, location, producerEClass);
producerEClass.setInterface(!producerEClass.isInterface());
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
assertEquals(1, base.getReports().size());
final IReport report = base.getReports().get(0);
assertEquals(link, report.getLink());
assertTrue(report.getDescription().contains("Attribure interface was false changed to true."));
MappingUtils.getConnectorRegistry().unregister(connector);
}
示例10: updateEObjectContainerSettingLocationChanged
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectContainerSettingLocationChanged() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(IReport.class, new BaseElementFactory.FactoryDescriptor<TestReport>(
TestReport.class));
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
final List<EObject> eObjects = new ArrayList<EObject>(copier.copyAll(AnydslPackage.eINSTANCE
.eContents()));
copier.copyReferences();
final EClass producerEClass = (EClass)copier.get(AnydslPackage.eINSTANCE.getProducer());
final Resource resource = createResource("test.xmi");
resource.getContents().addAll(eObjects);
container.setResource(resource);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
final IEObjectLocation location = new TestEObjectLocation();
location.setContainer(container);
final ILocation target = new TestTextLocation();
final ILink link = new BaseElementFactoryTests.TestLink();
location.getTargetLinks().add(link);
link.setSource(location);
target.getSourceLinks().add(link);
link.setTarget(target);
final TestEObjectContainerConnector connector = new TestEObjectContainerConnector();
MappingUtils.getConnectorRegistry().register(connector);
super.initLocation(container, location, new Setting() {
public void unset() {
// nothing to do here
}
public void set(Object newValue) {
// nothing to do here
}
public boolean isSet() {
return false;
}
public EStructuralFeature getEStructuralFeature() {
return EcorePackage.eINSTANCE.getEClass_Interface();
}
public EObject getEObject() {
return producerEClass;
}
public Object get(boolean resolve) {
return producerEClass.getName();
}
});
producerEClass.setInterface(!producerEClass.isInterface());
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
assertEquals(1, base.getReports().size());
final IReport report = base.getReports().get(0);
assertEquals(link, report.getLink());
assertTrue(report.getDescription().contains("Producer"));
assertTrue(report.getDescription().contains(location.getURIFragment()));
assertTrue(report.getDescription().contains(
"feature interface value false has been changed to true."));
MappingUtils.getConnectorRegistry().unregister(connector);
}
示例11: updateEObjectContainerSettingLocationManyRemoved
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectContainerSettingLocationManyRemoved() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(IReport.class, new BaseElementFactory.FactoryDescriptor<TestReport>(
TestReport.class));
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
final List<EObject> eObjects = new ArrayList<EObject>(copier.copyAll(AnydslPackage.eINSTANCE
.eContents()));
copier.copyReferences();
final EClass foodEClass = (EClass)copier.get(AnydslPackage.eINSTANCE.getFood());
final Resource resource = createResource("test.xmi");
resource.getContents().addAll(eObjects);
container.setResource(resource);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
final IEObjectLocation location = new TestEObjectLocation();
location.setContainer(container);
final ILocation target = new TestTextLocation();
final ILink link = new BaseElementFactoryTests.TestLink();
location.getTargetLinks().add(link);
link.setSource(location);
target.getSourceLinks().add(link);
link.setTarget(target);
final TestEObjectContainerConnector connector = new TestEObjectContainerConnector();
MappingUtils.getConnectorRegistry().register(connector);
super.initLocation(container, location, new Setting() {
public void unset() {
// nothing to do here
}
public void set(Object newValue) {
// nothing to do here
}
public boolean isSet() {
return false;
}
public EStructuralFeature getEStructuralFeature() {
return EcorePackage.eINSTANCE.getEClass_EOperations();
}
public EObject getEObject() {
return foodEClass;
}
public Object get(boolean resolve) {
return foodEClass.getEOperations().get(1);
}
});
foodEClass.getEOperations().remove(1);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, resource);
assertEquals(1, base.getReports().size());
final IReport report = base.getReports().get(0);
assertEquals(link, report.getLink());
assertTrue(report.getDescription().contains("Food"));
assertTrue(report.getDescription().contains(location.getURIFragment()));
assertTrue(report.getDescription().contains("has been removed from feature eOperations."));
MappingUtils.getConnectorRegistry().unregister(connector);
}
示例12: createEObjectLocation
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
protected IEObjectLocation createEObjectLocation(Copier copier, TestEObjectContainerLocation container)
throws Exception {
final TestEObjectLocation res;
final EObject eObject = copier.get(original[0]);
if (original[1] != null) {
final EStructuralFeature feature = (EStructuralFeature)original[1];
final Object value;
if (original[2] instanceof EObject) {
value = copier.get(original[2]);
} else {
value = original[2];
}
res = (TestEObjectLocation)MappingUtils.getConnectorRegistry().createLocation(container,
new Setting() {
public void unset() {
// nothing to do here
}
public void set(Object newValue) {
// nothing to do here
}
public boolean isSet() {
return false;
}
public EStructuralFeature getEStructuralFeature() {
return feature;
}
public EObject getEObject() {
return eObject;
}
public Object get(boolean resolve) {
return value;
}
});
} else {
res = (TestEObjectLocation)MappingUtils.getConnectorRegistry().createLocation(container, eObject);
}
res.setObject(eObject);
return res;
}
示例13: updateEObjectsAltered
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsAltered() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(IEObjectLocation.class,
new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
if (!copier.containsKey(altered[0])) {
copier.copy((EObject)altered[0]);
}
copier.copyReferences();
final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
final Resource initialResource = createResource("initialResource");
container.setResource(initialResource);
initialResource.getContents().addAll(testEObjects);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
final IEObjectLocation location = createEObjectLocation(copier, container);
final EObject expectedEObject = copier.get(altered[0]);
final EStructuralFeature expectedFeature = (EStructuralFeature)altered[1];
final Object expectedValue;
if (altered[2] instanceof EObject) {
expectedValue = copier.get(altered[2]);
} else {
expectedValue = altered[2];
}
List<EObject> newEObjects = testEObjects;
newEObjects = alterEObjects(copier, newEObjects);
final Resource newResource = createResource("newResource");
newResource.getContents().addAll(newEObjects);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
container.setResource(newResource);
assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
示例14: updateEObjectsPlusShiftAltered
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsPlusShiftAltered() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(IEObjectLocation.class,
new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
if (!copier.containsKey(altered[0])) {
copier.copy((EObject)altered[0]);
}
copier.copyReferences();
final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
final Resource initialResource = createResource("initialResource");
container.setResource(initialResource);
initialResource.getContents().addAll(testEObjects);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
final IEObjectLocation location = createEObjectLocation(copier, container);
final EObject expectedEObject = copier.get(altered[0]);
final EStructuralFeature expectedFeature = (EStructuralFeature)original[1];
final Object expectedValue;
if (altered[2] instanceof EObject) {
expectedValue = copier.get(altered[2]);
} else {
expectedValue = altered[2];
}
List<EObject> newEObjects = new ArrayList<EObject>(MappingPackage.eINSTANCE.getEClassifiers());
newEObjects.addAll(testEObjects);
newEObjects = alterEObjects(copier, newEObjects);
final Resource newResource = createResource("newResource");
newResource.getContents().addAll(newEObjects);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
container.setResource(newResource);
assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}
示例15: updateEObjectsMinusShiftAltered
import org.eclipse.emf.ecore.util.EcoreUtil.Copier; //导入方法依赖的package包/类
@Test
public void updateEObjectsMinusShiftAltered() throws Exception {
final IBase base = new BaseRegistryTests.TestBase();
base.getFactory().addDescriptor(IEObjectLocation.class,
new BaseElementFactory.FactoryDescriptor<TestEObjectLocation>(TestEObjectLocation.class));
base.getFactory().addDescriptor(ICouple.class, new BaseElementFactory.FactoryDescriptor<TestCouple>(
TestCouple.class));
final TestEObjectContainerLocation container = new TestEObjectContainerLocation();
container.setContainer(base);
final Copier copier = new Copier();
EPackage copy = (EPackage)copier.copy(AnydslPackage.eINSTANCE);
if (!copier.containsKey(altered[0])) {
copier.copy((EObject)altered[0]);
}
copier.copyReferences();
final List<EObject> testEObjects = new ArrayList<EObject>(copy.getEClassifiers());
final Resource initialResource = createResource("initialResource");
container.setResource(initialResource);
initialResource.getContents().addAll(testEObjects);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, initialResource);
final IEObjectLocation location = createEObjectLocation(copier, container);
final EObject expectedEObject = copier.get(altered[0]);
final EStructuralFeature expectedFeature = (EStructuralFeature)original[1];
final Object expectedValue;
if (altered[2] instanceof EObject) {
expectedValue = copier.get(altered[2]);
} else {
expectedValue = altered[2];
}
List<EObject> newEObjects = new ArrayList<EObject>(testEObjects);
newEObjects.remove(0);
newEObjects.remove(0);
newEObjects = alterEObjects(copier, newEObjects);
final Resource newResource = createResource("newResource");
newResource.getContents().addAll(newEObjects);
eObjectContainerHelper.updateEObjectContainer(container.getContainer(), container, newResource);
container.setResource(newResource);
assertEObjectLocation(location, expectedEObject, expectedFeature, expectedValue);
}