本文整理汇总了Java中org.wso2.carbon.registry.core.Resource.setDescription方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.setDescription方法的具体用法?Java Resource.setDescription怎么用?Java Resource.setDescription使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.registry.core.Resource
的用法示例。
在下文中一共展示了Resource.setDescription方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetCollectionAssociation
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void testGetCollectionAssociation() throws Exception {
Resource r2 = registry.newCollection();
String path = "/getcol1/getcol2/getcol3";
r2.setDescription("this is test desc");
r2.setProperty("test2", "value2");
registry.put(path, r2);
registry.addAssociation(path, "/vtr2121/test", "testasstype1");
registry.addAssociation(path, "/vtr2122/test", "testasstype2");
registry.addAssociation(path, "/vtr2123/test", "testasstype3");
assertTrue("association Destination path not exist", getAssocitionbyDestinationByType(path, "testasstype1", "/vtr2121/test"));
assertTrue("association Destination path not exist", getAssocitionbyDestinationByType(path, "testasstype2", "/vtr2122/test"));
assertTrue("association Destination path not exist", getAssocitionbyDestinationByType(path, "testasstype3", "/vtr2123/test"));
assertTrue("association Type not exist", getAssocitionbyType(path, "testasstype1"));
assertTrue("association Type not exist", getAssocitionbyType(path, "testasstype2"));
assertTrue("association Type not exist", getAssocitionbyType(path, "testasstype3"));
assertTrue("association Source path not exist", getAssocitionbySourceByType(path, "testasstype1"));
assertTrue("association Source path not exist", getAssocitionbySourceByType(path, "testasstype2"));
assertTrue("association Source path not exist", getAssocitionbySourceByType(path, "testasstype3"));
}
示例2: setUp
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
super.setUp();
Resource resource = registry.newResource();
byte[] r1content = RegistryUtils.encodeString("Resource 17 content");
resource.setContent(r1content);
resource.setMediaType("application/test");
resource.setDescription("Sample 17 Description");
resource.setVersionableChange(true);
resource.addAspect("Servicelifecycle");
registry.put("/test/2017/10/18", resource);
registry.addAspect("Servicelifecycle", new DefaultLifecycle());
SimulationService simulationService = new RegistryCoreServiceComponent.DefaultSimulationService();
simulationService.setSimulation(false);
CommonUtil.setSimulationService(simulationService);
}
示例3: testRatingsPath
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void testRatingsPath() throws Exception {
Resource r5 = registry.newResource();
String r5Content = "this is r5 content";
r5.setContent(RegistryUtils.encodeString(r5Content));
r5.setDescription("production ready.");
String r5Path = "/c1/r5";
registry.put(r5Path, r5);
registry.rateResource("/c1/r5", 3);
Resource ratings = registry.get("/c1/r5;ratings");
String[] ratingPaths = (String[]) ratings.getContent();
int rating;
Resource c1 = registry.get(ratingPaths[0]);
Object o = c1.getContent();
if (o instanceof Integer) {
rating = (Integer) o;
} else {
rating = Integer.parseInt(o.toString());
}
assertEquals("Ratings are not retrieved properly as resources.", rating, 3);
}
示例4: testIndexing
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void testIndexing() throws RegistryException {
Resource r6 = registry.newResource();
String r6Content = "this is r6 content";
r6.setContent(RegistryUtils.encodeString(r6Content));
r6.setDescription("production ready.");
r6.setMediaType("text/plain");
String r6Path = "/c1/r6";
try {
registry.put(r6Path, r6);
} catch (RegistryException e) {
}
Collection collection1 = registry.searchContent("r6");
String[] paths1 = (String[]) collection1.getContent();
assertEquals("Search should return the relevant path corresponding to the content which includes " +
"submitted keywords.", "/c1/r6", paths1[0]);
Collection collection2 = registry.searchContent("non existing");
String[] paths2 = (String[]) collection2.getContent();
assertEquals("Search should not return results when non existing keywords are submitted.", 0, paths2.length);
registry.delete(r6Path);
Collection collection3 = registry.searchContent("r6");
String[] paths3 = (String[]) collection3.getContent();
assertEquals("Search should not return results for a deleted document", 0, paths3.length);
}
示例5: testGetMetaData
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void testGetMetaData() throws Exception {
Resource r1 = registry.newResource();
String content = "this is my content1";
r1.setContent(RegistryUtils.encodeString(content));
r1.setDescription("This is r1 file description");
r1.setProperty("key1", "value1");
r1.setProperty("key2", "value2");
String path = "/d1/d2/d3/d4/r1";
try {
registry.put(path, r1);
} catch (RegistryException e) {
fail("Couldn't put content to path /d1/d2/d3/d4/r1");
}
Resource r1_actual = registry.getMetaData("/d1/d2/d3/d4/r1");
assertEquals("LastUpdatedUser is not Equal", "admin", r1_actual.getLastUpdaterUserName());
assertEquals("Can not get Resource path", "/d1/d2/d3/d4/r1", r1_actual.getPath());
assertEquals("Can not get Resource parent path", "/d1/d2/d3/d4", r1_actual.getParentPath());
assertEquals("Resource description is not equal", r1.getDescription(),
r1_actual.getDescription());
assertEquals("Author is not equal", "admin", r1_actual.getAuthorUserName());
assertEquals("Resource properties are equal", r1.getProperty("key1"),
r1_actual.getProperty("key1"));
assertEquals("Resource properties are equal", r1.getProperty("key2"),
r1_actual.getProperty("key2"));
assertEquals("Resource properties are equal", r1.getProperty("key3_update"),
r1_actual.getProperty("key3_update"));
}
示例6: testRatingsPath
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void testRatingsPath() throws Exception {
Resource r5 = registry.newResource();
String r5Content = "this is r5 content";
r5.setContent(RegistryUtils.encodeString(r5Content));
r5.setDescription("production ready.");
String r5Path = "/c1/r5";
registry.put(r5Path, r5);
registry.rateResource("/c1/r5", 3);
String[] ratingPaths;
Resource ratings = registry.get("/c1/r5;ratings");
ratingPaths = (String[]) ratings.getContent();
int rating;
Resource c1 = registry.get(ratingPaths[0]);
Object o = c1.getContent();
if (o instanceof Integer) {
rating = (Integer) o;
} else {
rating = Integer.parseInt(o.toString());
}
assertEquals("Ratings are not retrieved properly as resources.", rating, 3);
}
示例7: testAddAssociationToResource
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void testAddAssociationToResource() throws Exception {
Resource r2 = registry.newResource();
String path = "/testk12/testa/testbsp/test.txt";
r2.setContent(RegistryUtils.encodeString("this is the content"));
r2.setDescription("this is test desc");
r2.setMediaType("plain/text");
r2.setProperty("test2", "value2");
registry.put(path, r2);
registry.addAssociation(path, "/vtr2121/test", "testasstype1");
registry.addAssociation(path, "/vtr2122/test", "testasstype2");
registry.addAssociation(path, "/vtr2123/test", "testasstype3");
assertTrue("association Destination path not exist", associationPathExists(path, "/vtr2121/test"));
assertTrue("association Destination path not exist", associationPathExists(path, "/vtr2122/test"));
assertTrue("association Destination path not exist", associationPathExists(path, "/vtr2123/test"));
assertTrue("association Type not exist", associationTypeExists(path, "testasstype1"));
assertTrue("association Type not exist", associationTypeExists(path, "testasstype2"));
assertTrue("association Type not exist", associationTypeExists(path, "testasstype3"));
assertTrue("association Source path not exist", associationSourcepathExists(path, path));
assertTrue("association Source path not exist", associationSourcepathExists(path, path));
assertTrue("association Source path not exist", associationSourcepathExists(path, path));
}
示例8: setUp
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
@Override
public void setUp() throws RegistryException {
super.setUp();
Resource resource = registry.newResource();
byte[] r1content = RegistryUtils.encodeString("Resource 17 content");
resource.setContent(r1content);
resource.setMediaType("application/test");
resource.setDescription("Sample 17 Description");
resource.setVersionableChange(true);
registry.put("/test/2017/10/17", resource);
}
示例9: setUp
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
@Override
public void setUp() throws RegistryException {
super.setUp();
Resource resource = registry.newResource();
byte[] r1content = RegistryUtils.encodeString("Resource 17 content");
resource.setContent(r1content);
resource.setMediaType("application/test");
resource.setDescription("Sample 17 Description");
resource.setVersionableChange(true);
registry.put("/test/2017/10/18", resource);
}
示例10: createSystemConfigVersionLabelStore
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
private static void createSystemConfigVersionLabelStore(UserRegistry userReg,String workspaceRoot) throws RegistryException {
String confVerPath = workspaceRoot
+ JCR_SYSTEM_CONFIG
+ "/"
+ JCR_SYSTEM_VERSION_LABELS;
if (!userReg.resourceExists(confVerPath)) {
Resource resource = (CollectionImpl)userReg.newCollection();
resource.setDescription("sys:config-jcr-storage");
resource.setProperty("sys:config","true");
userReg.put(confVerPath, resource);
}
}
示例11: testCollectionmultipleProperties
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void testCollectionmultipleProperties() throws Exception {
try {
String path = "/m15/m16/m17";
Resource r1 = registry.newCollection();
r1.setDescription("This m17 description");
r1.addProperty("key1", "value1");
r1.addProperty("key1", "value2");
r1.addProperty("key1", "value3");
r1.addProperty("key2", "value1");
r1.addProperty("key2", "value2");
registry.put(path, r1);
Resource r1_actual2 = registry.get(path);
List propertyValues = r1_actual2.getPropertyValues("key1");
Object[] valueName = propertyValues.toArray();
List propertyValuesKey2 = r1_actual2.getPropertyValues("key2");
Object[] valueNameKey2 = propertyValuesKey2.toArray();
assertTrue("value1 is not associated with key1", containsString(valueName, "value1"));
assertTrue("value2 is not associated with key1", containsString(valueName, "value2"));
assertTrue("value3 is not associated with key1", containsString(valueName, "value3"));
assertTrue("value1 is not associated with key2",
containsString(valueNameKey2, "value1"));
assertTrue("value2 is not associated with key2",
containsString(valueNameKey2, "value2"));
} catch (Exception e) {
e.printStackTrace();
}
}
示例12: testGetResourceoperation
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void testGetResourceoperation() throws Exception {
Resource r2 = registry.newResource();
String path = "/testk/testa/derby.log";
r2.setContent(RegistryUtils.encodeString("this is the content"));
r2.setDescription("this is test desc this is test desc this is test desc this is test desc this is test desc " +
"this is test desc this is test desc this is test desc this is test descthis is test desc ");
r2.setMediaType("plain/text");
registry.put(path, r2);
r2.discard();
Resource r3 = registry.newResource();
// assertEquals("Author names are not Equal", "admin", r3.getAuthorUserName());
r3 = registry.get(path);
assertEquals("Author User names are not Equal", "admin", r3.getAuthorUserName());
assertNotNull("Created time is null", r3.getCreatedTime());
assertEquals("Author User names are not Equal", "admin", r3.getAuthorUserName());
assertEquals("Description is not Equal", "this is test desc this is test desc this is test desc this is test" +
" desc this is test desc this is test desc this is test desc this is test desc this is test descthis is " +
"test desc ", r3.getDescription());
assertNotNull("Get Id is null", r3.getId());
assertNotNull("LastModifiedDate is null", r3.getLastModified());
assertEquals("Last Updated names are not Equal", "admin", r3.getLastUpdaterUserName());
//System.out.println(r3.getMediaType());
assertEquals("Media Type is not equal", "plain/text", r3.getMediaType());
assertEquals("parent Path is not equal", "/testk/testa", r3.getParentPath());
assertEquals("parent Path is not equal", path, r3.getPath());
assertEquals("Get stated wrong", 0, r3.getState());
String st = r3.getPermanentPath();
// assertTrue("Permenent path contanin the string" + path + " verion", st.contains("/testk/testa/derby.log;version:"));
}
示例13: testGetResourceAssociation
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void testGetResourceAssociation() throws Exception {
Resource r2 = registry.newResource();
String path = "/testk1234/testa/testbsp/test.txt";
r2.setContent(RegistryUtils.encodeString("this is the content"));
r2.setDescription("this is test desc");
r2.setMediaType("plain/text");
r2.setProperty("test2", "value2");
registry.addAssociation(path, "/vtr2121/test", "testasstype1");
registry.addAssociation(path, "/vtr2122/test", "testasstype2");
registry.addAssociation(path, "/vtr2123/test", "testasstype3");
assertTrue("association Destination path not exist", getAssocitionbyDestinationByType(path, "testasstype1", "/vtr2121/test"));
assertTrue("association Destination path not exist", getAssocitionbyDestinationByType(path, "testasstype2", "/vtr2122/test"));
assertTrue("association Destination path not exist", getAssocitionbyDestinationByType(path, "testasstype3", "/vtr2123/test"));
assertTrue("association Type not exist", getAssocitionbyType(path, "testasstype1"));
assertTrue("association Type not exist", getAssocitionbyType(path, "testasstype2"));
assertTrue("association Type not exist", getAssocitionbyType(path, "testasstype3"));
assertTrue("association Source path not exist", getAssocitionbySourceByType(path, "testasstype1"));
assertTrue("association Source path not exist", getAssocitionbySourceByType(path, "testasstype2"));
assertTrue("association Source path not exist", getAssocitionbySourceByType(path, "testasstype3"));
}
示例14: testAddAssociationToCollection
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public void testAddAssociationToCollection() throws Exception {
Resource r2 = registry.newCollection();
String path = "/assocol1/assocol2/assoclo3";
r2.setDescription("this is test desc");
r2.setMediaType("plain/text");
r2.setProperty("test2", "value2");
registry.put(path, r2);
registry.addAssociation(path, "/vtr2121/test", "testasstype1");
registry.addAssociation(path, "/vtr2122/test", "testasstype2");
registry.addAssociation(path, "/vtr2123/test", "testasstype3");
assertTrue("association Destination path not exist", associationPathExists(path, "/vtr2121/test"));
assertTrue("association Destination path not exist", associationPathExists(path, "/vtr2122/test"));
assertTrue("association Destination path not exist", associationPathExists(path, "/vtr2123/test"));
assertTrue("association Type not exist", associationTypeExists(path, "testasstype1"));
assertTrue("association Type not exist", associationTypeExists(path, "testasstype2"));
assertTrue("association Type not exist", associationTypeExists(path, "testasstype3"));
assertTrue("association Source path not exist", associationSourcepathExists(path, path));
assertTrue("association Source path not exist", associationSourcepathExists(path, path));
assertTrue("association Source path not exist", associationSourcepathExists(path, path));
}
示例15: importResource
import org.wso2.carbon.registry.core.Resource; //导入方法依赖的package包/类
public static String importResource(
String parentPath,
String resourceName,
String mediaType,
String description,
String fetchURL,
String symlinkLocation,
UserRegistry userRegistry,
String[][] properties) throws Exception {
String resourcePath;
if (RegistryConstants.ROOT_PATH.equals(parentPath)) {
resourcePath = RegistryConstants.ROOT_PATH + resourceName;
} else {
resourcePath = parentPath + RegistryConstants.PATH_SEPARATOR + resourceName;
}
try {
Resource metadataResource = userRegistry.newResource();
metadataResource.setMediaType(mediaType);
metadataResource.setDescription(description);
if (symlinkLocation != null) {
if (!symlinkLocation.endsWith(RegistryConstants.PATH_SEPARATOR)) {
symlinkLocation += RegistryConstants.PATH_SEPARATOR;
}
metadataResource.setProperty(RegistryConstants.SYMLINK_PROPERTY_NAME, symlinkLocation);
}
if (properties != null && properties.length > 0) {
for (String[] p : properties) {
metadataResource.setProperty(p[0], p[1]);
}
}
metadataResource.setProperty(CommonConstants.SOURCE_PROPERTY, CommonConstants.SOURCE_ADMIN_CONSOLE);
String path = userRegistry.importResource(resourcePath, fetchURL, metadataResource);
/* if (properties != null && properties.length > 0) {
Resource resource = userRegistry.get(path);
for (String[] p : properties) {
resource.setProperty(p[0], p[1]);
}
userRegistry.put(path, resource);
}*/
metadataResource.discard();
return path;
} catch (RegistryException e) {
String msg = "Failed to import resource from the URL " + fetchURL + " to path " +
resourcePath + ". " + ((e.getCause() instanceof SQLException) ?
"" : e.getMessage());
log.error(msg, e);
throw new RegistryException(msg, e);
}
}