LOGGER.debug("VdbManifestDeriver:entry description '{}'", entryArtifact.getDescription()); //$NON-NLS-1$
LOGGER.debug("VdbManifestDeriver:translator description '{}'", translatorArtifact.getDescription()); //$NON-NLS-1$
/** * 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$ }
if (artifact.getCreatedBy() != null) entry.getAuthors().add(new Person(artifact.getCreatedBy())); if (artifact.getDescription() != null) entry.setSummary(artifact.getDescription());
LOGGER.debug("VdbManifestDeriver:schema description '{}'", schemaArtifact.getDescription()); //$NON-NLS-1$
LOGGER.debug("VdbManifestDeriver:data policy description '{}'", dataPolicyArtifact.getDescription()); //$NON-NLS-1$
if (artifact.getCreatedBy() != null) entry.getAuthors().add(new Person(artifact.getCreatedBy())); if (artifact.getDescription() != null) entry.setSummary(artifact.getDescription()); entry.getExtensionAttributes().put(SrampConstants.SRAMP_DERIVED_QNAME, String.valueOf(artifactType.isDerived()));
if (artifact.getDescription()==null) artifact.setDescription(project.getDescription()); if (artifact.getName()==null) artifact.setName(project.getName()); 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()); }
/** * Tests updating an artifact. * @throws Exception */ public void testUpdateArtifactMetaData() throws Exception { SrampAtomApiClient client = new SrampAtomApiClient(generateURL("/s-ramp")); //$NON-NLS-1$ String uuid = null; XsdDocument xsdDoc = null; // First, upload an artifact so we have some content to update String artifactFileName = "PO.xsd"; //$NON-NLS-1$ InputStream is = this.getClass().getResourceAsStream("/sample-files/xsd/" + artifactFileName); //$NON-NLS-1$ try { BaseArtifactType artifact = client.uploadArtifact(ArtifactType.XsdDocument(), is, artifactFileName); Assert.assertNotNull(artifact); Assert.assertEquals(artifactFileName, artifact.getName()); uuid = artifact.getUuid(); xsdDoc = (XsdDocument) artifact; } finally { IOUtils.closeQuietly(is); } // Now update the description xsdDoc.setDescription("** DESCRIPTION UPDATED **"); //$NON-NLS-1$ client.updateArtifactMetaData(xsdDoc); // Now verify BaseArtifactType artifact = client.getArtifactMetaData(ArtifactType.XsdDocument(), uuid.toString()); Assert.assertEquals("** DESCRIPTION UPDATED **", artifact.getDescription()); //$NON-NLS-1$ }
if (artifact.getLastModifiedTimestamp() != null) printProperty(Messages.i18n.format("PrintArtifact.ModifiedOn"), artifact.getLastModifiedTimestamp().toXMLFormat()); if (artifact.getDescription() != null) { commandInvocation.getShell().out().println(Messages.i18n.format("PrintArtifact.DescriptionHeading")); commandInvocation.getShell().out().println(artifact.getDescription());
/** * Tests the query manager. * @throws Exception */ @Test public void testQueryManager() throws Exception { // First, store an artifact. BaseArtifactType artifact = createDocument(1); log.info("persisted to JCR, returned artifact uuid=" + artifact.getUuid()); //$NON-NLS-1$ // Now query for it SrampQuery query = queryManager.createQuery("/s-ramp/core/Document"); //$NON-NLS-1$ ArtifactSet artifactSet = query.executeQuery(); Assert.assertNotNull(artifactSet); Assert.assertEquals(1, artifactSet.size()); BaseArtifactType found = artifactSet.iterator().next(); Assert.assertNotNull("Expected artifact not found in artifact set.", found); //$NON-NLS-1$ Assert.assertEquals(artifact.getUuid(), found.getUuid()); Assert.assertEquals(artifact.getName(), found.getName()); Assert.assertEquals(artifact.getDescription(), found.getDescription()); Assert.assertEquals(artifact.getLastModifiedBy(), found.getLastModifiedBy()); }
@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()); }
foundTranslator = true; assertThat(artifactName, is("oracleOverride")); assertThat(derivedArtifact.getDescription(), is("hello world")); assertThat(derivedArtifact.getProperty().size(), is(2)); assertPropertyValue(derivedArtifact, VdbTranslator.PropertyId.TYPE, "oracle"); if (!foundEntry1 && "/path-one".equals(artifactName)) { foundEntry1 = true; assertThat(derivedArtifact.getDescription(), is("path one description")); assertPropertyValue(derivedArtifact, "entryone", "1"); assertThat(derivedArtifact.getProperty().size(), is(1)); assertThat(physicalModel.getDescription(), is("model description")); assertPropertyValue(physicalModel, "model-prop", "model-value-override"); assertThat(dataPolicy.getDescription(), is("roleOne described")); assertPropertyValue(dataPolicy, VdbDataPolicy.PropertyId.ANY_AUTHENTICATED, "false"); assertPropertyValue(dataPolicy, VdbDataPolicy.PropertyId.TEMP_TABLE_CREATABLE, "true");
/** * 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$ }
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$
assertThat(physicalModel.getName(), is("ProductsSS")); assertPropertyValue(physicalModel, VdbSchema.PropertyId.PATH_IN_VDB, "/TestProducts/ProductsSS.xmi"); assertThat(physicalModel.getDescription(), is("SQL Server products relational model")); assertPropertyValue(physicalModel, VdbSchema.PropertyId.CHECKSUM, "3463730926"); assertPropertyValue(physicalModel, VdbSchema.PropertyId.MODEL_UUID, "mmuuid:99038f39-aaf6-4be5-98e7-cfb2e604424f");