diff --git a/application-home/application.xml b/application-home/application.xml
index 27c386f..110fbb4 100644
--- a/application-home/application.xml
+++ b/application-home/application.xml
@@ -118,6 +118,11 @@
+
+
+
+
+
@@ -316,6 +321,11 @@
Show a list of cached elements per site
Clear cache statistics
Show cache statistics per site
+
+ Show a node's properties
+ Create a node property
+ Edit a node property
+ Delete a node property
diff --git a/application-home/conf/datasources/ds-clusterState.xml b/application-home/conf/datasources/ds-clusterState.xml
index 592ee8e..b9a8fad 100644
--- a/application-home/conf/datasources/ds-clusterState.xml
+++ b/application-home/conf/datasources/ds-clusterState.xml
@@ -111,7 +111,7 @@
-
+
preview
diff --git a/application-home/conf/datasources/ds-properties.xml b/application-home/conf/datasources/ds-properties.xml
index b200b74..fb854db 100644
--- a/application-home/conf/datasources/ds-properties.xml
+++ b/application-home/conf/datasources/ds-properties.xml
@@ -70,6 +70,68 @@
+
+
+ node.properties
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ led_orange
+ led_green
+
+
+
+
+
+
+
+
+ new
+
+
+
+
+
+
+
+
+ edit
+
+
+
+
+
+
+ delete
+
+
+
+
+
+
+
+
+
+
+
+
site.properties
diff --git a/application-home/conf/events/ev-properties.xml b/application-home/conf/events/ev-properties.xml
index 607b1b9..7064f1f 100644
--- a/application-home/conf/events/ev-properties.xml
+++ b/application-home/conf/events/ev-properties.xml
@@ -61,6 +61,65 @@
+
+
+
+ property.create
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ property.edit
+
+
+
+
+
+
+
+
+
+
+
+ ${propertyId}
+
+
+
+
+
+
+
+
+
+ property.delete
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application-home/conf/pages/pg-system.xml b/application-home/conf/pages/pg-system.xml
index 4b7a9a3..cb8a970 100644
--- a/application-home/conf/pages/pg-system.xml
+++ b/application-home/conf/pages/pg-system.xml
@@ -13,7 +13,9 @@
-
+
+
+
@@ -88,32 +90,59 @@
- ${entity}
+ ${id}
- ${entity}
+ ${id}
-
+
+
+
+
+
+
+ ${form_action}
+ ${id}
+
+
+
+
+
+
+
+ ${form_action}
+ ${id2}
+
+
+
+
+
+
+
+ ${id}
+ ${id2}
+
+
- ${entity}
+ ${id}
-
+
- ${entity}
+ ${id}
-
+
@@ -146,9 +175,16 @@
+
+
+
+ ${action2}
+ ${id2}
+
+
+
-
diff --git a/application-home/dictionary/manager-messages.properties b/application-home/dictionary/manager-messages.properties
index 4e70a59..d9dba45 100644
--- a/application-home/dictionary/manager-messages.properties
+++ b/application-home/dictionary/manager-messages.properties
@@ -172,6 +172,7 @@ migration.success=Migration of database successful!
minConnections=Min. number of connections
mode=Mode
name=Name
+node.properties=Node Properties
nodeId=Node ID
nonHeap.max=non-heap max.
nonHeap.used=non-heap used
diff --git a/src/main/java/org/appng/application/manager/business/Properties.java b/src/main/java/org/appng/application/manager/business/Properties.java
index 2b61630..286c85f 100644
--- a/src/main/java/org/appng/application/manager/business/Properties.java
+++ b/src/main/java/org/appng/application/manager/business/Properties.java
@@ -57,6 +57,7 @@ public class Properties extends ServiceAware implements ActionProvider 0) {
@@ -1498,21 +1498,31 @@ public DataContainer searchProperties(FieldProcessor fp, Integer siteId, Integer
}
data.setItem(new PropertyForm(property));
} else {
- Page properties = getProperties(siteId, appId, fp.getPageable());
+ Page properties;
+ Pageable pageable = fp.getPageable();
+ if (nodeId != null) {
+ properties = getNodeProperties(nodeId, pageable);
+ } else {
+ properties = getProperties(siteId, appId, pageable);
+ }
data.setPage(properties);
}
return data;
}
- public void createProperty(Request request, PropertyForm propertyForm, Integer siteId, Integer appId,
+ public void createProperty(Request request, PropertyForm propertyForm, String nodeId, Integer siteId, Integer appId,
FieldProcessor fp) throws BusinessException {
try {
PropertyImpl property = propertyForm.getProperty();
- if (checkPropertyExists(siteId, appId, property)) {
- fp.addErrorMessage(request.getMessage(MessageConstants.PROPERTY_EXISTS));
- throw new BusinessException("property already exists!");
+ if (nodeId != null) {
+ createNodeProperty(nodeId, property);
} else {
- createProperty(siteId, appId, property);
+ if (checkPropertyExists(siteId, appId, property)) {
+ fp.addErrorMessage(request.getMessage(MessageConstants.PROPERTY_EXISTS));
+ throw new BusinessException("property already exists!");
+ } else {
+ createProperty(siteId, appId, property);
+ }
}
} catch (Exception e) {
request.handleException(fp, e);
diff --git a/src/main/java/org/appng/application/manager/service/Service.java b/src/main/java/org/appng/application/manager/service/Service.java
index bc5a9bd..9482c63 100644
--- a/src/main/java/org/appng/application/manager/service/Service.java
+++ b/src/main/java/org/appng/application/manager/service/Service.java
@@ -76,9 +76,9 @@ public interface Service {
void createSubject(Request request, Locale locale, SubjectForm form, FieldProcessor fp, PasswordPolicy policy) throws BusinessException;
- void createProperty(Request request, PropertyForm propertyForm, Integer siteId, Integer appId, FieldProcessor fp)
+ void createProperty(Request request, PropertyForm propertyForm, String nodeId, Integer siteId, Integer appId, FieldProcessor fp)
throws BusinessException;
-
+
void createPermission(Request request, PermissionImpl permission, Integer appId, FieldProcessor fp)
throws BusinessException;
@@ -118,7 +118,7 @@ DataContainer searchSubjects(Request request, FieldProcessor fp, Integer subject
DataContainer searchPermissions(FieldProcessor fp, Integer permissionId, Integer appId) throws BusinessException;
- DataContainer searchProperties(FieldProcessor fp, Integer siteId, Integer appId, String propertyName)
+ DataContainer searchProperties(FieldProcessor fp, String nodeId, Integer siteId, Integer appId, String propertyName)
throws BusinessException;
void updateGroup(Request request, Site site, GroupForm groupForm, FieldProcessor fp) throws BusinessException;
diff --git a/src/test/java/org/appng/application/manager/business/NodePropertiesTest.java b/src/test/java/org/appng/application/manager/business/NodePropertiesTest.java
new file mode 100644
index 0000000..7796319
--- /dev/null
+++ b/src/test/java/org/appng/application/manager/business/NodePropertiesTest.java
@@ -0,0 +1,70 @@
+package org.appng.application.manager.business;
+
+import java.io.IOException;
+
+import org.appng.api.FieldProcessor;
+import org.appng.api.ProcessingException;
+import org.appng.api.model.Property.Type;
+import org.appng.api.support.CallableAction;
+import org.appng.api.support.CallableDataSource;
+import org.appng.application.manager.form.PropertyForm;
+import org.appng.core.domain.PropertyImpl;
+import org.appng.testsupport.validation.WritingXmlValidator;
+import org.junit.FixMethodOrder;
+import org.junit.Test;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
+public class NodePropertiesTest extends AbstractTest {
+
+ static {
+ WritingXmlValidator.writeXml = false;
+ }
+
+ @Test
+ public void testACreate() throws ProcessingException, IOException {
+ ActionCall actionCall = getAction("propertyEvent", "create-node-property")
+ .withParam(FORM_ACTION, "create-node-property").withParam("nodeId", "foobar");
+ PropertyImpl property = new PropertyImpl("foo", "bar");
+ CallableAction action = actionCall.getCallableAction(new PropertyForm(property));
+ FieldProcessor perform = action.perform();
+ validate(perform.getMessages());
+ }
+
+ @Test
+ public void testUpdate() throws ProcessingException, IOException {
+ PropertyImpl property = new PropertyImpl("foo", "rab");
+ property.setType(Type.TEXT);
+ PropertyForm propertyForm = new PropertyForm(property);
+ CallableAction action = getAction("propertyEvent", "update-node-property")
+ .withParam(FORM_ACTION, "update-node-property").withParam("propertyId", "platform.node.foobar.foo")
+ .getCallableAction(propertyForm);
+ FieldProcessor perform = action.perform();
+ validate(perform.getMessages());
+ }
+
+ @Test
+ public void testShowAll() throws ProcessingException, IOException {
+ CallableDataSource dataSource = getDataSource("node-properties").withParam("nodeId", "foobar")
+ .getCallableDataSource();
+ dataSource.perform("test");
+ validate(dataSource.getDatasource());
+ }
+
+ @Test
+ public void testShowOne() throws ProcessingException, IOException {
+ CallableDataSource dataSource = getDataSource("property").withParam("id", "platform.node.foobar.foo")
+ .getCallableDataSource();
+ dataSource.perform("test");
+ validate(dataSource.getDatasource());
+ }
+
+ @Test
+ public void testZDelete() throws ProcessingException, IOException {
+ CallableAction action = getAction("propertyEvent", "delete-node-property")
+ .withParam(FORM_ACTION, "delete-node-property").withParam("propertyId", "platform.node.foobar.foo")
+ .getCallableAction(new PropertyForm());
+ FieldProcessor perform = action.perform();
+ validate(perform.getMessages());
+ }
+}
diff --git a/src/test/resources/xml/ClusterStateTest-testClusterState.xml b/src/test/resources/xml/ClusterStateTest-testClusterState.xml
index c0db38a..232dd2f 100644
--- a/src/test/resources/xml/ClusterStateTest-testClusterState.xml
+++ b/src/test/resources/xml/ClusterStateTest-testClusterState.xml
@@ -1,55 +1,54 @@
- Cluster Status
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- led_green
- ico_spacer
-
-
-
-
-
-
-
-
- preview
-
-
-
-
-
- reload
-
-
+ Cluster Status
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ led_green
+ ico_spacer
+
+
+
+
+
+
+
+
+ preview
+
+
+
+
+
+ reload
+
+
diff --git a/src/test/resources/xml/NodePropertiesTest-testACreate.xml b/src/test/resources/xml/NodePropertiesTest-testACreate.xml
new file mode 100644
index 0000000..8ccdfb3
--- /dev/null
+++ b/src/test/resources/xml/NodePropertiesTest-testACreate.xml
@@ -0,0 +1,4 @@
+
+
+ Property has been created.
+
diff --git a/src/test/resources/xml/NodePropertiesTest-testShowAll.xml b/src/test/resources/xml/NodePropertiesTest-testShowAll.xml
new file mode 100644
index 0000000..5972286
--- /dev/null
+++ b/src/test/resources/xml/NodePropertiesTest-testShowAll.xml
@@ -0,0 +1,89 @@
+
+
+
+ Node Properties
+
+
+
+
+ foobar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ led_orange
+ led_green
+
+
+
+
+
+
+
+
+
+
+
+ new
+
+
+
+
+
+
+
+
+ edit
+
+
+
+
+
+
+ delete
+ Do you really want to delete the property "#{shortName}"?
+
+
+
+
+
+
+
+ foo
+
+
+ bar
+
+
+
+
+
+ true
+ led_green
+
+
+
+
+ edit
+
+
+
+ delete
+ Do you really want to delete the property "foo"?
+
+
+
+
+
+
diff --git a/src/test/resources/xml/NodePropertiesTest-testShowOne.xml b/src/test/resources/xml/NodePropertiesTest-testShowOne.xml
new file mode 100644
index 0000000..aaf9ddc
--- /dev/null
+++ b/src/test/resources/xml/NodePropertiesTest-testShowOne.xml
@@ -0,0 +1,37 @@
+
+
+
+ property
+
+ platform.node.foobar.foo
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ TEXT
+
+
+ bar
+
+
+ bar
+
+
+
+
+
+
+
diff --git a/src/test/resources/xml/NodePropertiesTest-testUpdate.xml b/src/test/resources/xml/NodePropertiesTest-testUpdate.xml
new file mode 100644
index 0000000..c6002ed
--- /dev/null
+++ b/src/test/resources/xml/NodePropertiesTest-testUpdate.xml
@@ -0,0 +1,4 @@
+
+
+ Property has been updated.
+
diff --git a/src/test/resources/xml/NodePropertiesTest-testZDelete.xml b/src/test/resources/xml/NodePropertiesTest-testZDelete.xml
new file mode 100644
index 0000000..1dd0ec0
--- /dev/null
+++ b/src/test/resources/xml/NodePropertiesTest-testZDelete.xml
@@ -0,0 +1,4 @@
+
+
+ Property has been deleted.
+