@Test public void testPersistArtifact_ExtendedArtifactType() throws Exception { ExtendedArtifactType extendedArtifact = new ExtendedArtifactType(); extendedArtifact.setArtifactType(BaseArtifactEnum.EXTENDED_ARTIFACT_TYPE); extendedArtifact.setExtendedType("FooArtifactType"); //$NON-NLS-1$ extendedArtifact.setName("MyExtendedArtifact"); //$NON-NLS-1$ extendedArtifact.setDescription("This is a simple description for testing."); //$NON-NLS-1$ BaseArtifactType artifact = persistenceManager.persistArtifact(extendedArtifact, null); Assert.assertNotNull(artifact); log.info("persisted extended artifact to JCR, returned artifact uuid=" + artifact.getUuid()); //$NON-NLS-1$ //print out the derived node if (log.isDebugEnabled()) { persistenceManager.printArtifactGraph(artifact.getUuid(), ArtifactType.XmlDocument()); } Assert.assertEquals(ExtendedArtifactType.class, artifact.getClass()); String name = ((ExtendedArtifactType) artifact).getName(); String description = ((ExtendedArtifactType) artifact).getDescription(); Assert.assertEquals("MyExtendedArtifact", name); //$NON-NLS-1$ Assert.assertEquals("This is a simple description for testing.", description); //$NON-NLS-1$ }
/** * Test method for {@link SrampAtomApiClient#createArtifact(BaseArtifactType)}. */ @Test public void testCreateArtifact() throws Exception { ExtendedArtifactType artifact = new ExtendedArtifactType(); artifact.setArtifactType(BaseArtifactEnum.EXTENDED_ARTIFACT_TYPE); artifact.setExtendedType("TestArtifact"); //$NON-NLS-1$ artifact.setName("My Test Artifact"); //$NON-NLS-1$ artifact.setDescription("Description of my test artifact."); //$NON-NLS-1$ SrampAtomApiClient client = new SrampAtomApiClient(generateURL("/s-ramp")); //$NON-NLS-1$ BaseArtifactType createdArtifact = client.createArtifact(artifact); Assert.assertNotNull(artifact); Assert.assertEquals("My Test Artifact", createdArtifact.getName()); //$NON-NLS-1$ Assert.assertEquals("Description of my test artifact.", createdArtifact.getDescription()); //$NON-NLS-1$ }