private ArrayList<MLText> makeMLTextMVP(int position) { MLText m1 = new MLText(); m1.addValue(Locale.ENGLISH, mlOrderable_en[position]); MLText m2 = new MLText(); m2.addValue(Locale.FRENCH, mlOrderable_fr[position]); ArrayList<MLText> answer = new ArrayList<MLText>(2); answer.add(m1); answer.add(m2); return answer; }
MLText mlTextValue = new MLText(); mlTextValue.put(Locale.ENGLISH, sb.toString()); MLText mlTextValue1 = new MLText(); mlTextValue1.put(Locale.ENGLISH, sb.toString()); map.put("MLText", mlTextValue1); MLText mlTextValue2 = new MLText(); mlTextValue2.put(Locale.ENGLISH, sb.toString()); list.add(mlTextValue2);
/** * Tests simple, well-typed values that need conversion */ public void testConvertableKnownValues() throws Throwable { Map<QName, Serializable> in = new HashMap<QName, Serializable>(17); in.put(ContentModel.PROP_AUTO_VERSION, "TRUE"); in.put(ContentModel.PROP_HITS, "1"); in.put(ContentModel.PROP_SIZE_CURRENT, "2"); in.put(ContentModel.PROP_RATING_SCORE, "3.0"); in.put(ContentModel.PROP_NAME, new MLText("four")); in.put(ContentModel.PROP_TITLE, "five"); in.put(ContentModel.PROP_REFERENCE, "protocol://identifier/six"); in.put(VersionModel.PROP_QNAME_VALUE, "en_CA_"); marshallAndUnmarshall(in, false); }
/** * Tests simple, residual values */ public void testSimpleResidualValues() throws Throwable { Map<QName, Serializable> in = new HashMap<QName, Serializable>(17); in.put(QN_BOOLEAN, Boolean.TRUE); in.put(QN_INTEGER, new Integer(1)); in.put(QN_LONG, new Long(2L)); in.put(QN_FLOAT, new Float(3.0)); in.put(QN_TEXT, "four"); in.put(QN_MLTEXT, new MLText("five")); in.put(QN_REF, new NodeRef("protocol://identifier/six")); in.put(QN_ANY, Locale.CANADA); marshallAndUnmarshall(in, true); }
/** * Tests simple, well-typed values */ public void testSimpleKnownValues() throws Throwable { Map<QName, Serializable> in = new HashMap<QName, Serializable>(17); in.put(ContentModel.PROP_AUTO_VERSION, Boolean.TRUE); in.put(ContentModel.PROP_HITS, new Integer(1)); in.put(ContentModel.PROP_SIZE_CURRENT, new Long(2L)); in.put(ContentModel.PROP_RATING_SCORE, new Float(3.0)); in.put(ContentModel.PROP_NAME, "four"); in.put(ContentModel.PROP_TITLE, new MLText("five")); in.put(ContentModel.PROP_REFERENCE, new NodeRef("protocol://identifier/six")); in.put(VersionModel.PROP_QNAME_VALUE, Locale.CANADA); marshallAndUnmarshall(in, true); }
private NodeRef addSortableNull(String id) { Map<QName, Serializable> properties = new HashMap<QName, Serializable>(); MLText ml = new MLText(); ml.addValue(Locale.ENGLISH, "Test null"); properties.put(ContentModel.PROP_DESCRIPTION, ml); properties.put(ContentModel.PROP_TITLE, ml); properties.put(ContentModel.PROP_NAME, "Test null "+id); properties.put(ContentModel.PROP_CREATED, new Date()); NodeRef c0 = nodeService.createNode(f0, ContentModel.ASSOC_CONTAINS, QName.createQName("cm", "Test One", namespaceService), extendedContent, properties).getChildRef(); return c0; }
private MLText makeMLText(int position) { MLText ml = new MLText(); ml.addValue(Locale.ENGLISH, mlOrderable_en[position]); ml.addValue(Locale.FRENCH, mlOrderable_fr[position]); return ml; }
MLText mlTextValue = new MLText(); mlTextValue.put(Locale.ENGLISH, sb.toString()); MLText mlTextValue1 = new MLText(); mlTextValue1.put(Locale.ENGLISH, sb.toString()); map.put("MLText", mlTextValue1); MLText mlTextValue2 = new MLText(); mlTextValue2.put(Locale.ENGLISH, sb.toString()); list.add(mlTextValue2);
/** * @return properties */ public Map<QName, Serializable> getOrderProperties() { Map<QName, Serializable> testProperties = new HashMap<QName, Serializable>(); testProperties.put(CREATED_DATE, orderDate); testProperties.put(ORDER_DOUBLE, orderDoubleCount); testProperties.put(ORDER_FLOAT, orderFloatCount); testProperties.put(ORDER_LONG, orderLongCount); testProperties.put(ORDER_INT, orderIntCount); testProperties.put(ORDER_TEXT, new String(new char[] { (char) ('a' + orderTextCount) }) + " cabbage"); MLText mlText = new MLText(); mlText.addValue(Locale.ENGLISH, new String(new char[] { (char) ('a' + orderTextCount) }) + " banana"); mlText.addValue(Locale.FRENCH, new String(new char[] { (char) ('Z' - orderTextCount) }) + " banane"); mlText.addValue(Locale.CHINESE, new String(new char[] { (char) ('香' + orderTextCount) }) + " 香蕉"); testProperties.put(ORDER_ML_TEXT, mlText); orderDate = Duration.subtract(orderDate, new Duration("P1D")); orderDoubleCount += 0.1d; orderFloatCount += 0.82f; orderLongCount += 299999999999999l; orderIntCount += 8576457; orderTextCount++; return testProperties; }
@Test public void testLongMLTextValues() throws Exception { StringBuilder sb = new StringBuilder(); for (int i = 0; i < 4096; i++) { sb.append(" ").append(i); } String longString = sb.toString(); // Set the server default locale Locale.setDefault(Locale.ENGLISH); // Set it as a normal string nodeService.setProperty( rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE, longString); MLText mlTextProperty = new MLText(); mlTextProperty.addValue(Locale.ENGLISH, longString); mlTextProperty.addValue(Locale.FRENCH, longString); mlTextProperty.addValue(Locale.GERMAN, longString); // Set it as MLText nodeService.setProperty( rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE, mlTextProperty); }
/** * Ensure that plain strings going into MLText properties is handled */ @SuppressWarnings("unchecked") public void testSingleStringMLTextProperty() throws Exception { // Set the property with single-value MLText MLText mlText = new MLText(); mlText.addValue(Locale.GERMAN, "Sehr gut!"); nodeService.setProperty(rootNodeRef, PROP_QNAME_ML_TEXT_VALUE, mlText); // Get it back and check MLText mlTextCheck = (MLText) nodeService.getProperty(rootNodeRef, PROP_QNAME_ML_TEXT_VALUE); assertEquals("Setting of MLText over String failed.", mlText, mlTextCheck); }
final MLText mlTextValue = new MLText(); mlTextValue.put(Locale.ENGLISH, stringValue);
@Test @SuppressWarnings("unchecked") public void testMultiValueMLTextProperties() throws Exception { NodeRef nodeRef = nodeService.createNode( rootNodeRef, ASSOC_TYPE_QNAME_TEST_CHILDREN, QName.createQName("pathA"), TYPE_QNAME_TEST_MANY_ML_PROPERTIES).getChildRef(); // Create MLText properties and add to a collection List<MLText> mlTextCollection = new ArrayList<MLText>(2); MLText mlText0 = new MLText(); mlText0.addValue(Locale.ENGLISH, "Hello"); mlText0.addValue(Locale.FRENCH, "Bonjour"); mlTextCollection.add(mlText0); MLText mlText1 = new MLText(); mlText1.addValue(Locale.ENGLISH, "Bye bye"); mlText1.addValue(Locale.FRENCH, "Au revoir"); mlTextCollection.add(mlText1); nodeService.setProperty(nodeRef, PROP_QNAME_MULTI_ML_VALUE, (Serializable) mlTextCollection); Collection<MLText> mlTextCollectionCheck = (Collection<MLText>) nodeService.getProperty(nodeRef, PROP_QNAME_MULTI_ML_VALUE); assertEquals("MLText collection didn't come back correctly.", mlTextCollection, mlTextCollectionCheck); }
public void testMLTextValues() throws Exception { // Set the server default locale Locale.setDefault(Locale.ENGLISH); MLText mlTextProperty = new MLText(); mlTextProperty.addValue(Locale.ENGLISH, "Very good!"); mlTextProperty.addValue(Locale.FRENCH, "Très bon!"); mlTextProperty.addValue(Locale.GERMAN, "Sehr gut!"); nodeService.setProperty( rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE, mlTextProperty); // Check unfiltered property retrieval Serializable textValueDirect = nodeService.getProperty( rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE); assertEquals( "MLText type not returned direct", mlTextProperty, textValueDirect); // Check unfiltered mass property retrieval Map<QName, Serializable> propertiesDirect = nodeService.getProperties(rootNodeRef); assertEquals( "MLText type not returned direct in Map", mlTextProperty, propertiesDirect.get(BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE)); }
MLText mlTextProperty = new MLText(); mlTextProperty.addValue(Locale.ENGLISH, "Very good!"); mlTextProperty.addValue(Locale.FRENCH, "Très bon!");
mlText = new MLText(null); nodeService.setProperty(rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE, mlText); MLText mlTextCheck = (MLText) nodeService.getProperty(rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE); try mlText = new MLText(null); nodeService.setProperty(rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE, mlText); mlTextCheck = (MLText) nodeService.getProperty(rootNodeRef, BaseNodeServiceTest.PROP_QNAME_ML_TEXT_VALUE);
MLText mlText = new MLText(); mlText.addValue(Locale.ENGLISH, "Very good!"); mlText.addValue(Locale.FRENCH, "Très bon!");
MLText mltext = new MLText(); mltext.addValue(Locale.FRENCH, "Bonjour"); mltext.addValue(Locale.ENGLISH, "Hello");
MLText mltext = new MLText(); mltext.addValue(Locale.FRENCH, "Bonjour"); mltext.addValue(Locale.ENGLISH, "Hello");
MLText title = new MLText(); title.addValue(Locale.ENGLISH, null); title.addValue(Locale.FRENCH, "bonjour");