Search in sources :

Example 36 with ObjectFactory

use of net.opengis.cat.csw.v_2_0_2.ObjectFactory in project cxf by apache.

the class AbstractTypeTestClient2 method testChoiceWithSubstitutionGroupNil.

@Test
public void testChoiceWithSubstitutionGroupNil() throws Exception {
    if (!shouldRunTest("ChoiceWithSubstitutionGroupNil")) {
        return;
    }
    ObjectFactory objectFactory = new ObjectFactory();
    ChoiceWithSubstitutionGroupNil x = new ChoiceWithSubstitutionGroupNil();
    JAXBElement<BigInteger> varInt = objectFactory.createChoiceWithSubstitutionGroupNilVarInt(null);
    x.setVarInt(varInt);
    ChoiceWithSubstitutionGroupNil yOrig = new ChoiceWithSubstitutionGroupNil();
    JAXBElement<? extends SgBaseTypeA> elementA = objectFactory.createSg04NillableBaseElementA(null);
    yOrig.setSg04NillableBaseElementA(elementA);
    Holder<ChoiceWithSubstitutionGroupNil> y = new Holder<>(yOrig);
    Holder<ChoiceWithSubstitutionGroupNil> z = new Holder<>();
    ChoiceWithSubstitutionGroupNil ret;
    if (testDocLiteral) {
        ret = docClient.testChoiceWithSubstitutionGroupNil(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testChoiceWithSubstitutionGroupNil(x, y, z);
    } else {
        ret = rpcClient.testChoiceWithSubstitutionGroupNil(x, y, z);
    }
    if (!perfTestOnly) {
        assertTrue("testChoiceWithSubstitutionGroupNil(): Incorrect value for inout param", equals(x, y.value));
        assertTrue("testChoiceWithSubstitutionGroupNil(): Incorrect value for out param", equals(yOrig, z.value));
        assertTrue("testChoiceWithSubstitutionGroupNil(): Incorrect return value", equals(x, ret));
    }
}
Also used : ObjectFactory(org.apache.type_test.types3.ObjectFactory) Holder(javax.xml.ws.Holder) BigInteger(java.math.BigInteger) ChoiceWithSubstitutionGroupNil(org.apache.type_test.types3.ChoiceWithSubstitutionGroupNil) Test(org.junit.Test)

Example 37 with ObjectFactory

use of net.opengis.cat.csw.v_2_0_2.ObjectFactory in project cxf by apache.

the class AbstractTypeTestClient2 method testChoiceWithSubstitutionGroup.

@Test
public void testChoiceWithSubstitutionGroup() throws Exception {
    if (!shouldRunTest("ChoiceWithSubstitutionGroup")) {
        return;
    }
    SgBaseTypeA baseA = new SgBaseTypeA();
    baseA.setVarInt(BigInteger.ONE);
    ObjectFactory objectFactory = new ObjectFactory();
    JAXBElement<? extends SgBaseTypeA> elementA = objectFactory.createSg01BaseElementA(baseA);
    SgDerivedTypeB derivedB = new SgDerivedTypeB();
    derivedB.setVarInt(new BigInteger("32"));
    derivedB.setVarString("SgDerivedTypeB");
    JAXBElement<? extends SgBaseTypeA> elementB = objectFactory.createSg01DerivedElementB(derivedB);
    ChoiceWithSubstitutionGroup x = new ChoiceWithSubstitutionGroup();
    x.setSg01BaseElementA(elementA);
    ChoiceWithSubstitutionGroup yOrig = new ChoiceWithSubstitutionGroup();
    yOrig.setSg01BaseElementA(elementB);
    Holder<ChoiceWithSubstitutionGroup> y = new Holder<>(yOrig);
    Holder<ChoiceWithSubstitutionGroup> z = new Holder<>();
    assertTrue("yoo: ", equals(y.value, y.value));
    ChoiceWithSubstitutionGroup ret;
    if (testDocLiteral) {
        ret = docClient.testChoiceWithSubstitutionGroup(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testChoiceWithSubstitutionGroup(x, y, z);
    } else {
        ret = rpcClient.testChoiceWithSubstitutionGroup(x, y, z);
    }
    if (!perfTestOnly) {
        assertTrue("testChoiceWithSubstitutionGroup(): Incorrect value for inout param", equals(x, y.value));
        assertTrue("testChoiceWithSubstitutionGroup(): Incorrect value for out param", equals(yOrig, z.value));
        assertTrue("testChoiceWithSubstitutionGroup(): Incorrect return value", equals(x, ret));
    }
}
Also used : ChoiceWithSubstitutionGroup(org.apache.type_test.types3.ChoiceWithSubstitutionGroup) SgDerivedTypeB(org.apache.type_test.types3.SgDerivedTypeB) ObjectFactory(org.apache.type_test.types3.ObjectFactory) SgBaseTypeA(org.apache.type_test.types3.SgBaseTypeA) Holder(javax.xml.ws.Holder) BigInteger(java.math.BigInteger) Test(org.junit.Test)

Example 38 with ObjectFactory

use of net.opengis.cat.csw.v_2_0_2.ObjectFactory in project cxf by apache.

the class AbstractTypeTestClient2 method testStructWithSubstitutionGroup.

@Test
public void testStructWithSubstitutionGroup() throws Exception {
    if (!shouldRunTest("StructWithSubstitutionGroup")) {
        return;
    }
    SgBaseTypeA baseA = new SgBaseTypeA();
    baseA.setVarInt(BigInteger.ONE);
    SgDerivedTypeB derivedB = new SgDerivedTypeB();
    derivedB.setVarInt(new BigInteger("32"));
    derivedB.setVarString("foo");
    ObjectFactory objectFactory = new ObjectFactory();
    StructWithSubstitutionGroup x = new StructWithSubstitutionGroup();
    JAXBElement<? extends SgBaseTypeA> elementA = objectFactory.createSg01BaseElementA(baseA);
    x.setSg01BaseElementA(elementA);
    StructWithSubstitutionGroup yOrig = new StructWithSubstitutionGroup();
    JAXBElement<? extends SgBaseTypeA> elementB = objectFactory.createSg01DerivedElementB(derivedB);
    yOrig.setSg01BaseElementA(elementB);
    Holder<StructWithSubstitutionGroup> y = new Holder<>(yOrig);
    Holder<StructWithSubstitutionGroup> z = new Holder<>();
    StructWithSubstitutionGroup ret;
    if (testDocLiteral) {
        ret = docClient.testStructWithSubstitutionGroup(x, y, z);
    } else if (testXMLBinding) {
        ret = xmlClient.testStructWithSubstitutionGroup(x, y, z);
    } else {
        ret = rpcClient.testStructWithSubstitutionGroup(x, y, z);
    }
    if (!perfTestOnly) {
        assertTrue("testStructWithSubstitutionGroup(): Incorrect value for inout param", equals(x, y.value));
        assertTrue("testStructWithSubstitutionGroup(): Incorrect value for out param", equals(yOrig, z.value));
        assertTrue("testStructWithSubstitutionGroup(): Incorrect return value", equals(x, ret));
    }
}
Also used : SgDerivedTypeB(org.apache.type_test.types3.SgDerivedTypeB) StructWithSubstitutionGroup(org.apache.type_test.types3.StructWithSubstitutionGroup) ObjectFactory(org.apache.type_test.types3.ObjectFactory) SgBaseTypeA(org.apache.type_test.types3.SgBaseTypeA) Holder(javax.xml.ws.Holder) BigInteger(java.math.BigInteger) Test(org.junit.Test)

Example 39 with ObjectFactory

use of net.opengis.cat.csw.v_2_0_2.ObjectFactory in project midpoint by Evolveum.

the class ConsistencyTest method test511AssignAccountMorgan.

/**
	 * assign account to the user morgan. Account with the same 'uid' (not dn, nut other secondary identifier already exists)
	 * account should be linked to the user.
	 * @throws Exception
	 */
@Test
public void test511AssignAccountMorgan() throws Exception {
    final String TEST_NAME = "test511AssignAccountMorgan";
    TestUtil.displayTestTile(this, TEST_NAME);
    // GIVEN
    openDJController.assumeRunning();
    Task task = taskManager.createTaskInstance(ConsistencyTest.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    dummyAuditService.clear();
    //prepare new OU in opendj
    Entry entry = openDJController.addEntryFromLdifFile(LDIF_CREATE_USERS_OU_FILENAME);
    PrismObject<UserType> user = repositoryService.getObject(UserType.class, USER_MORGAN_OID, null, result);
    display("User Morgan: ", user);
    PrismReference linkRef = user.findReference(UserType.F_LINK_REF);
    ExpressionType expression = new ExpressionType();
    ObjectFactory of = new ObjectFactory();
    RawType raw = new RawType(new PrimitiveXNode("uid=morgan,ou=users,dc=example,dc=com"), prismContext);
    JAXBElement val = of.createValue(raw);
    expression.getExpressionEvaluator().add(val);
    MappingType mapping = new MappingType();
    mapping.setExpression(expression);
    ResourceAttributeDefinitionType attrDefType = new ResourceAttributeDefinitionType();
    attrDefType.setRef(new ItemPathType(new ItemPath(getOpenDjSecondaryIdentifierQName())));
    attrDefType.setOutbound(mapping);
    ConstructionType construction = new ConstructionType();
    construction.getAttribute().add(attrDefType);
    construction.setResourceRef(ObjectTypeUtil.createObjectRef(resourceTypeOpenDjrepo));
    AssignmentType assignment = new AssignmentType();
    assignment.setConstruction(construction);
    ObjectDelta<UserType> userDelta = ObjectDelta.createModificationAddContainer(UserType.class, USER_MORGAN_OID, UserType.F_ASSIGNMENT, prismContext, assignment.asPrismContainerValue());
    Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(userDelta);
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    modelService.executeChanges(deltas, null, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    //		assertEquals("Expected handled error but got: " + result.getStatus(), OperationResultStatus.HANDLED_ERROR, result.getStatus());
    PrismObject<UserType> userMorgan = modelService.getObject(UserType.class, USER_MORGAN_OID, null, task, result);
    display("User morgan after", userMorgan);
    UserType userMorganType = userMorgan.asObjectable();
    assertEquals("Unexpected number of accountRefs", 1, userMorganType.getLinkRef().size());
    String accountOid = userMorganType.getLinkRef().iterator().next().getOid();
    // Check shadow
    PrismObject<ShadowType> accountShadow = repositoryService.getObject(ShadowType.class, accountOid, null, result);
    assertShadowRepo(accountShadow, accountOid, "uid=morgan,ou=people,dc=example,dc=com", resourceTypeOpenDjrepo, RESOURCE_OPENDJ_ACCOUNT_OBJECTCLASS);
    // Check account
    PrismObject<ShadowType> accountModel = modelService.getObject(ShadowType.class, accountOid, null, task, result);
    assertShadowModel(accountModel, accountOid, "uid=morgan,ou=people,dc=example,dc=com", resourceTypeOpenDjrepo, RESOURCE_OPENDJ_ACCOUNT_OBJECTCLASS);
    ResourceAttribute attributes = ShadowUtil.getAttribute(accountModel, new QName(resourceTypeOpenDjrepo.getNamespace(), "uid"));
    assertEquals("morgan", attributes.getAnyRealValue());
// TODO: check OpenDJ Account        
}
Also used : MappingType(com.evolveum.midpoint.xml.ns._public.common.common_3.MappingType) Task(com.evolveum.midpoint.task.api.Task) PrimitiveXNode(com.evolveum.midpoint.prism.xnode.PrimitiveXNode) ItemPathType(com.evolveum.prism.xml.ns._public.types_3.ItemPathType) ResourceAttributeDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceAttributeDefinitionType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) Entry(org.opends.server.types.Entry) ObjectFactory(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory) RawType(com.evolveum.prism.xml.ns._public.types_3.RawType) ObjectDelta(com.evolveum.midpoint.prism.delta.ObjectDelta) ResourceAttribute(com.evolveum.midpoint.schema.processor.ResourceAttribute) ConstructionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ConstructionType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) QName(javax.xml.namespace.QName) JAXBElement(javax.xml.bind.JAXBElement) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) PrismReference(com.evolveum.midpoint.prism.PrismReference) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) ExpressionType(com.evolveum.midpoint.xml.ns._public.common.common_3.ExpressionType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test) AbstractModelIntegrationTest(com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)

