Package com.pugh.sockso.web

Examples of com.pugh.sockso.web.User


        assertNotContains( res.getOutput(), "A Playlist" );
    }
   
    public void testOnlyCurrentUsersPlaylistsListedWhenRequestedByUserUrl() throws Exception {
        action.setRequest( getRequest("/api/playlists/user") );
        action.setUser( new User(1,"foo") );
        action.handleRequest();
        assertContains( res.getOutput(), "A Playlist" );
        assertNotContains( res.getOutput(), "Foo Foo" );
        assertNotContains( res.getOutput(), "Bar Bar" );
    }
View Full Code Here


        assertFalse( action.canHandle(getRequest("/api")) );
        assertFalse( action.canHandle(getRequest("/api/session/create")) );
    }
   
    public void test1ReturnedWhenUserHasSession() throws Exception {
        action.setUser( new User(1,"me") );
        action.handleRequest();
        assertEndsWith( res.getOutput(), "1" );
    }
View Full Code Here

        TestResponse res = new TestResponse();
        Sharer s = new Sharer();
        s.setRequest(new TestRequest("/") );
        s.setLocale( locale );
        s.setResponse( res );
        s.setUser( new User(-1,"foo") );
        s.setProperties( new StringProperties() );
        s.showSharePage( new String[] { "ar123" } );
        String data = res.getOutput();
        assertTrue( data.contains("ar123") );
    }
View Full Code Here

        PreparedStatement st = null;
               
        try {

            final Database db = getDatabase();
            final User user = getUser();
            final String sql = " insert into play_log ( track_id, date_played, user_id ) " +
                               " values ( ?, current_timestamp, ? ) ";
           
            st = db.prepare( sql );
            st.setInt( 1, track.getId() );
           
            if ( user != null )
                st.setInt( 2, user.getId() );
            else
                st.setNull( 2, Types.INTEGER );

            st.execute();
View Full Code Here

       
        try {

            validateInputFields();
           
            final User newUser = new User(
                txtName.getText(),
                new String(txtPass1.getPassword()),
                txtEmail.getText(),
                isAdmin.isSelected()
            );

            newUser.save( db );
           
            usersPanel.refreshUsers();
            close();

        }
View Full Code Here

     *
     */
   
    private void checkPermissions() throws BadRequestException {
       
        final User user = getUser();
        final Locale locale = getLocale();
        final Properties p = getProperties();

        // check uploads are enabled
        Utils.checkFeatureEnabled( p, "uploads.enabled" );
View Full Code Here

    protected void saveChanges() {

        for ( int i=0; i<table.getRowCount(); i++ ) {
           
            User user = new User(
                Integer.parseInt( model.getValueAt(i,0).toString() ),
                (String) model.getValueAt( i, 1 ),
                (String) model.getValueAt( i, 2 ),
                model.getValueAt( i, 4 ).equals( "true")
            );

            user.setActive( model.getValueAt( i, 5 ).equals("1") );

            try { user.update(db); }

            catch ( final SQLException e ) {
                log.error( e.getMessage() );
                JOptionPane.showMessageDialog(
                    parent,
View Full Code Here

        final Properties p = new StringProperties();
        final String name = Utils.getRandomString( 20 );
        final String email = Utils.getRandomString( 20 );
        final int sessionId = 23123;
        final String sessionCode = Utils.getRandomString( 20 );
        final User user = new User( 1, name, "", email, sessionId, sessionCode, true );

        String data = "";

        final Class[] classes = new Class[] {
            TXspf.class,
View Full Code Here

    public void testAuthFailsWhenUserDoesntExist() throws Exception {
        assertFalse( auth.authenticate("baz","q") );
    }

    public void testAuthFailsWhenTheUserIsNotActive() throws Exception {
        User user = new User( -1, "fooaaaaaa", "bar", "foosss@bar.com" );
        user.setActive( false );
        user.save( db );
        assertFalse( auth.authenticate(user.getName(),"bar") );
    }
View Full Code Here

    @Override
    public void setUp() {
        db = new TestDatabase();
        locale = new TestLocale();
        cmd = new UserActive( db, locale );
        user = new User( -1, "name", "pass", "email@domain.com" );
    }
View Full Code Here

TOP

Related Classes of com.pugh.sockso.web.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.