Transition to Jackson so we can retain unrecognized properties in the source JSON.
This commit is contained in:
67
core/java/tests/src/main/resources/test.mpsites.json
Normal file
67
core/java/tests/src/main/resources/test.mpsites.json
Normal file
@@ -0,0 +1,67 @@
|
||||
{
|
||||
"export": {
|
||||
"format": 1,
|
||||
"redacted": true,
|
||||
"date": "2018-05-10T03:41:18Z",
|
||||
"_ext_mpw": {
|
||||
"save": "me"
|
||||
},
|
||||
"_ext_other": {
|
||||
"save": "me"
|
||||
}
|
||||
},
|
||||
"user": {
|
||||
"avatar": 3,
|
||||
"full_name": "Robert Lee Mitchell",
|
||||
"last_used": "2018-05-10T03:41:18Z",
|
||||
"key_id": "98EEF4D1DF46D849574A82A03C3177056B15DFFCA29BB3899DE4628453675302",
|
||||
"algorithm": 3,
|
||||
"default_type": 17,
|
||||
"_ext_mpw": {
|
||||
"save": "me"
|
||||
},
|
||||
"_ext_other": {
|
||||
"save": "me"
|
||||
}
|
||||
},
|
||||
"sites": {
|
||||
"masterpasswordapp.com": {
|
||||
"type": 17,
|
||||
"counter": 1,
|
||||
"algorithm": 3,
|
||||
"login_type": 30,
|
||||
"uses": 2,
|
||||
"last_used": "2018-05-10T03:41:18Z",
|
||||
"questions": {
|
||||
"": {
|
||||
"type": 31
|
||||
},
|
||||
"mother": {
|
||||
"type": 31
|
||||
}
|
||||
},
|
||||
"_ext_mpw": {
|
||||
"url": "https://masterpasswordapp.com",
|
||||
"save": "me"
|
||||
},
|
||||
"_ext_other": {
|
||||
"save": "me"
|
||||
}
|
||||
},
|
||||
"personal.site": {
|
||||
"type": 1056,
|
||||
"counter": 1,
|
||||
"algorithm": 3,
|
||||
"password": "ZTgr4cY6L28wG7DsO+iz\/hrTQxM3UHz0x8ZU99LjgxjHG+bLIJygkbg\/7HdjEIFH6A3z+Dt2H1gpt9yPyQGZcewTiPXJX0pNpVsIKAAdzVNcUfYoqkWjoFRoZD7sM\/ctxWDH4JUuJ+rjoBkWtRLK9kYBvu7UD1QdlEZI\/wPKv1A=",
|
||||
"login_type": 30,
|
||||
"uses": 1,
|
||||
"last_used": "2018-05-10T03:48:35Z"
|
||||
}
|
||||
},
|
||||
"_ext_mpw": {
|
||||
"save": "me"
|
||||
},
|
||||
"_ext_other": {
|
||||
"save": "me"
|
||||
}
|
||||
}
|
@@ -1,45 +0,0 @@
|
||||
//==============================================================================
|
||||
// This file is part of Master Password.
|
||||
// Copyright (c) 2011-2017, Maarten Billemont.
|
||||
//
|
||||
// Master Password is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Master Password is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You can find a copy of the GNU General Public License in the
|
||||
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
|
||||
//==============================================================================
|
||||
|
||||
package com.lyndir.masterpassword;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.io.CharStreams;
|
||||
import com.lyndir.masterpassword.model.*;
|
||||
import java.io.*;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
|
||||
/**
|
||||
* @author lhunath, 2018-04-27
|
||||
*/
|
||||
public class MPModelTest {
|
||||
|
||||
@Test
|
||||
public void testMasterKey()
|
||||
throws Exception {
|
||||
File file = new File( "/Users/lhunath/.mpw.d/Maarten Billemont.mpsites.json" );
|
||||
String orig = CharStreams.toString( new InputStreamReader( new FileInputStream( file ), Charsets.UTF_8 ) );
|
||||
System.out.println(orig);
|
||||
MPFileUser user = new MPJSONUnmarshaller().unmarshall( file, null );
|
||||
String result = new MPJSONMarshaller().marshall( user );
|
||||
System.out.println(result);
|
||||
Assert.assertEquals( result, orig, "Marshalled sites do not match original sites." );
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user