Example 40 with ObjectFactory

use of net.opengis.cat.csw.v_2_0_2.ObjectFactory in project midpoint by Evolveum.

the class ParamsTypeUtil method setUnknownJavaObjectEntry.

private static void setUnknownJavaObjectEntry(EntryType entryType, Serializable value) {
    UnknownJavaObjectType ujo = new UnknownJavaObjectType();
    ujo.setClazz(value.getClass().getName());
    ujo.setToString(value.toString());
    entryType.setEntryValue(new ObjectFactory().createUnknownJavaObject(ujo));
}
Also used : ObjectFactory(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory) UnknownJavaObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.UnknownJavaObjectType)

Aggregations

Test (org.junit.Test)23 JAXBElement (javax.xml.bind.JAXBElement)22 ObjectFactory (net.opengis.cat.csw.v_2_0_2.ObjectFactory)20 QueryType (net.opengis.cat.csw.v_2_0_2.QueryType)18 GetRecordsType (net.opengis.cat.csw.v_2_0_2.GetRecordsType)17 QName (javax.xml.namespace.QName)13 CswRecordCollection (org.codice.ddf.spatial.ogc.csw.catalog.common.CswRecordCollection)13 XStream (com.thoughtworks.xstream.XStream)12 ByteArrayInputStream (java.io.ByteArrayInputStream)12 GetRecordsResponseType (net.opengis.cat.csw.v_2_0_2.GetRecordsResponseType)12 SearchResultsType (net.opengis.cat.csw.v_2_0_2.SearchResultsType)12 ArrayList (java.util.ArrayList)11 Marshaller (javax.xml.bind.Marshaller)11 ElementSetNameType (net.opengis.cat.csw.v_2_0_2.ElementSetNameType)11 MarshallingContext (com.thoughtworks.xstream.converters.MarshallingContext)10 HierarchicalStreamWriter (com.thoughtworks.xstream.io.HierarchicalStreamWriter)10 StringWriter (java.io.StringWriter)10 BigInteger (java.math.BigInteger)10 JAXBContext (javax.xml.bind.JAXBContext)10 ObjectFactory (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectFactory)8