Skip to content
Snippets Groups Projects
Commit 8c9f3351 authored by Sergiu Dumitriu's avatar Sergiu Dumitriu
Browse files

[cleanup] Applied codestyle

parent 81e07916
No related branches found
No related tags found
No related merge requests found
......@@ -55,7 +55,7 @@ public class ModelScriptService implements ScriptService
* The default hint used when resolving references.
*/
private static final String DEFAULT_RESOLVER_HINT = "currentmixed";
/**
* The object used to log messages.
*/
......@@ -222,7 +222,7 @@ public ObjectReference resolveObject(String stringRepresentation, Object... para
{
return resolveObject(stringRepresentation, DEFAULT_RESOLVER_HINT, parameters);
}
/**
* @param stringRepresentation an object reference specified as {@link String} (using the "wiki:space.page^object"
* format and with special characters escaped where required)
......@@ -243,7 +243,7 @@ public ObjectReference resolveObject(String stringRepresentation, String hint, O
return null;
}
}
/**
* @param stringRepresentation an object property reference specified as {@link String} (using the
* "wiki:space.page^object.property" format and with special characters escaped where required)
......@@ -257,7 +257,7 @@ public ObjectPropertyReference resolveObjectProperty(String stringRepresentation
{
return resolveObjectProperty(stringRepresentation, DEFAULT_RESOLVER_HINT, parameters);
}
/**
* @param stringRepresentation an object property reference specified as {@link String} (using the
* "wiki:space.page^object.property" format and with special characters escaped where required)
......@@ -279,7 +279,7 @@ public ObjectPropertyReference resolveObjectProperty(String stringRepresentation
return null;
}
}
/**
* @param reference the entity reference to transform into a String representation
* @return the string representation of the passed entity reference (using the "compact" serializer)
......
......@@ -73,10 +73,12 @@ public void testCreateDocumentReference() throws Exception
this.mockery.checking(new Expectations()
{
{
allowing(mockComponentManager).getInstance(DocumentReferenceResolver.TYPE_REFERENCE, "default");
will(returnValue(mockResolver));
allowing(ModelScriptServiceTest.this.mockComponentManager).getInstance(
DocumentReferenceResolver.TYPE_REFERENCE, "default");
will(returnValue(ModelScriptServiceTest.this.mockResolver));
allowing(mockResolver).resolve(new DocumentReference("wiki", "space", "page"));
allowing(ModelScriptServiceTest.this.mockResolver).resolve(
new DocumentReference("wiki", "space", "page"));
}
});
......@@ -107,10 +109,11 @@ public void testCreateDocumentReferenceWhenEmptyParameters() throws Exception
this.mockery.checking(new Expectations()
{
{
allowing(mockComponentManager).getInstance(DocumentReferenceResolver.TYPE_REFERENCE, "default");
will(returnValue(mockResolver));
allowing(ModelScriptServiceTest.this.mockComponentManager).getInstance(
DocumentReferenceResolver.TYPE_REFERENCE, "default");
will(returnValue(ModelScriptServiceTest.this.mockResolver));
allowing(mockResolver).resolve(null);
allowing(ModelScriptServiceTest.this.mockResolver).resolve(null);
}
});
......@@ -123,11 +126,13 @@ public void testCreateDocumentReferenceWhenWikiParameterEmpty() throws Exception
this.mockery.checking(new Expectations()
{
{
allowing(mockComponentManager).getInstance(DocumentReferenceResolver.TYPE_REFERENCE, "default");
will(returnValue(mockResolver));
allowing(ModelScriptServiceTest.this.mockComponentManager).getInstance(
DocumentReferenceResolver.TYPE_REFERENCE, "default");
will(returnValue(ModelScriptServiceTest.this.mockResolver));
allowing(mockResolver).resolve(new EntityReference("page", EntityType.DOCUMENT,
new EntityReference("space", EntityType.SPACE)));
allowing(ModelScriptServiceTest.this.mockResolver).resolve(
new EntityReference("page", EntityType.DOCUMENT,
new EntityReference("space", EntityType.SPACE)));
}
});
......@@ -140,11 +145,13 @@ public void testCreateDocumentReferenceWhenSpaceParameterEmpty() throws Exceptio
this.mockery.checking(new Expectations()
{
{
allowing(mockComponentManager).getInstance(DocumentReferenceResolver.TYPE_REFERENCE, "default");
will(returnValue(mockResolver));
allowing(ModelScriptServiceTest.this.mockComponentManager).getInstance(
DocumentReferenceResolver.TYPE_REFERENCE, "default");
will(returnValue(ModelScriptServiceTest.this.mockResolver));
allowing(mockResolver).resolve(new EntityReference("page", EntityType.DOCUMENT,
new EntityReference("wiki", EntityType.WIKI)));
allowing(ModelScriptServiceTest.this.mockResolver).resolve(
new EntityReference("page", EntityType.DOCUMENT,
new EntityReference("wiki", EntityType.WIKI)));
}
});
......@@ -157,11 +164,13 @@ public void testCreateDocumentReferenceWhenPageParameterEmpty() throws Exception
this.mockery.checking(new Expectations()
{
{
allowing(mockComponentManager).getInstance(DocumentReferenceResolver.TYPE_REFERENCE, "default");
will(returnValue(mockResolver));
allowing(ModelScriptServiceTest.this.mockComponentManager).getInstance(
DocumentReferenceResolver.TYPE_REFERENCE, "default");
will(returnValue(ModelScriptServiceTest.this.mockResolver));
allowing(mockResolver).resolve(new EntityReference("space", EntityType.SPACE,
new EntityReference("wiki", EntityType.WIKI)));
allowing(ModelScriptServiceTest.this.mockResolver).resolve(
new EntityReference("space", EntityType.SPACE,
new EntityReference("wiki", EntityType.WIKI)));
}
});
......@@ -174,10 +183,12 @@ public void testCreateDocumentReferenceWhenWikiAndSpaceParametersEmpty() throws
this.mockery.checking(new Expectations()
{
{
allowing(mockComponentManager).getInstance(DocumentReferenceResolver.TYPE_REFERENCE, "default");
will(returnValue(mockResolver));
allowing(ModelScriptServiceTest.this.mockComponentManager).getInstance(
DocumentReferenceResolver.TYPE_REFERENCE, "default");
will(returnValue(ModelScriptServiceTest.this.mockResolver));
allowing(mockResolver).resolve(new EntityReference("wiki", EntityType.WIKI));
allowing(ModelScriptServiceTest.this.mockResolver)
.resolve(new EntityReference("wiki", EntityType.WIKI));
}
});
......@@ -190,10 +201,12 @@ public void testCreateDocumentReferenceWhenInvalidHint() throws Exception
this.mockery.checking(new Expectations()
{
{
allowing(mockComponentManager).getInstance(DocumentReferenceResolver.TYPE_REFERENCE, "invalid");
allowing(ModelScriptServiceTest.this.mockComponentManager).getInstance(
DocumentReferenceResolver.TYPE_REFERENCE, "invalid");
will(throwException(new ComponentLookupException("error")));
// Make sure backward compatibility is preserved.
allowing(mockComponentManager).getInstance(DocumentReferenceResolver.class, "invalid");
allowing(ModelScriptServiceTest.this.mockComponentManager).getInstance(DocumentReferenceResolver.class,
"invalid");
will(throwException(new ComponentLookupException("error")));
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment