Package org.apache.stanbol.entityhub.servicesapi.yard

Examples of org.apache.stanbol.entityhub.servicesapi.yard.Yard.create()


    public Representation create() throws YardException {
        Yard yard = getCacheYard();
        if (yard == null) {
            return createRepresentation(null);
        } else {
            return yard.create();
        }
    }

    @Override
    public Representation create(String id) throws IllegalArgumentException, YardException {
View Full Code Here


    public Representation create(String id) throws IllegalArgumentException, YardException {
        Yard yard = getCacheYard();
        if (yard == null) {
            return createRepresentation(id);
        } else {
            return yard.create(id);
        }
    }

    /**
     * Only used to create a representation if the Yard is currently not available
View Full Code Here

    }

    @Test
    public void testDefaultCreate() throws YardException {
        Yard yard = getYard();
        Representation test = yard.create();
        assertNotNull(test);
        Representation test2 = yard.create();
        assertNotNull(test2);
        assertNotSame(test, test2);
        assertFalse("Two Representation created with create() MUST NOT be equals", test.equals(test2));
View Full Code Here

    @Test
    public void testDefaultCreate() throws YardException {
        Yard yard = getYard();
        Representation test = yard.create();
        assertNotNull(test);
        Representation test2 = yard.create();
        assertNotNull(test2);
        assertNotSame(test, test2);
        assertFalse("Two Representation created with create() MUST NOT be equals", test.equals(test2));
    }
View Full Code Here

    }

    @Test
    public void testCreateWithNull() throws YardException {
        Yard yard = getYard();
        Representation test = yard.create(null);
        assertNotNull("Parsing NULL to create(String) MUST create a valid Representation", test);
        representationIds.add(test.getId()); // add id to cleanup list
        Representation test2 = yard.create(null);
        assertNotNull("Parsing NULL to create(String) MUST create a valid Representation", test2);
        representationIds.add(test2.getId()); // add id to cleanup list
View Full Code Here

    public void testCreateWithNull() throws YardException {
        Yard yard = getYard();
        Representation test = yard.create(null);
        assertNotNull("Parsing NULL to create(String) MUST create a valid Representation", test);
        representationIds.add(test.getId()); // add id to cleanup list
        Representation test2 = yard.create(null);
        assertNotNull("Parsing NULL to create(String) MUST create a valid Representation", test2);
        representationIds.add(test2.getId()); // add id to cleanup list
        assertNotSame(test, test2);
        assertFalse("Two Representation created with create(null) MUST NOT be equals", test.equals(test2));
    }
View Full Code Here

    @Test(expected = IllegalArgumentException.class)
    public void testCreateWithExistingId() throws YardException {
        Yard yard = getYard();
        Representation test = create();
        assertNotNull(test);
        yard.create(test.getId()); // throws an IllegalArgumentException
    }

    @Test(expected = IllegalArgumentException.class)
    public void testIsRepresentationWithNull() throws YardException {
        getYard().isRepresentation(null);
View Full Code Here

            return null;
        }
        Yard entityhubYard = lookupYard();
        ValueFactory valueFactory = entityhubYard.getValueFactory();
        //Create the locally managed Entity
        Representation localRep = entityhubYard.create(constructResourceId(DEFAULT_MANAGED_ENTITY_PREFIX));
        Entity localEntity = loadEntity(entityhubYard, localRep);
        importEntity(remoteEntity, site, localEntity, valueFactory);

        //Second create and init the Mapping
        Representation entityMappingRepresentation = entityhubYard.create(
View Full Code Here

        Representation localRep = entityhubYard.create(constructResourceId(DEFAULT_MANAGED_ENTITY_PREFIX));
        Entity localEntity = loadEntity(entityhubYard, localRep);
        importEntity(remoteEntity, site, localEntity, valueFactory);

        //Second create and init the Mapping
        Representation entityMappingRepresentation = entityhubYard.create(
            constructResourceId(DEFAULT_MAPPING_PREFIX));
        Entity entityMappingEntity = loadEntity(entityhubYard, entityMappingRepresentation);
        establishMapping(localEntity, remoteEntity, site, entityMappingEntity);
       
        //Store the entity and the mappedEntity in the entityhubYard
View Full Code Here

        String field = "urn:the.field:used.for.this.Test";
        String testValue = "This is a test";
        Yard yard = getYard();
        // use both ways to add the two Representations (should make no differences,
        // but one never can know ...
        Representation test1 = yard.create(id); // create and add
        Representation test2 = yard.getValueFactory().createRepresentation(id2); // create
        test2.add(field, testValue); // add value
        yard.store(test2);// store
        assertTrue(yard.isRepresentation(test1.getId())); // test if stored
        assertTrue(yard.isRepresentation(test2.getId()));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.