Skip to content

Commit

Permalink
#58: fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ypujante committed Jul 15, 2013
1 parent dbe8bec commit 57ebe4d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public class ZooKeeperClusterMetaModelImpl implements ZooKeeperClusterMetaModel
{
def res = [
name: name,
fabrics: fabrics.keySet().collect { it },
zooKeepers: zooKeepers.collect { it.toExternalRepresentation() }
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
package test.provisioner.core.metamodel

import org.linkedin.util.io.ram.RAMDirectory
import org.linkedin.util.io.resource.FileResource
import org.linkedin.util.io.resource.Resource
import org.pongasoft.glu.provisioner.core.metamodel.AgentMetaModel
import org.pongasoft.glu.provisioner.core.metamodel.ConsoleMetaModel
import org.pongasoft.glu.provisioner.core.metamodel.GluMetaModel
Expand Down Expand Up @@ -106,7 +108,7 @@ public class TestMetaModel extends GroovyTestCase
*/
public void testTutorialGluMetaModel()
{
def model = new File("../../packaging/org.linkedin.glu.packaging-all/src/cmdline/resources/models/tutorial/glu-meta-model.json.groovy").text
def model = FileResource.create("../../packaging/org.linkedin.glu.packaging-all/src/cmdline/resources/models/tutorial/glu-meta-model.json.groovy")

def expectedModel = """
{
Expand Down Expand Up @@ -457,13 +459,18 @@ public class TestMetaModel extends GroovyTestCase
checkJson(model, expectedModel)
}

private GluMetaModel checkJson(Resource model, String expectedModel)
{
JsonMetaModelSerializerImpl serializer = new JsonMetaModelSerializerImpl()
def metaModel = serializer.deserialize([model])
assertEquals((expectedModel ?: model.file.text).trim(), serializer.serialize(metaModel, true))
return metaModel
}

private GluMetaModel checkJson(String model, String expectedModel)
{
RAMDirectory ram = new RAMDirectory()
ram.add('model', model)
JsonMetaModelSerializerImpl serializer = new JsonMetaModelSerializerImpl()
def metaModel = serializer.deserialize([ram.toResource().createRelative('/model')])
assertEquals((expectedModel ?: model).trim(), serializer.serialize(metaModel, true))
return metaModel
checkJson(ram.toResource().createRelative('/model'), expectedModel)
}
}

0 comments on commit 57ebe4d

Please sign in to comment.