use of com.ibm.j9ddr.tools.store.StructureMismatchError in project openj9 by eclipse.
the class J9DDRStructureStoreTest method add.
@Test
public void add() {
// Test
J9DDRStructureStore store = null;
try {
store = new J9DDRStructureStore("newDir", "superset.dat");
} catch (IOException e) {
e.printStackTrace();
fail("Could not open store");
}
String original = "E:\\workspaces\\j9ddr\\DDR_VM\\data\\structure blobs\\j9ddr.dat";
String newOne = "E:\\workspaces\\j9ddr\\DDR_VM\\data\\structure blobs\\newj9ddr.dat";
StructureKey keyOne = new StructureKey("windows", "foo");
StructureKey keyTwo = new StructureKey("windows", "bar");
// String structureFileName = original;
// StructureKey key = keyOne;
String structureFileName = newOne;
StructureKey key = keyTwo;
try {
store.add(key, structureFileName, true);
store.close();
} catch (IOException e) {
e.printStackTrace();
fail(e.getMessage());
} catch (StructureMismatchError e) {
e.printStackTrace();
fail(e.getMessage());
} finally {
try {
store.close();
} catch (IOException e) {
fail("Could not close store");
}
}
// TODO: Open file and make sure it is good.
try {
store.close();
store = null;
store = new J9DDRStructureStore("newDir", "superset.dat");
ImageInputStream is = store.get(key);
FileInputStream fis = new FileInputStream(structureFileName);
assertTrue("Files where not the same", compare(is, fis));
} catch (IOException e) {
fail();
}
}
use of com.ibm.j9ddr.tools.store.StructureMismatchError in project openj9 by eclipse.
the class AddStructureBlob method run.
private void run() {
String directoryName = opts.get("-d");
String supersetName = opts.get("-s");
if (supersetName == null) {
supersetName = J9DDRStructureStore.DEFAULT_SUPERSET_FILE_NAME;
}
try {
J9DDRStructureStore store = new J9DDRStructureStore(directoryName, supersetName);
String path = opts.get("-c");
if ((null == path) || (path.length() == 0)) {
// path for properties file not specified so default to adding from a single file or directory
addFromFile(store);
} else {
// a property file controls the order in which blobs are processed
addFromPropertiesFile(store);
}
} catch (IOException e) {
e.printStackTrace();
} catch (StructureMismatchError e) {
e.printStackTrace();
}
}
Aggregations