Skip to content

Commit

Permalink
schema: extracted ScriptCapabilityType.host to separete complex type
Browse files Browse the repository at this point in the history
  - originally  in schema this complex type was annonymous, which
    made it unavailable in Schema Registry
  • Loading branch information
tonydamage committed Feb 28, 2022
1 parent fd56363 commit 1d4c0eb
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.evolveum.midpoint.web.page.admin.resources.PageResourceWizard;
import com.evolveum.midpoint.web.util.InfoTooltipBehavior;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningScriptHostType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityHostType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.WebMarkupContainer;
Expand Down Expand Up @@ -77,10 +78,10 @@ protected void onUpdate(AjaxRequestTarget target) {
}

private IModel prepareOnConnectorModel(){
CapabilityDto dto = (CapabilityDto)getModel().getObject();
CapabilityDto dto = getModel().getObject();
ScriptCapabilityType script = (ScriptCapabilityType)dto.getCapability();

for(ScriptCapabilityType.Host host: script.getHost()){
for(ScriptCapabilityHostType host: script.getHost()){
if(ProvisioningScriptHostType.CONNECTOR.equals(host.getType())){
return new PropertyModel<List<String>>(host, "language");
}
Expand All @@ -91,10 +92,10 @@ private IModel prepareOnConnectorModel(){
}

private IModel prepareOnResourceModel(){
CapabilityDto dto = (CapabilityDto)getModel().getObject();
CapabilityDto dto = getModel().getObject();
ScriptCapabilityType script = (ScriptCapabilityType)dto.getCapability();

for(ScriptCapabilityType.Host host: script.getHost()){
for(ScriptCapabilityHostType host: script.getHost()){
if(ProvisioningScriptHostType.RESOURCE.equals(host.getType())){
return new PropertyModel<List<String>>(host, "language");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7668,7 +7668,7 @@
<xsd:element name="name" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Name of the expression (function). The name is used for several purposed.
Name of the expression (function). The name is used for several purposes.
If the expression is a function in a function library then this name identifies
the function (the name must be unique in the whole library).
But even if the expression is not part of the library the name may still be used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,19 @@

<xsd:element name="testConnection" type="tns:TestConnectionCapabilityType"/>

<xsd:complexType name="ScriptCapabilityHostType">
<xsd:sequence>
<xsd:element name="type" type="c:ProvisioningScriptHostType"/>
<xsd:element name="language" type="xsd:anyURI" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
Specifies the script language(s) supported on this host.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>

<xsd:complexType name="ScriptCapabilityType">
<xsd:annotation>
<xsd:documentation>
Expand All @@ -578,20 +591,7 @@
<xsd:complexContent>
<xsd:extension base="tns:CapabilityType">
<xsd:sequence>
<xsd:element name="host" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="type" type="c:ProvisioningScriptHostType"/>
<xsd:element name="language" type="xsd:anyURI" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:documentation>
Specifies the script language(s) supported on this host.
</xsd:documentation>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="host" maxOccurs="unbounded" type="tns:ScriptCapabilityHostType" />
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
import com.evolveum.midpoint.test.util.TestUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ActivationCapabilityType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityHostType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host;

/**
* The test of Provisioning service on the API level. The test is using CSV resource.
Expand Down Expand Up @@ -250,7 +250,7 @@ public void test006Capabilities() throws Exception {

ScriptCapabilityType capScript = CapabilityUtil.getCapability(nativeCapabilitiesList, ScriptCapabilityType.class);
assertNotNull("No script capability", capScript);
List<Host> scriptHosts = capScript.getHost();
List<ScriptCapabilityHostType> scriptHosts = capScript.getHost();
assertEquals("Wrong number of script hosts", 2, scriptHosts.size());
assertScriptHost(capScript, ProvisioningScriptHostType.CONNECTOR);
assertScriptHost(capScript, ProvisioningScriptHostType.RESOURCE);
Expand All @@ -263,7 +263,7 @@ public void test006Capabilities() throws Exception {
}

private void assertScriptHost(ScriptCapabilityType capScript, ProvisioningScriptHostType expectedHostType) {
for (Host host : capScript.getHost()) {
for (ScriptCapabilityHostType host : capScript.getHost()) {
if (host.getType() == expectedHostType) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
import com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectModificationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.*;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityHostType;
import com.evolveum.prism.xml.ns._public.query_3.QueryType;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;
Expand Down Expand Up @@ -311,9 +311,9 @@ public void test005Capabilities() throws Exception {

ScriptCapabilityType capScript = CapabilityUtil.getCapability(nativeCapabilitiesList, ScriptCapabilityType.class);
assertNotNull("No script capability", capScript);
List<Host> scriptHosts = capScript.getHost();
List<ScriptCapabilityHostType> scriptHosts = capScript.getHost();
assertEquals("Wrong number of script hosts", 1, scriptHosts.size());
Host scriptHost = scriptHosts.get(0);
ScriptCapabilityHostType scriptHost = scriptHosts.get(0);
assertEquals("Wrong script host type", ProvisioningScriptHostType.CONNECTOR, scriptHost.getType());
// assertEquals("Wrong script host language", ....., scriptHost.getLanguage());

Expand Down Expand Up @@ -1352,6 +1352,7 @@ public boolean handle(PrismObject<ObjectType> prismObject, OperationResult paren
assertApproxNumberOfAllResults(searchMetadata, null);
}

@Override
protected void assertShadows(int expectedCount) throws SchemaException {
OperationResult result = new OperationResult(TestOpenDj.class.getName() + ".assertShadows");
int actualCount = repositoryService.countObjects(ShadowType.class, null, null, result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ReadCapabilityType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.RunAsCapabilityType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.SchemaCapabilityType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityHostType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.TestConnectionCapabilityType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.UpdateCapabilityType;
import com.evolveum.midpoint.xml.ns._public.resource.capabilities_3.ScriptCapabilityType.Host;
import com.evolveum.prism.xml.ns._public.types_3.PolyStringType;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedByteArrayType;
import com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType;
Expand Down Expand Up @@ -343,13 +343,13 @@ private void processOperationCapabilities() {
|| connIdSupportedOperations.contains(ScriptOnConnectorApiOp.class)) {
ScriptCapabilityType capScript = new ScriptCapabilityType();
if (connIdSupportedOperations.contains(ScriptOnResourceApiOp.class)) {
Host host = new Host();
ScriptCapabilityHostType host = new ScriptCapabilityHostType();
host.setType(ProvisioningScriptHostType.RESOURCE);
capScript.getHost().add(host);
// language is unknown here
}
if (connIdSupportedOperations.contains(ScriptOnConnectorApiOp.class)) {
Host host = new Host();
ScriptCapabilityHostType host = new ScriptCapabilityHostType();
host.setType(ProvisioningScriptHostType.CONNECTOR);
capScript.getHost().add(host);
// language is unknown here
Expand Down

0 comments on commit 1d4c0eb

Please sign in to comment.