Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2327 - in infrastructure/jira-dpml/svn/src: main/net/dpml/jira test/net/dpml/jira

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: peter AT neubauer.se
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2327 - in infrastructure/jira-dpml/svn/src: main/net/dpml/jira test/net/dpml/jira
  • Date: Wed, 20 Apr 2005 02:55:57 -0400

Author: peter AT neubauer.se
Date: Wed Apr 20 02:55:48 2005
New Revision: 2327

Modified:
infrastructure/jira-dpml/svn/src/main/net/dpml/jira/SvnHelper.java
infrastructure/jira-dpml/svn/src/main/net/dpml/jira/SvnUpdateListener.java
infrastructure/jira-dpml/svn/src/test/net/dpml/jira/SvnCommandTest.java
Log:
update of important files now working \nwaiting for feedback on the password
grabbing from a SingOn event in order to put it into the svn files INFRA-3


Modified: infrastructure/jira-dpml/svn/src/main/net/dpml/jira/SvnHelper.java
==============================================================================
--- infrastructure/jira-dpml/svn/src/main/net/dpml/jira/SvnHelper.java
(original)
+++ infrastructure/jira-dpml/svn/src/main/net/dpml/jira/SvnHelper.java Wed
Apr 20 02:55:48 2005
@@ -17,22 +17,16 @@
*/
package net.dpml.jira;

+import java.io.BufferedReader;
import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
import java.io.PrintStream;
import java.io.PrintWriter;

