private void setVdbVersion( final Element element, final String attributeName, final BaseArtifactType artifact, final String propertyName ) throws Exception { String version = element.getAttribute(attributeName); if (Utils.isEmpty(version)) { version = Vdb.DEFAULT_VERSION; } SrampModelUtils.setCustomProperty(artifact, propertyName, version); // set artifact version if not already set if (Utils.isEmpty(artifact.getVersion())) { artifact.setVersion(version); } }
/** * Updates the basic s-ramp meta data. * @param artifact * @throws Exception */ private void updateArtifactMetaData(BaseArtifactType artifact) throws Exception { if (artifact.getName() != null) setProperty("sramp:name", artifact.getName()); //$NON-NLS-1$ else setProperty("sramp:name", artifact.getClass().getSimpleName()); //$NON-NLS-1$ if (artifact.getDescription() != null) setProperty("sramp:description", artifact.getDescription()); //$NON-NLS-1$ if (artifact.getVersion() != null) setProperty("version", artifact.getVersion()); //$NON-NLS-1$ setProperty("sramp:derived", this.artifactType.isDerived()); //$NON-NLS-1$ }
LOGGER.debug("VdbManifestDeriver:Import VDB version '{}'", vdbImportArtifact.getVersion()); //$NON-NLS-1$
if (artifact.getVersion()==null) artifact.setVersion(project.getVersion());
/** * Updates the basic s-ramp meta data. * @param srampArtifact * @throws Exception */ private void updateArtifactMetaData(BaseArtifactType srampArtifact) throws Exception { artificerArtifact.setUuid(srampArtifact.getUuid()); artificerArtifact.setModel(artifactType.getModel()); // may have already been set... if (StringUtils.isBlank(artificerArtifact.getType())) { artificerArtifact.setType(artifactType.getType()); } ArtificerUser createdBy = HibernateEntityFactory.user(srampArtifact.getCreatedBy(), srampArtifact.getCreatedTimestamp()); artificerArtifact.setCreatedBy(createdBy); ArtificerUser modifiedBy = HibernateEntityFactory.user(srampArtifact.getLastModifiedBy(), srampArtifact.getLastModifiedTimestamp()); artificerArtifact.setModifiedBy(modifiedBy); if (srampArtifact.getName() != null) artificerArtifact.setName(srampArtifact.getName()); else artificerArtifact.setName(srampArtifact.getClass().getSimpleName()); artificerArtifact.setDescription(srampArtifact.getDescription()); artificerArtifact.setVersion(srampArtifact.getVersion()); }
Assert.assertEquals("d658b181-975c-42c5-ad5c-dc65cb9aa4a1", entry.getMetaData().getUuid()); //$NON-NLS-1$ Assert.assertEquals("sample.xsd", entry.getMetaData().getName()); //$NON-NLS-1$ Assert.assertEquals("1.0", entry.getMetaData().getVersion()); //$NON-NLS-1$ } finally { FileUtils.deleteQuietly(tempFile);
printProperty(Messages.i18n.format("PrintArtifact.UUID"), artifact.getUuid()); printProperty(Messages.i18n.format("PrintArtifact.Name"), artifact.getName()); printProperty(Messages.i18n.format("PrintArtifact.Version"), artifact.getVersion()); printProperty(Messages.i18n.format("PrintArtifact.Derived"), String.valueOf(artifactType.isDerived())); String archiveUuid = artifact.getOtherAttributes().get(ArtificerConstants.ARTIFICER_EXPANDED_FROM_ARCHIVE_UUID_QNAME);
@Test public void testGetArtifact_XSD() throws Exception { String artifactFileName = "PO.xsd"; //$NON-NLS-1$ InputStream POXsd = this.getClass().getResourceAsStream("/sample-files/xsd/" + artifactFileName); //$NON-NLS-1$ Document document = new Document(); document.setName(artifactFileName); document.setArtifactType(BaseArtifactEnum.XSD_DOCUMENT); BaseArtifactType artifact = persistenceManager.persistArtifact(document, POXsd); Assert.assertNotNull(artifact); log.info("persisted PO.xsd to JCR, returned artifact uuid=" + artifact.getUuid()); //$NON-NLS-1$ Assert.assertEquals(XsdDocument.class, artifact.getClass()); long size = ((DocumentArtifactType) artifact).getContentSize(); Assert.assertTrue(size >= 2376L); // Not doing an equals here due to the vagaries of Windows vs *nix line endings BaseArtifactType artifact2 = persistenceManager.getArtifact(artifact.getUuid(), ArtifactType.XsdDocument()); Assert.assertEquals(artifact.getUuid(), artifact2.getUuid()); Assert.assertEquals(artifact.getCreatedBy(), artifact2.getCreatedBy()); Assert.assertEquals(artifact.getDescription(), artifact2.getDescription()); Assert.assertEquals(artifact.getLastModifiedBy(), artifact2.getLastModifiedBy()); Assert.assertEquals(artifact.getName(), artifact2.getName()); Assert.assertEquals(artifact.getVersion(), artifact2.getVersion()); Assert.assertEquals(artifact.getLastModifiedTimestamp(), artifact2.getLastModifiedTimestamp()); }
importVdb = derivedArtifact; assertThat(importVdb.getName(), is("x")); assertThat(importVdb.getVersion(), is("2")); assertPropertyValue(importVdb, VdbImport.PropertyId.VERSION, "2"); assertPropertyValue(importVdb, VdbImport.PropertyId.IMPORT_DATA_POLICIES, "true");
Assert.assertEquals("My PO", artifact.getName()); //$NON-NLS-1$ Assert.assertEquals("A new description of the PO.xsd artifact.", artifact.getDescription()); //$NON-NLS-1$ Assert.assertEquals("2.0.13", artifact.getVersion()); //$NON-NLS-1$