Package com.thoughtworks.xstream.io.xml

Examples of com.thoughtworks.xstream.io.xml.StaxDriver


      String toolPath;
      XStream xstream;
      BufferedReader reader;
      toolPath = relativePathToInputToolPath(relativePath);
     
      xstream = new XStream(new StaxDriver());
      try {
        reader = new BufferedReader(new FileReader(toolPath));
        StaxDriver xmlParser = new StaxDriver();
        HierarchicalStreamReader xmlPeeker= xmlParser.createReader(reader);
        String tool_id= xmlPeeker.getAttribute("id");
        reader.close();
        return tool_id;
      } catch(StreamException e){
        System.err.println("Error loading "+ relativePath);
View Full Code Here


    qnameMap.registerMapping(qname, DefaultRelation.class);
    // we need the replacer because
    // xstream replaces an _ with __ (two underscore) more information at
    // http://xstream.codehaus.org/faq.html#XML_double_underscores
    XmlFriendlyReplacer replacer = new XmlFriendlyReplacer("$", "_");
    helper = new XStreamHelper(new StaxDriver(qnameMap, replacer));
  }
View Full Code Here

  @Test
  public void testConfigurationProvider_init_method_file_doesnt_exists() throws Exception {
    ClusterDefinition clusterDefinitionMock = createStrictMock(ClusterDefinition.class);
    PowerMock.suppress(PowerMock.methods(ConfigurationProvider.class, "initConfigurationResources"));

    StaxDriver staxDriver = PowerMock.createStrictMock(StaxDriver.class);
    XStream xstream = PowerMock.createStrictMock(XStream.class);

    PowerMock.expectNew(StaxDriver.class).andReturn(staxDriver);
    PowerMock.expectNew(XStream.class, staxDriver).andReturn(xstream);
    xstream.alias("configuration", Map.class);
View Full Code Here

  @Test
  public void testConfigurationProvider_init_method_file_exists() throws Exception {
    ClusterDefinition clusterDefinitionMock = createStrictMock(ClusterDefinition.class);
    PowerMock.suppress(PowerMock.methods(ConfigurationProvider.class, "initConfigurationResources"));

    StaxDriver staxDriver = PowerMock.createStrictMock(StaxDriver.class);
    XStream xstream = PowerMock.createStrictMock(XStream.class);
    PowerMock.mockStatic(ClassLoader.class);
    InputStream mockInputStream = createMock(InputStream.class);

View Full Code Here

  }

  @Test
  public void testConfigurationProvider_initConfigurationResources_method() throws Exception {
    ClusterDefinition clusterDefinitionMock = createStrictMock(ClusterDefinition.class);
    StaxDriver staxDriver = PowerMock.createStrictMock(StaxDriver.class);
    XStream xstream = PowerMock.createStrictMock(XStream.class);
    PowerMock.mockStatic(ClassLoader.class);
    InputStream mockInputStream = createMock(InputStream.class);

View Full Code Here

  }

  @Test
  public void testGetResourcesWithPredicate() throws Exception {
    ClusterDefinition clusterDefinitionMock = createStrictMock(ClusterDefinition.class);
    StaxDriver staxDriver = PowerMock.createStrictMock(StaxDriver.class);
    XStream xstream = PowerMock.createStrictMock(XStream.class);
    PowerMock.mockStatic(ClassLoader.class);
    InputStream mockInputStream = createMock(InputStream.class);

View Full Code Here

  @SuppressWarnings("unchecked")
  private void init() {
    allConfigs = new HashMap<String, Map<String, String>>();

    XStream xstream = new XStream(new StaxDriver());
    xstream.alias("configuration", Map.class);
    xstream.registerConverter(new ScomConfigConverter());

    for (String configurationResource : clusterConfigurationResources) {
      String configFileName = configurationResource + "." + DESTINATION;
View Full Code Here

  public void init() throws IOException {
    if( LOG.isDebugEnabled() ) {
      LOG.debug( "loading database from " + databaseLocation );
    }

    xstream = new XStream( new StaxDriver() );

    xstream.alias( "root", DefaultShellConfiguration.class);

    xstream.alias( "server-info", ServerInfo.class);
    xstream.alias( "port-forwarding", PortForwarding.class );
View Full Code Here

    configuration.addHostKey( "demo", "demo");

    PortForwarding pf = new PortForwarding( "demo", "demo", 11, 22, "demo", PortForwardingType.SSH );
    configuration.addPortForwardingToServer( "demo", pf );

    XStream xstream = new XStream( new StaxDriver() );
    xstream.alias( "root", DefaultShellConfiguration.class);

    xstream.alias( "server-info", ServerInfo.class);
    xstream.alias( "port-forwarding", PortForwarding.class );
    xstream.alias( "host-key", HostKey.class );
View Full Code Here

    public XStreamSerializer(String name, boolean withSpecialConverter, final XMLInputFactory inf, final XMLOutputFactory outf) throws Exception
    {
        super(name);
        if (inf != null && outf != null) {
            xstream = new XStream(new StaxDriver() {
                public XMLInputFactory getInputFactory() {
                    return inf;
                }

                public XMLOutputFactory getOutputFactory() {
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.io.xml.StaxDriver

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.