public class SvnHelper
{
- public static void commit( String file, String user, String password,
- PrintStream log ) throws Exception
- {
- String[] t_args = new String[]{"svn", "commit", file, "--username",
- user, "--password", password};
- log.println( format( t_args ) );
- //executeCommand( log, t_args );
- return;
-
- }

private static String format( String[] iT_args )
{
@@ -44,15 +38,15 @@
return result.toString();
}

- public static void updateSvnPassword( String htpasswordPath,
- String iFile, String confirmedUser, String password,
- PrintStream log )
+ public static void updateSvnPassword( String htpasswordPath, String
iFile,
+ String confirmedUser, String password, PrintStream log )
{
try
{
- String[] t_args = new String[]{htpasswordPath, "-b",iFile ,
confirmedUser, password};
+ String[] t_args = new String[]{htpasswordPath, "-b", iFile,
+ confirmedUser, password};
log.println( t_args );
- executeCommand( log, t_args );
+ executeCommand( log, t_args, new File( "." ) );
return;
}
catch ( Exception e )
@@ -64,14 +58,16 @@
}

}
+
public static void commitSvn( String svnDir, String username,
PrintStream log )
{
try
{
- String[] t_args = new String[]{svnDir, "commit","-m", "Jira:
user " + username + "signed up or updated password"};
+ String[] t_args = new String[]{"svn", "commit", "-m",
+ "Jira: user " + username + "signed up or updated
password"};
log.println( t_args );
- executeCommand( log, t_args );
+ executeCommand( log, t_args, new File( svnDir ) );
return;
}
catch ( Exception e )
@@ -84,10 +80,10 @@

}

- private static void executeCommand( PrintStream log, String[] t_args )
- throws Exception
+ private static void executeCommand( PrintStream log, String[] t_args,
+ File workingDir ) throws Exception
{
- Process p = Runtime.getRuntime().exec( t_args );
+ Process p = Runtime.getRuntime().exec( t_args, null, workingDir );
if ( p.waitFor() != 0 )
{
java.io.DataInputStream dis = new java.io.DataInputStream( p
@@ -101,5 +97,33 @@
}
return;
}
+
+ public static void updateAuthFile(String authFile, String username,
String svnDir) throws Exception
+ {
+ File tAuthFile = new File(svnDir, authFile);
+ BufferedReader dis = new BufferedReader(new FileReader( tAuthFile ));
+ File tTempFile = new File(svnDir, authFile+".tmp");
+ PrintWriter out = new PrintWriter(new FileOutputStream(tTempFile));
+ String line;
+ while ( ( line = dis.readLine() ) != null )
+ {
+ if (!line.startsWith("active"))
+ {
+ out.println(line);
+ }
+ else
+ {
+ out.println(line + ", "+ username);
+ }
+ }
+ out.flush();
+ out.close();
+ //copy over the tmp file
+
+ String[] t_args = new String[]{"cp", tTempFile.getAbsolutePath(),
tAuthFile.getAbsolutePath()};
+ System.out.println( t_args );
+ executeCommand( System.out, t_args, new File( svnDir ) );
+
+ }

}

Modified:
infrastructure/jira-dpml/svn/src/main/net/dpml/jira/SvnUpdateListener.java
==============================================================================
---
infrastructure/jira-dpml/svn/src/main/net/dpml/jira/SvnUpdateListener.java
(original)
+++
infrastructure/jira-dpml/svn/src/main/net/dpml/jira/SvnUpdateListener.java
Wed Apr 20 02:55:48 2005
@@ -17,7 +17,6 @@
*/
package net.dpml.jira;

-import java.io.File;
import java.util.Map;

import com.atlassian.jira.event.JiraEvent;
@@ -41,8 +40,6 @@
{
public static final String PWD_FILE_NAME = "pwdFileName";

- private Map m_Params;
-
public static final String SVN_DIR = "svnDir";

private String m_svnWorkingDir;
@@ -53,7 +50,6 @@
{
log( "SvnListener.init" );
log( params.toString() );
- m_Params = params;
try
{
m_svnWorkingDir = params.get( SVN_DIR ).toString();
@@ -146,6 +142,14 @@
String password = "welcome";
SvnHelper.updateSvnPassword( "htpasswd2", m_passwordFile, username,
password, System.out );
+ try
+ {
+ SvnHelper.updateAuthFile("svn-authz-access.conf", username,
m_svnWorkingDir);
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
SvnHelper.commitSvn( m_svnWorkingDir, username, System.out );

}
@@ -176,10 +180,6 @@
if ( event instanceof IssueEvent )
{
IssueEvent issueEvent = (IssueEvent) event;
- // log("Issue: [#" + issueEvent.getIssue().getLong("id") +
"] "
- // + issueEvent.getIssue().getString("summary"));
- // log("Comment: " + issueEvent.getComment());
- // log("Change Group: " + issueEvent.getChangeLog());
}
else if ( event instanceof UserEvent )
{

Modified:
infrastructure/jira-dpml/svn/src/test/net/dpml/jira/SvnCommandTest.java
==============================================================================
--- infrastructure/jira-dpml/svn/src/test/net/dpml/jira/SvnCommandTest.java
(original)
+++ infrastructure/jira-dpml/svn/src/test/net/dpml/jira/SvnCommandTest.java
Wed Apr 20 02:55:48 2005
@@ -17,29 +17,40 @@
*/
package net.dpml.jira;

-import java.util.HashMap;
-import java.util.Map;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintWriter;

import junit.framework.TestCase;

public class SvnCommandTest extends TestCase
{
- public void testSvnCheckout() throws Exception
+ public void _testModifySvnAuthFile() throws Exception, IOException
{
- String m_string2 = "target";
- Map params = new HashMap();
- String file = "test";
- params.put(SvnUpdateListener.PWD_FILE_NAME,file);
- params.put(SvnUpdateListener.SVN_DIR,m_string2);
-
- //SvnUpdateListener listener = new SvnUpdateListener();
- //listener.init(params);
+ BufferedReader dis = new BufferedReader(new FileReader( new
File("svn-authz-access.conf") ));
+ PrintWriter out = new PrintWriter(new
FileOutputStream("svn-auth-temp.conf"));
+ String line;
+ while ( ( line = dis.readLine() ) != null )
+ {
+ if (!line.startsWith("active"))
+ {
+ out.println(line);
+ }
+ else
+ {
+ out.println(line + ",test");
+ }
+ }
+ out.flush();
+ out.close();

}
- public void testSvnCommit() throws Exception
+ public void testFummy()
{
- assertTrue(true);
- //SvnHelper.commit("/tmp/project.module", "peter AT neubauer.se",
"jhsmssf", "testing jira adapter", System.out );
+
}

}



  • svn commit: r2327 - in infrastructure/jira-dpml/svn/src: main/net/dpml/jira test/net/dpml/jira, peter, 04/19/2005

Archive powered by MHonArc 2.6.24.

Top of Page