本文整理汇总了Java中org.wso2.carbon.registry.core.utils.RegistryUtils.encodeString方法的典型用法代码示例。如果您正苦于以下问题:Java RegistryUtils.encodeString方法的具体用法?Java RegistryUtils.encodeString怎么用?Java RegistryUtils.encodeString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.wso2.carbon.registry.core.utils.RegistryUtils
的用法示例。
在下文中一共展示了RegistryUtils.encodeString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDuplicateTagging
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public void testDuplicateTagging() throws Exception {
Resource r1 = registry.newResource();
byte[] r1content = RegistryUtils.encodeString("q1 content");
r1.setContent(r1content);
registry.put("/d12/r1", r1);
registry.applyTag("/d12/r1", "tag1");
registry.applyTag("/d12/r1", "tag2");
Tag[] tags = registry.getTags("/d12/r1");
boolean tagFound = false;
for (Tag tag : tags) {
if (tag.getTagName().equals("tag1")) {
tagFound = true;
//System.out.println(tags[i].getTagName());
//System.out.println(tags[i].getCategory());
//System.out.println(tags[i].getTagCount());
break;
}
}
assertTrue("tag 'tag1' is not associated with the artifact /d12/r1", tagFound);
}
示例2: setUp
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
@Override
public void setUp() throws RegistryException {
super.setUp();
Resource r1 = registry.newResource();
byte[] r1content = RegistryUtils.encodeString("R1 content");
r1.setContent(r1content);
r1.setMediaType("application/test");
registry.put("/test/2017/10/12", r1);
}
示例3: createFileIndex
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
@Test
public void createFileIndex() throws RegistryException {
byte[] data = RegistryUtils.encodeString("testing");
String mediaType = "application/json";
String path = "/_system/local/index";
int tenant = -12345;
String tenantDomain = "fb.com";
AsyncIndexer.File2Index file2Index = new AsyncIndexer.File2Index(data, mediaType, path, tenant, tenantDomain,
"ServiceLifecycle", "Development");
assertEquals(data, file2Index.data);
assertEquals(mediaType, file2Index.mediaType);
assertEquals(path, file2Index.path);
assertEquals(tenant, file2Index.tenantId);
assertEquals(tenantDomain, file2Index.tenantDomain);
}
示例4: setUp
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的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/19", resource);
registry.createVersion("/test/2017/10/19");
}
示例5: setUp
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的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);
}
示例6: testContinuousUpdate
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public void testContinuousUpdate() throws Exception {
int iterations = 100;
for (int i = 0; i < iterations; i++) {
Resource res1 = registry.newResource();
byte[] r1content = RegistryUtils.encodeString("R2 content");
res1.setContent(r1content);
String path = "/con-delete/test-update/" + i + 1;
registry.put(path, res1);
Resource resource1 = registry.get(path);
assertEquals("File content is not matching", RegistryUtils.decodeBytes((byte[]) resource1.getContent()),
RegistryUtils.decodeBytes((byte[]) res1.getContent()));
Resource resource = new ResourceImpl();
byte[] r1content1 = RegistryUtils.encodeString("R2 content updated");
resource.setContent(r1content1);
resource.setProperty("abc", "abc");
registry.put(path, resource);
Resource resource2 = registry.get(path);
assertEquals("File content is not matching", RegistryUtils.decodeBytes((byte[]) resource.getContent()),
RegistryUtils.decodeBytes((byte[]) resource2.getContent()));
resource.discard();
res1.discard();
resource1.discard();
resource2.discard();
Thread.sleep(100);
}
}
示例7: testGetIndexedDocumentInvalidContent
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public void testGetIndexedDocumentInvalidContent() throws Exception {
String path = "/_system/local/temp";
byte[] byteContent = RegistryUtils.encodeString("Testing");
AsyncIndexer.File2Index fileData = new AsyncIndexer.File2Index(byteContent, mediaType,
path, tenantID, tenantDomain);
MSPowerpointIndexer indexer = new MSPowerpointIndexer();
try {
indexer.getIndexedDocument(fileData);
fail("Missing exception");
} catch (SolrException e) {
assertEquals("Failed to write to the index", e.getMessage());
}
}
示例8: testGetIndexedDocumentInvalidContent
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public void testGetIndexedDocumentInvalidContent() throws Exception {
String path = "/_system/local/temp";
byte[] byteContent = RegistryUtils.encodeString("Testing");
AsyncIndexer.File2Index fileData = new AsyncIndexer.File2Index(byteContent, mediaType,
path, tenantID, tenantDomain);
MSExcelIndexer indexer = new MSExcelIndexer();
try {
indexer.getIndexedDocument(fileData);
fail("Missing exception");
} catch (SolrException e) {
assertEquals("Failed to write to the index", e.getMessage());
}
}
示例9: setUp
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
@Override
public void setUp() throws RegistryException {
super.setUp();
Resource resource = registry.newResource();
byte[] r1content = RegistryUtils.encodeString("Resource 14 content");
resource.setContent(r1content);
resource.setMediaType("application/test");
registry.put("/test/2017/10/14", resource);
}
示例10: testGetIndexedDocument
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public void testGetIndexedDocument() throws Exception {
String path = "/_system/local/temp";
byte[] byteContent = RegistryUtils.encodeString(jsonContent);
AsyncIndexer.File2Index fileData = new AsyncIndexer.File2Index(byteContent, mediaType,
path, tenantID, tenantDomain);
JSONIndexer jsonIndexer = new JSONIndexer();
IndexDocument document = jsonIndexer.getIndexedDocument(fileData);
assertEquals(path, document.getPath());
}
示例11: setUp
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
@Override
public void setUp() throws RegistryException {
super.setUp();
Resource resource = registry.newResource();
byte[] r1content = RegistryUtils.encodeString("Resource content");
resource.setContent(r1content);
resource.setMediaType("application/test");
resource.setDescription("Sample Description");
resource.setVersionableChange(true);
registry.put("/test/2017/10/15", resource);
registry.createVersion("/test/2017/10/15");
}
示例12: testGetIndexedDocumentInvalidContent
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public void testGetIndexedDocumentInvalidContent() throws Exception {
String path = "/_system/local/temp";
byte[] byteContent = RegistryUtils.encodeString("Testing");
AsyncIndexer.File2Index fileData = new AsyncIndexer.File2Index(byteContent, mediaType,
path, tenantID, tenantDomain);
MSWordIndexer indexer = new MSWordIndexer();
try {
indexer.getIndexedDocument(fileData);
fail("Missing exception");
} catch (SolrException e) {
assertEquals("Failed to write to the index", e.getMessage());
}
}
示例13: setUp
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
@Override
public void setUp() throws RegistryException {
super.setUp();
Resource resource = registry.newResource();
byte[] r1content = RegistryUtils.encodeString("Resource 16 content");
resource.setContent(r1content);
resource.setMediaType("application/test");
registry.put("/test/2017/10/16", resource);
registry.createVersion("/test/2017/10/16"); //version 1
registry.createVersion("/test/2017/10/16"); //version 2
}
示例14: testGetIndexedDocumentWithLC
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
public void testGetIndexedDocumentWithLC() throws Exception {
String path = "/_system/local/temp";
byte[] byteContent = RegistryUtils.encodeString(xmlContent);
AsyncIndexer.File2Index fileData = new AsyncIndexer.File2Index(byteContent, mediaType,
path, tenantID, tenantDomain);
fileData.lcName = "ServiceLifeCycle";
fileData.lcState = "Development";
XMLIndexer xmlIndexer = new XMLIndexer();
IndexDocument document = xmlIndexer.getIndexedDocument(fileData);
assertEquals(path, document.getPath());
}
示例15: setUp
import org.wso2.carbon.registry.core.utils.RegistryUtils; //导入方法依赖的package包/类
@Override
public void setUp() throws RegistryException {
super.setUp();
Resource r1 = registry.newResource();
byte[] r1content = RegistryUtils.encodeString("R1 content");
r1.setContent(r1content);
r1.setMediaType("application/test");
r1.setProperty("key", "value");
registry.put("/test/2017/10/25", r1);
}