Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Aug 20, 2021
2 parents c3a2ff7 + a1b9341 commit 9bbb0ed
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ public boolean isDisplayNameAttribute() {
@Override
public Optional<ComplexTypeDefinition> structuredType() {
if(structuredType == null) {
this.structuredType = Optional.ofNullable(prismContext.getSchemaRegistry().findComplexTypeDefinitionByType(typeName));
this.structuredType = Optional.ofNullable(getPrismContext().getSchemaRegistry().findComplexTypeDefinitionByType(typeName));
}
return structuredType;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ public void setDisplayNameAttribute(QName displayName) {

@Override
public <X> ResourceAttributeDefinitionImpl<X> createAttributeDefinition(QName name, QName typeName) {
ResourceAttributeDefinitionImpl<X> propDef = new ResourceAttributeDefinitionImpl<>(name, typeName, prismContext);
ResourceAttributeDefinitionImpl<X> propDef = new ResourceAttributeDefinitionImpl<>(name, typeName, getPrismContext());
add(propDef);
return propDef;
}
Expand Down Expand Up @@ -239,7 +239,7 @@ public static ResourceAttributeContainer instantiate(QName elementName, ObjectCl
@Override
public ObjectClassComplexTypeDefinitionImpl clone() {
ObjectClassComplexTypeDefinitionImpl clone = new ObjectClassComplexTypeDefinitionImpl(
getTypeName(), prismContext);
getTypeName(), getPrismContext());
copyDefinitionData(clone);
clone.shared = false;
return clone;
Expand Down Expand Up @@ -347,6 +347,7 @@ public boolean equals(Object obj) {
return true;
}

@Override
protected String getDebugDumpClassName() {
return "OCD";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,14 @@ public ResourceAttributeContainer instantiate() {
@Override
public ResourceAttributeContainer instantiate(QName name) {
name = DefinitionUtil.addNamespaceIfApplicable(name, this.itemName);
return new ResourceAttributeContainerImpl(name, this, prismContext);
return new ResourceAttributeContainerImpl(name, this, getPrismContext());
}

@NotNull
@Override
public ResourceAttributeContainerDefinitionImpl clone() {
ResourceAttributeContainerDefinitionImpl clone = new ResourceAttributeContainerDefinitionImpl(itemName,
(ObjectClassComplexTypeDefinition)complexTypeDefinition.clone(), prismContext);
(ObjectClassComplexTypeDefinition)complexTypeDefinition.clone(), getPrismContext());
copyDefinitionData(clone);
return clone;
}
Expand Down Expand Up @@ -346,7 +346,7 @@ public List<? extends ResourceAttributeDefinition> getDefinitions() {
@Override
public @NotNull <T extends ShadowType> PrismObjectDefinition<T> toShadowDefinition() {
//noinspection unchecked
PrismObjectDefinition<T> origShadowDef = (PrismObjectDefinition<T>) prismContext.getSchemaRegistry().
PrismObjectDefinition<T> origShadowDef = (PrismObjectDefinition<T>) getPrismContext().getSchemaRegistry().
findObjectDefinitionByCompileTimeClass(ShadowType.class);
return origShadowDef.cloneWithReplacedDefinition(ShadowType.F_ATTRIBUTES, this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ResourceAttribute<T> instantiate() {
@Override
public ResourceAttribute<T> instantiate(QName name) {
name = addNamespaceIfApplicable(name, this.itemName);
return new ResourceAttributeImpl<>(name, this, prismContext);
return new ResourceAttributeImpl<>(name, this, getPrismContext());
}

@Override
Expand Down Expand Up @@ -188,6 +188,7 @@ public int hashCode() {
return Objects.hash(super.hashCode(), nativeAttributeName, frameworkAttributeName, returnedByDefault);
}

@Override
protected void extendToString(StringBuilder sb) {
super.extendToString(sb);
if (getNativeAttributeName()!=null) {
Expand All @@ -207,6 +208,7 @@ protected void extendToString(StringBuilder sb) {
/**
* Return a human readable name of this class suitable for logs.
*/
@Override
protected String getDebugDumpClassName() {
return "RAD";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ public static void setConnectorXsdSchema(PrismObject<ConnectorType> connector, E
PrismContainer<XmlSchemaType> schemaContainer;
try {
schemaContainer = connector.findOrCreateContainer(ConnectorType.F_SCHEMA);
PrismProperty<SchemaDefinitionType> definitionProperty = schemaContainer.findOrCreateProperty(XmlSchemaType.F_DEFINITION);

PrismContainerValue<XmlSchemaType> schemaInstance = schemaContainer.getAnyValue();
if (schemaInstance == null) {
schemaInstance = schemaContainer.createNewValue();
}
PrismProperty<SchemaDefinitionType> definitionProperty = schemaInstance.findOrCreateProperty(XmlSchemaType.F_DEFINITION);
ObjectTypeUtil.setXsdSchemaDefinition(definitionProperty, xsdElement);
} catch (SchemaException e) {
// Should not happen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,8 @@ public void testAssignmentEquivalent() {
assertFalse(a2.asPrismContainerValue().equivalent(a1.asPrismContainerValue())); // a bit redundant
}

@Test
// Disabled, prismContext is now always present
@Test(enabled = false)
public void testContextlessAssignmentEquals() throws Exception {
AssignmentType a1 = new AssignmentType(); // no prismContext here
a1.setDescription("descr1");
Expand All @@ -202,7 +203,7 @@ public void testContextlessAssignmentEquals() throws Exception {
assertTrue(a1.equals(a3));
}

@Test
@Test(enabled = false)
public void testContextlessAssignmentEquals2() throws Exception {
// (1) user without prismContext - the functionality is reduced

Expand Down

0 comments on commit 9bbb0ed

Please sign in to comment.