/** * @param data binary data */ public Attach(final byte[] data) { super(ATTACH, PropertyFactoryImpl.getInstance()); // add required parameters.. getParameters().add(Encoding.BASE64); getParameters().add(Value.BINARY); this.binary = data; }
/** * @param data binary data */ public Attach(final byte[] data) { super(ATTACH, new Factory()); // add required parameters.. getParameters().add(Encoding.BASE64); getParameters().add(Value.BINARY); this.binary = data; }
/** * @param data binary data */ public Attach(final byte[] data) { super(ATTACH, new Factory()); // add required parameters.. getParameters().add(Encoding.BASE64); getParameters().add(Value.BINARY); this.binary = data; }
/** * @param data binary data */ public Attach(final byte[] data) { super(ATTACH, PropertyFactoryImpl.getInstance()); // add required parameters.. getParameters().add(Encoding.BASE64); getParameters().add(Value.BINARY); this.binary = data; }
/** * @param data binary data */ public Attach(final byte[] data) { super(ATTACH, PropertyFactoryImpl.getInstance()); // add required parameters.. getParameters().add(Encoding.BASE64); getParameters().add(Value.BINARY); this.binary = data; }
/** * Unit testing of serialization. */ public void testSerialization() throws IOException, ClassNotFoundException, URISyntaxException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bout); out.writeObject(attach); ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream(bout.toByteArray())); Attach clone = (Attach) in.readObject(); assertNotNull(clone); assertEquals(attach, clone); // set a bogus value to trigger logging.. clone.getParameters().replace(new Encoding("BOGUS")); clone.setValue(""); } }
/** * {@inheritDoc} */ public final void validate() throws ValidationException { /* * ; the following is optional, ; but MUST NOT occur more than once (";" fmttypeparam) / */ ParameterValidator.getInstance().assertOneOrLess(Parameter.FMTTYPE, getParameters()); /* * ; the following is optional, ; and MAY occur more than once (";" xparam) */ /* * If the value type parameter is ";VALUE=BINARY", then the inline encoding parameter MUST be specified with the * value ";ENCODING=BASE64". */ if (Value.BINARY.equals(getParameter(Parameter.VALUE))) { ParameterValidator.getInstance().assertOne(Parameter.ENCODING, getParameters()); if (!Encoding.BASE64.equals(getParameter(Parameter.ENCODING))) { throw new ValidationException( "If the value type parameter is [BINARY], the inline" + "encoding parameter MUST be specified with the value [BASE64]" ); } } }
/** * {@inheritDoc} */ public final void validate() throws ValidationException { /* * ; the following is optional, ; but MUST NOT occur more than once (";" fmttypeparam) / */ ParameterValidator.getInstance().assertOneOrLess(Parameter.FMTTYPE, getParameters()); /* * ; the following is optional, ; and MAY occur more than once (";" xparam) */ /* * If the value type parameter is ";VALUE=BINARY", then the inline encoding parameter MUST be specified with the * value ";ENCODING=BASE64". */ if (Value.BINARY.equals(getParameter(Parameter.VALUE))) { ParameterValidator.getInstance().assertOne(Parameter.ENCODING, getParameters()); if (!Encoding.BASE64.equals(getParameter(Parameter.ENCODING))) { throw new ValidationException( "If the value type parameter is [BINARY], the inline" + "encoding parameter MUST be specified with the value [BASE64]" ); } } }
/** * {@inheritDoc} */ public final void validate() throws ValidationException { /* * ; the following is optional, ; but MUST NOT occur more than once (";" fmttypeparam) / */ ParameterValidator.getInstance().assertOneOrLess(Parameter.FMTTYPE, getParameters()); /* * ; the following is optional, ; and MAY occur more than once (";" xparam) */ /* * If the value type parameter is ";VALUE=BINARY", then the inline encoding parameter MUST be specified with the * value ";ENCODING=BASE64". */ if (Value.BINARY.equals(getParameter(Parameter.VALUE))) { ParameterValidator.getInstance().assertOne(Parameter.ENCODING, getParameters()); if (!Encoding.BASE64.equals(getParameter(Parameter.ENCODING))) { throw new ValidationException( "If the value type parameter is [BINARY], the inline" + "encoding parameter MUST be specified with the value [BASE64]"); } } }
/** * {@inheritDoc} */ public final void validate() throws ValidationException { /* * ; the following is optional, ; but MUST NOT occur more than once (";" fmttypeparam) / */ ParameterValidator.getInstance().assertOneOrLess(Parameter.FMTTYPE, getParameters()); /* * ; the following is optional, ; and MAY occur more than once (";" xparam) */ /* * If the value type parameter is ";VALUE=BINARY", then the inline encoding parameter MUST be specified with the * value ";ENCODING=BASE64". */ if (Value.BINARY.equals(getParameter(Parameter.VALUE))) { ParameterValidator.getInstance().assertOne(Parameter.ENCODING, getParameters()); if (!Encoding.BASE64.equals(getParameter(Parameter.ENCODING))) { throw new ValidationException( "If the value type parameter is [BINARY], the inline" + "encoding parameter MUST be specified with the value [BASE64]" ); } } }
/** * {@inheritDoc} */ public final void validate() throws ValidationException { /* * ; the following is optional, ; but MUST NOT occur more than once (";" fmttypeparam) / */ ParameterValidator.getInstance().assertOneOrLess(Parameter.FMTTYPE, getParameters()); /* * ; the following is optional, ; and MAY occur more than once (";" xparam) */ /* * If the value type parameter is ";VALUE=BINARY", then the inline encoding parameter MUST be specified with the * value ";ENCODING=BASE64". */ if (Value.BINARY.equals(getParameter(Parameter.VALUE))) { ParameterValidator.getInstance().assertOne(Parameter.ENCODING, getParameters()); if (!Encoding.BASE64.equals(getParameter(Parameter.ENCODING))) { throw new ValidationException( "If the value type parameter is [BINARY], the inline" + "encoding parameter MUST be specified with the value [BASE64]" ); } } }
/** * @param attProp * @return BwAttachment * @throws Throwable */ public static BwAttachment getAttachment(final Attach attProp) throws Throwable { BwAttachment att = new BwAttachment(); ParameterList pars = attProp.getParameters(); att.setFmtType(getOptStr(pars, "FMTTYPE")); att.setValueType(getOptStr(pars, "VALUE")); att.setEncoding(getOptStr(pars, "ENCODING")); if (att.getEncoding() == null) { att.setUri(attProp.getValue()); } else { att.setValue(attProp.getValue()); } return att; }
attachment.getParameters().add(new FmtType("application/msword")); alarm.getProperties().add(attachment); suite.addTest(new VAlarmTest("testValidation", alarm));