Since the telephones I am programming (Unidata WPU-7700 & SQ-3000) need 
different filenames for autoprovisioning (7700 > e1_serialnr.ini, 3000 > 
b2_serialnr.ini) I am trying to solve the naming of the configuration files. 
The code I'm trying is as follows (in UnidataPhone.java):

   @Override
    public String getProfileFilename() {
        String serialNumber = getSerialNumber();
        //return "e1_" + serialNumber + ".ini";
        String model = getModelId();
            if (model=="unidatawpu7700") {
                return "e1_" + serialNumber + ".ini"; }
            //if (model=="unidatasq3000") {
            else {
                return model + "_b2_" + serialNumber + ".ini";}

Now the returned trace of the test is as follows, where <[e1]_001122334455.ini> 
is the test string and <[null_b2]_001122334455.ini> is the returned string. 
junit.framework.ComparisonFailure: null expected:<[e1]_001122334455.ini> but 
was:<[null_b2]_001122334455.ini>

I put in the model in the return statement to be able to check whether the 
returned string is right. In this case is is clearly not as it should state; 
"unidatasq3000", the modelID.
The PhoneTest i have written is as follows;

public class UnidataPhoneTest extends TestCase {
    public void testGetFileName() throws Exception {
        UnidataPhone phone = new UnidataPhone();
        phone.setSerialNumber("001122334455");
        assertEquals("e1_001122334455.ini", phone.getProfileFilename());
    }

    public void testGenerateTypicalProfile() throws Exception {
        UnidataPhone phone = new UnidataPhone();
        PhoneModel model = new PhoneModel("unidata");
        model.setModelId("unidatawpu7700");
        phone.setModel(model);

        // call this to inject dummy data
        PhoneTestDriver.supplyTestData(phone);
        MemoryProfileLocation location = 
TestHelper.setVelocityProfileGenerator(phone);

        ProfileContext context = new ProfileContext(phone, "unidata/config.vm");
        phone.getProfileGenerator().generate(location, context, null, "ignore");
        
        InputStream expectedProfile = 
getClass().getResourceAsStream("test-e1_MAC.ini");
        assertNotNull(expectedProfile);
        String expected = IOUtils.toString(expectedProfile);
        expectedProfile.close();

        assertEquals(expected, location.toString());
    }
}

As you can see, the model.setModelID is used to set the correct model ID.
I tried multiple getters from the Phone and PhoneModels like getBeanID(), 
getModel().getModelID() etc.
Can anybody tell me how I can arrange this??

Greetings,
Tom Commandeur 

                                          
_________________________________________________________________
Een netbook met Windows 7? Hier vind je alles dat je moet weten.
www.windows.nl/netbook
_______________________________________________
sipx-dev mailing list [email protected]
List Archive: http://list.sipfoundry.org/archive/sipx-dev
Unsubscribe: http://list.sipfoundry.org/mailman/listinfo/sipx-dev
sipXecs IP PBX -- http://www.sipfoundry.org/

Reply via email to