Skip to content
This repository has been archived by the owner on Mar 2, 2020. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
junkerm committed May 4, 2018
2 parents e6b96d9 + ca5b84f commit 10b1fa4
Show file tree
Hide file tree
Showing 186 changed files with 39,528 additions and 860 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ private void syncContainers(IContainer localContainer, Collection<Requirement> r
private void buildExtIdMap(Iterator<? extends EObject> iterator, HashMap<String, EObject> requirementsMap) {
while (iterator.hasNext()) {
EObject content = iterator.next();
if (content == null) {
continue;
}
if (content.eClass().getName().equals("Requirement")) {
Requirement requirement = (Requirement) content;
if (!StringUtils.isEmpty(requirement.getExtId())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ public EMFJsonSerializer(IURIFactory uriFactory, ISerializationConfiguration con
* @throws SpecmateException
*/
public JSONObject serialize(EObject eObject) throws JSONException, SpecmateException {
return serializeObject(eObject);
try {
return serializeObject(eObject);
} catch (Exception e) {
throw new SpecmateException(e);
}
}

/**
Expand All @@ -108,7 +112,11 @@ public JSONObject serialize(EObject eObject) throws JSONException, SpecmateExcep
* If the object cannnot be serialized
*/
public JSONArray serialize(List<?> list) throws JSONException, SpecmateException {
return serializeList(list);
try {
return serializeList(list);
} catch (Exception e) {
throw new SpecmateException(e);
}
}

/**
Expand Down Expand Up @@ -223,7 +231,9 @@ private Object serializeProxy(Object value) throws SpecmateException {
return jsonArray;
}
AssertUtil.assertTrue(false, "No other type than EList or EObject " + "expected for json proxy serialization");

return null;

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import javax.ws.rs.ext.Provider;

import org.eclipse.emf.ecore.EObject;
import org.osgi.service.log.LogService;

import com.specmate.common.ISerializationConfiguration;
import com.specmate.urihandler.IURIFactory;
Expand All @@ -25,8 +26,9 @@ public class JsonEObjectWriter implements MessageBodyWriter<EObject> {
private JsonWriter writer;

/** constructor */
public JsonEObjectWriter(@Context IURIFactory factory, @Context ISerializationConfiguration serializationConfig) {
this.writer = new JsonWriter(factory, serializationConfig);
public JsonEObjectWriter(@Context LogService logService, @Context IURIFactory factory,
@Context ISerializationConfiguration serializationConfig) {
this.writer = new JsonWriter(logService, factory, serializationConfig);
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import javax.ws.rs.ext.Provider;

import org.eclipse.emf.ecore.EObject;
import org.osgi.service.log.LogService;

import com.specmate.common.ISerializationConfiguration;
import com.specmate.urihandler.IURIFactory;
Expand All @@ -26,8 +27,9 @@ public class JsonListWriter implements MessageBodyWriter<List<EObject>> {
private JsonWriter writer;

/** constructor */
public JsonListWriter(@Context IURIFactory factory, @Context ISerializationConfiguration serializationConfig) {
this.writer = new JsonWriter(factory, serializationConfig);
public JsonListWriter(@Context LogService logService, @Context IURIFactory factory,
@Context ISerializationConfiguration serializationConfig) {
this.writer = new JsonWriter(logService, factory, serializationConfig);
}

/** {@inheritDoc} */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import javax.ws.rs.core.MultivaluedMap;

import org.eclipse.emf.ecore.EObject;
import org.osgi.service.log.LogService;

import com.specmate.common.ISerializationConfiguration;
import com.specmate.emfjson.EMFJsonSerializer;
Expand All @@ -20,13 +21,20 @@
/** Serializes EMF object to JSON */
public class JsonWriter {

LogService logService;

public static final String MEDIA_TYPE = MediaType.APPLICATION_JSON + ";charset=utf-8";

private EMFJsonSerializer serializer;

/** constructor */
public JsonWriter(IURIFactory factory, ISerializationConfiguration serializationConfig) {
/**
* constructor
*
* @param logService2
*/
public JsonWriter(LogService logService, IURIFactory factory, ISerializationConfiguration serializationConfig) {
this.serializer = new EMFJsonSerializer(factory, serializationConfig);
this.logService = logService;
}

/** {@inheritDoc} */
Expand All @@ -53,12 +61,14 @@ public void writeTo(Object obj, Class<?> clazz, Type type, Annotation[] annotati
try {
result = serializer.serialize((EObject) obj).toString();
} catch (Exception e) {
logService.log(LogService.LOG_ERROR, "Could not serialize object.", e);
throw new WebApplicationException(e);
}
} else if (obj instanceof List) {
try {
result = serializer.serialize((List<?>) obj).toString();
} catch (Exception e) {
logService.log(LogService.LOG_ERROR, "Could not serialize object.", e);
throw new WebApplicationException(e);
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void unsetLogReader(LogReaderService logReaderService) {

@Override
public void logged(LogEntry entry) {
if (entry.getLevel() > LogService.LOG_ERROR) {
if (entry.getLevel() > LogService.LOG_INFO) {
return;
}
String message = level2String.get(entry.getLevel()) + ":" + entry.getBundle().getSymbolicName() + ":"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ public interface IMigratorService {

boolean needsMigration() throws SpecmateException;

boolean doMigration() throws SpecmateException;
void doMigration() throws SpecmateException;
}
4 changes: 3 additions & 1 deletion bundles/specmate-migration-test/bnd.bnd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ Bundle-Version: 0.0.0.${tstamp}
Test-Cases: \
com.specmate.migration.test.AddAttributeTest,\
com.specmate.migration.test.AddSeveralAttributesTest,\
com.specmate.migration.test.AddObjectTest
com.specmate.migration.test.AddObjectTest,\
com.specmate.migration.test.RenamedAttributeTest,\
com.specmate.migration.test.ChangedTypesTest
-buildpath: \
org.eclipse.emf,\
org.eclipse.emf.cdo,\
Expand Down
47 changes: 47 additions & 0 deletions bundles/specmate-migration-test/models/attributeadded.ecore
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,52 @@
</eSubpackages>
<eSubpackages name="artefact" nsURI="http://specmate.com/1/testmodel/artefact" nsPrefix="com.specmate.testmodel.artefact">
<eClassifiers xsi:type="ecore:EClass" name="Diagram" eSuperTypes="#//base/IModifiable #//base/IContainer"/>
<eClassifiers xsi:type="ecore:EClass" name="File" eSuperTypes="#//base/IModifiable #//base/IContainer">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="byteVar1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EByte"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="byteVar2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EByte"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="byteVar3" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EByte"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="byteVar4" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EByte"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="byteVar5" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EByte"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="shortVar1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="shortVar2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="shortVar3" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="shortVar4" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="shortVar5" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EShort"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="intVar1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="intVar2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="intVar3" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="intVar4" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="intVar5" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="charVar1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="charVar2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="charVar3" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="charVar4" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="charVar5" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="longVar1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="longVar2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="longVar3" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="longVar4" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="longVar5" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//ELong"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="floatVar1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="floatVar2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="floatVar3" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="floatVar4" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="floatVar5" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="doubleVar1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="doubleVar2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="doubleVar3" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="doubleVar4" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="doubleVar5" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="booleanVar1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="booleanVar2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="booleanVar3" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="booleanVar4" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="booleanVar5" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="stringVar1" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="stringVar2" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="stringVar3" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="stringVar4" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="stringVar5" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
</eSubpackages>
</ecore:EPackage>
Loading

0 comments on commit 10b1fa4

Please sign in to comment.