net.vnt.ussdapp.util.ContextTest.java Source code

Java tutorial

Introduction

Here is the source code for net.vnt.ussdapp.util.ContextTest.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package net.vnt.ussdapp.util;

import java.io.IOException;
import java.util.Enumeration;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import net.vnt.ussdapp.util.config.ContextProperties;
import net.vnt.ussdapp.util.parser.TXTParser;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author doclv
 */
public class ContextTest {

    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "/context.xml" });
        ContextProperties ctxProp = (ContextProperties) Context.getInstance().getBean("ContextProperties");
        TXTParser parser = (TXTParser) Context.getInstance().getBean("TXTParser");
        String mainmenu = ctxProp.getProperty("ussdapp.wrong");
        try {
            Vector<String> vs = parser.readFields(mainmenu);
            Enumeration<String> ens = vs.elements();
            StringBuilder sb = new StringBuilder();
            while (ens.hasMoreElements()) {
                sb.append(ens.nextElement()).append("\n");
            }
            System.out.println(sb.toString());
        } catch (IOException ex) {
            Logger.getLogger(ContextTest.class.getName()).log(Level.SEVERE, null, ex);
        }
        System.out.println(System.getProperty("os.arch"));
    }
}