Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7c99d4
commit e48aee4
Showing
7 changed files
with
217 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/test/java/org/appng/application/manager/business/EnvironmentTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright 2011-2021 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.appng.application.manager.business; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
import org.appng.api.support.CallableDataSource; | ||
import org.appng.testsupport.validation.WritingXmlValidator; | ||
import org.appng.testsupport.validation.XPathDifferenceHandler; | ||
import org.junit.Test; | ||
|
||
public class EnvironmentTest extends AbstractTest { | ||
|
||
static { | ||
WritingXmlValidator.writeXml = false; | ||
} | ||
|
||
@Test | ||
public void testSystemEnv() throws Exception { | ||
validate("systemEnv"); | ||
} | ||
|
||
@Test | ||
public void testSystemProps() throws Exception { | ||
validate("systemProps"); | ||
} | ||
|
||
@Test | ||
public void testJvmArguments() throws Exception { | ||
validate("jvmArguments"); | ||
} | ||
|
||
@Test | ||
public void testProcessor() throws Exception { | ||
validate("processor"); | ||
} | ||
|
||
@Test | ||
public void testMemory() throws Exception { | ||
validate("memory"); | ||
} | ||
|
||
protected void validate(String dataSource) throws Exception { | ||
CallableDataSource ds = getDataSource(dataSource).getCallableDataSource(); | ||
ds.perform(""); | ||
ds.getDatasource().getData().setResultset(null); | ||
XPathDifferenceHandler dh = new XPathDifferenceHandler(true); | ||
validate(ds.getDatasource(), StringUtils.capitalize(dataSource), dh); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/test/resources/xml/EnvironmentTest-validateJvmArguments.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<datasource xmlns="http://www.appng.org/schema/platform" id="jvmArguments"> | ||
<config> | ||
<title id="jvmArguments">JVM Arguments</title> | ||
<permissions> | ||
<permission ref="platform.environment" mode="set"></permission> | ||
</permissions> | ||
<meta-data bindClass="java.util.Map$Entry"> | ||
<field name="key" type="longtext" binding="key"> | ||
<label id="name">Name</label> | ||
</field> | ||
<field name="value" type="text" displayLength="1000" binding="value"> | ||
<label id="value">Value</label> | ||
</field> | ||
</meta-data> | ||
<linkpanel id="links" location="top"> | ||
<link id="links[1]" mode="intern" target="/system?act=reloadPlatform"> | ||
<permissions> | ||
<permission ref="platform.reload" mode="set"></permission> | ||
</permissions> | ||
<label id="platform.reload">Reload platform</label> | ||
<icon>reload</icon> | ||
<confirmation id="platform.reload.confirm">Do you really want to reload the platform?</confirmation> | ||
</link> | ||
<link id="links[2]" mode="webservice" target="/service/localhost/appng-manager/webservice/systemReport"> | ||
<permissions> | ||
<permission ref="platform.report" mode="set"></permission> | ||
</permissions> | ||
<label id="systemReport">System Report</label> | ||
<icon>goto</icon> | ||
</link> | ||
</linkpanel> | ||
</config> | ||
<data /> | ||
</datasource> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<datasource xmlns="http://www.appng.org/schema/platform" id="memory"> | ||
<config> | ||
<title id="memory">Memory</title> | ||
<permissions> | ||
<permission ref="platform.environment" mode="set"></permission> | ||
</permissions> | ||
<meta-data bindClass="java.util.Map$Entry"> | ||
<field name="key" type="longtext" binding="key"> | ||
<label id="name">Name</label> | ||
</field> | ||
<field name="value.value" type="text" binding="value.value"> | ||
<label id="value">Value</label> | ||
</field> | ||
<field name="value.level" type="image" binding="value.level"> | ||
<icon condition="${current.value.level == 0}">spacer</icon> | ||
<icon condition="${current.value.level == 1}">led_green</icon> | ||
<icon condition="${current.value.level == 2}">led_orange</icon> | ||
<icon condition="${current.value.level == 3}">led_red</icon> | ||
</field> | ||
</meta-data> | ||
<linkpanel id="links" location="top"> | ||
<link id="links[1]" mode="webservice" target="/service/localhost/appng-manager/webservice/threadViewer"> | ||
<permissions> | ||
<permission ref="platform.threads" mode="set"></permission> | ||
</permissions> | ||
<label id="threads">Threads</label> | ||
<icon>goto</icon> | ||
</link> | ||
</linkpanel> | ||
</config> | ||
<data /> | ||
</datasource> |
18 changes: 18 additions & 0 deletions
18
src/test/resources/xml/EnvironmentTest-validateProcessor.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<datasource xmlns="http://www.appng.org/schema/platform" id="processor"> | ||
<config> | ||
<title id="Processor">Processor</title> | ||
<permissions> | ||
<permission ref="platform.environment" mode="set"></permission> | ||
</permissions> | ||
<meta-data bindClass="java.util.Map$Entry"> | ||
<field name="key" type="longtext" binding="key"> | ||
<label id="name">Name</label> | ||
</field> | ||
<field name="value" type="text" binding="value"> | ||
<label id="value">Value</label> | ||
</field> | ||
</meta-data> | ||
</config> | ||
<data /> | ||
</datasource> |
18 changes: 18 additions & 0 deletions
18
src/test/resources/xml/EnvironmentTest-validateSystemEnv.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<datasource xmlns="http://www.appng.org/schema/platform" id="systemEnv"> | ||
<config> | ||
<title id="systemEnvironment">System Environment</title> | ||
<permissions> | ||
<permission ref="platform.environment" mode="set"></permission> | ||
</permissions> | ||
<meta-data bindClass="java.util.Map$Entry"> | ||
<field name="key" type="text" displayLength="60" binding="key"> | ||
<label id="name">Name</label> | ||
</field> | ||
<field name="value" type="text" displayLength="1000" binding="value"> | ||
<label id="value">Value</label> | ||
</field> | ||
</meta-data> | ||
</config> | ||
<data /> | ||
</datasource> |
18 changes: 18 additions & 0 deletions
18
src/test/resources/xml/EnvironmentTest-validateSystemProps.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<datasource xmlns="http://www.appng.org/schema/platform" id="systemProps"> | ||
<config> | ||
<title id="systemProperties">System Properties</title> | ||
<permissions> | ||
<permission ref="platform.environment" mode="set"></permission> | ||
</permissions> | ||
<meta-data bindClass="java.util.Map$Entry"> | ||
<field name="key" type="text" displayLength="60" binding="key"> | ||
<label id="name">Name</label> | ||
</field> | ||
<field name="value" type="text" displayLength="1000" binding="value"> | ||
<label id="value">Value</label> | ||
</field> | ||
</meta-data> | ||
</config> | ||
<data /> | ||
</datasource> |