lockFile = new File("./" + getServer().getDeployDir(), "instance.lock"); if (lockFile.exists()) {
@Override public void exec(CLIContext ctx, String[] args) throws Exception { if (args.length < 2) { ctx.println("Usage: enable <xml_file(no extenssion)>"); return; } File deployDir = ctx.getCLI().getQ2().getDeployDir(); File deploy = new File(deployDir.getAbsolutePath() + "/" + args[1] + ".xml.off"); if (deploy.exists() && deploy.isFile()) { File dest = new File(deployDir.getAbsolutePath() + "/" + args[1] + ".xml"); deploy.renameTo(dest); ctx.println("ENABLED: " + args[1]); return; } File dest = new File(deployDir.getAbsolutePath() + "/" + args[1] + ".xml"); if (dest.exists()) { ctx.println("Already enabled: " + args[1]); return; } ctx.println("Can't find the bean descriptor: " + args[1]); return; } }
@Override public void exec(CLIContext ctx, String[] args) throws Exception { if (args.length < 2) { ctx.println("Usage: enable <xml_file(no extenssion)>"); return; } File deployDir = ctx.getCLI().getQ2().getDeployDir(); File deploy = new File(deployDir.getAbsolutePath()+"/"+args[1]+".xml"); if(deploy.exists() && deploy.isFile()){ File dest = new File(deployDir.getAbsolutePath()+"/"+args[1]+".xml.off"); deploy.renameTo(dest); ctx.println("DISABLED: " + args[1]); return; } File dest = new File(deployDir.getAbsolutePath()+"/"+args[1]+".xml.off"); if (dest.exists()) { ctx.println("Already disabled: " + args[1]); return; } ctx.println("Can't find the bean descriptor: "+args[1]); return; } }
if(log!=null) log.info("Initializing config decoration provider: "+ccdClass); decorator= (ConfigDecorationProvider) Q2.class.getClassLoader().loadClass(ccdClass).newInstance(); decorator.initialize(getDeployDir());
@Override public void exec(CLIContext ctx, String[] args) throws Exception { Q2 q2 = ctx.getCLI().getQ2(); File deployDir = q2.getDeployDir(); ctx.println(printDirectoryTree(deployDir)); return; }
@Test public void testGetDeployDir() throws Throwable { String[] args = new String[0]; File result = new Q2(args).getDeployDir(); assertEquals("result.getName()", "deploy", result.getName()); }
@Test public void testConstructor() throws Throwable { assertEquals("m_q2.getDeployDir().getName()", "deploy", m_q2.getDeployDir().getName()); assertSame("m_q2.getCommandLineArgs()", m_args, m_q2.getCommandLineArgs()); }